Require allow-submit=yes and allow-pass-on=yes
authorTim Pepper <timothy.c.pepper@linux.intel.com>
Tue, 11 Sep 2012 21:33:18 +0000 (14:33 -0700)
committerTim Pepper <timothy.c.pepper@linux.intel.com>
Tue, 11 Sep 2012 21:33:18 +0000 (14:33 -0700)
Refuse to run if allow-submit=yes and allow-pass-on=yes are not set in the
config file.  These will be set by a prompt at first boot.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
src/configfile.c

index 1003a1c..d1634a2 100644 (file)
@@ -64,6 +64,30 @@ void read_config_file(char *filename)
 
                line_end = line + line_len;
 
+               c = strstr(line, "allow-submit");
+               if (c) {
+                       c+=13;
+                       if (c < line_end) {
+                               if (!strstr(c, "yes")) {
+                                       printf("Error: allow-submit!=yes in config file.\n");
+                                       printf("Corewatcher will not run.\n");
+                                       exit(-1);
+                               }
+                       }
+               }
+
+               c = strstr(line, "allow-pass-on");
+               if (c) {
+                       c+=14;
+                       if (c < line_end) {
+                               if (!strstr(c, "yes")) {
+                                       printf("Error: allow-pass-on!=yes in config file.\n");
+                                       printf("Corewatcher will not run.\n");
+                                       exit(-1);
+                               }
+                       }
+               }
+
                c = strstr(line, "submit-url");
                if (c && url_count <= MAX_URLS) {
                        c += 11;