From: Nick Mathewson Date: Tue, 9 Nov 2004 04:46:24 +0000 (+0000) Subject: Stop DataDirectory from changing; also stop using new as an identifier? X-Git-Tag: debian-version-0.0.8+0.0.9pre5-1~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=929b1729557175a33eae5a06d965ceecfa6524bc;p=thirdparty%2Ftor.git Stop DataDirectory from changing; also stop using new as an identifier? svn:r2717 --- diff --git a/src/or/config.c b/src/or/config.c index 3e250a5208..ddda3e52db 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1180,27 +1180,35 @@ options_validate(or_options_t *options) /** Check if any of the previous options have changed but aren't allowed to. */ static int -options_transition_allowed(or_options_t *old, or_options_t *new) { +options_transition_allowed(or_options_t *old, or_options_t *new_val) { if(!old) return 0; if (old->PidFile && - (!new->PidFile || strcmp(old->PidFile,new->PidFile))) { + (!new_val->PidFile || strcmp(old->PidFile,new_val->PidFile))) { log_fn(LOG_WARN,"PidFile is not allowed to change. Failing."); return -1; } - if (old->RunAsDaemon && !new->RunAsDaemon) { + if (old->RunAsDaemon && !new_val->RunAsDaemon) { log_fn(LOG_WARN,"During reload, change from RunAsDaemon=1 to =0 not allowed. Failing."); return -1; } - if (old->ORPort != new->ORPort) { + if (old->ORPort != new_val->ORPort) { log_fn(LOG_WARN,"During reload, changing ORPort is not allowed. Failing."); return -1; } + if ((old->DataDirectory && + (!new_val->DataDirectory || + strcmp(old->DataDirectory,new_val->DataDirectory)!=0)) || + (!old->DataDirectory && new_val->DataDirectory)) { + log_fn(LOG_WARN,"During reload, changing DataDirectory is not allowed. Failing."); + return -1; + } + return 0; }