Browse Source

Implement --verify-config command-line option to fix bug 69.

svn:r4182
Nick Mathewson 20 years ago
parent
commit
bc51c8b074
3 changed files with 9 additions and 0 deletions
  1. 2 0
      src/or/config.c
  2. 6 0
      src/or/main.c
  3. 1 0
      src/or/or.h

+ 2 - 0
src/or/config.c

@@ -1799,6 +1799,8 @@ init_from_config(int argc, char **argv)
       newoptions->command = CMD_HASH_PASSWORD;
       newoptions->command_arg = tor_strdup( (i < argc-1) ? argv[i+1] : "");
       ++i;
+    } else if (!strcmp(argv[i],"--verify-config")) {
+      newoptions->command = CMD_VERIFY_CONFIG;
     }
   }
 

+ 6 - 0
src/or/main.c

@@ -1409,6 +1409,9 @@ void nt_service_main(void)
       case CMD_HASH_PASSWORD:
         do_hash_password();
         break;
+      case CMD_VERIFY_CONFIG:
+        printf("Configuration was valid\n");
+        break;
       default:
         log_fn(LOG_ERR, "Illegal command number %d: internal error.", get_options()->command);
       }
@@ -1594,6 +1597,9 @@ int tor_main(int argc, char *argv[]) {
   case CMD_HASH_PASSWORD:
     do_hash_password();
     break;
+  case CMD_VERIFY_CONFIG:
+    printf("Configuration was valid\n");
+    break;
   default:
     log_fn(LOG_ERR, "Illegal command number %d: internal error.",
            get_options()->command);

+ 1 - 0
src/or/or.h

@@ -954,6 +954,7 @@ typedef struct {
   /** What should the tor process actually do? */
   enum {
     CMD_RUN_TOR=0, CMD_LIST_FINGERPRINT, CMD_HASH_PASSWORD,
+    CMD_VERIFY_CONFIG,
   } command;
   const char *command_arg; /**< Argument for command-line option. */