]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
warn and fail if server chose a nickname with illegal characters
authorRoger Dingledine <arma@torproject.org>
Sat, 20 Mar 2004 20:28:53 +0000 (20:28 +0000)
committerRoger Dingledine <arma@torproject.org>
Sat, 20 Mar 2004 20:28:53 +0000 (20:28 +0000)
svn:r1318

src/or/config.c

index 7434dfd2f32d4f6bb89e3822e15ea2934820fdd4..799eb97966b312634a5addd41ff410167d097950 100644 (file)
@@ -568,9 +568,15 @@ int getconfig(int argc, char **argv, or_options_t *options) {
     result = -1;
   }
 
-  if(options->ORPort && options->Nickname == NULL) {
-    log_fn(LOG_WARN,"Nickname required if ORPort is set, but not found.");
-    result = -1;
+  if (options->ORPort) {
+    if (options->Nickname == NULL) {
+      log_fn(LOG_WARN,"Nickname required if ORPort is set, but not found.");
+      result = -1;
+    } else if (strspn(options->Nickname, LEGAL_NICKNAME_CHARACTERS) !=
+               strlen(options->Nickname)) {
+      log_fn(LOG_WARN, "Nickname '%s' contains illegal characters.", options->Nickname);
+      result = -1;
+    }
   }
 
   if(options->ORPort) { /* get an IP for ourselves */