From 72613dbceabfe7d8034c66f67e03f96852d8e22c Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 7 Oct 2003 23:25:10 +0000 Subject: [PATCH] successfully parse exit policies on future attempts too svn:r558 --- trunk/src/or/routers.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/trunk/src/or/routers.c b/trunk/src/or/routers.c index 34f73ea254..5d3a2bb9a3 100644 --- a/trunk/src/or/routers.c +++ b/trunk/src/or/routers.c @@ -950,6 +950,7 @@ static void router_free_exit_policy(routerinfo_t *router) { void router_add_exit_policy_from_config(routerinfo_t *router) { char *s = options.ExitPolicy, *e; int last=0; + char line[1024]; if(!s) { log_fn(LOG_INFO,"No exit policy configured. Ok."); @@ -962,13 +963,16 @@ void router_add_exit_policy_from_config(routerinfo_t *router) { for(;;) { e = strchr(s,','); - if(!e) + if(!e) { last = 1; - else - *e = 0; - log_fn(LOG_DEBUG,"Adding new entry '%s'",s); - if(router_add_exit_policy_from_string(router,s) < 0) - log_fn(LOG_WARNING,"Malformed exit policy %s; skipping.", s); + strcpy(line,s); + } else { + memcpy(line,s,e-s); + line[e-s] = 0; + } + log_fn(LOG_DEBUG,"Adding new entry '%s'",line); + if(router_add_exit_policy_from_string(router,line) < 0) + log_fn(LOG_WARNING,"Malformed exit policy %s; skipping.", line); if(last) return; s = e+1;