aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-03-20 20:28:53 +0000
committerRoger Dingledine <arma@torproject.org>2004-03-20 20:28:53 +0000
commit568a4e0a0499233c6d8bf07c01903ca9f21361c6 (patch)
treed298e1b9065d986322e9d59c825d1ed805c1718e
parent4f0bad280d1a434f48233801f4e383c310283988 (diff)
downloadtor-568a4e0a0499233c6d8bf07c01903ca9f21361c6.tar
tor-568a4e0a0499233c6d8bf07c01903ca9f21361c6.tar.gz
warn and fail if server chose a nickname with illegal characters
svn:r1318
-rw-r--r--src/or/config.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 7434dfd2f..799eb9796 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 */