From: Roger Dingledine Date: Sat, 20 Mar 2004 20:28:53 +0000 (+0000) Subject: warn and fail if server chose a nickname with illegal characters X-Git-Tag: tor-0.0.3~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=568a4e0a0499233c6d8bf07c01903ca9f21361c6;p=thirdparty%2Ftor.git warn and fail if server chose a nickname with illegal characters svn:r1318 --- diff --git a/src/or/config.c b/src/or/config.c index 7434dfd2f3..799eb97966 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -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 */