aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-10-07 23:25:10 +0000
committerRoger Dingledine <arma@torproject.org>2003-10-07 23:25:10 +0000
commitaca4bc5126cc3b32e8f431ebd0e7d12625fb01d9 (patch)
treea65338dfdc6021703945a5c536c8deabd7705333 /src
parentc42d928b30629af8db66078221f9ad7a4379177f (diff)
downloadtor-aca4bc5126cc3b32e8f431ebd0e7d12625fb01d9.tar
tor-aca4bc5126cc3b32e8f431ebd0e7d12625fb01d9.tar.gz
successfully parse exit policies on future attempts too
svn:r558
Diffstat (limited to 'src')
-rw-r--r--src/or/routers.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/or/routers.c b/src/or/routers.c
index 34f73ea25..5d3a2bb9a 100644
--- a/src/or/routers.c
+++ b/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;