[or-cvs] successfully parse exit policies on future attempts too

Roger Dingledine arma at seul.org
Tue Oct 7 23:25:12 UTC 2003


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	routers.c 
Log Message:
successfully parse exit policies on future attempts too


Index: routers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routers.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- routers.c	7 Oct 2003 23:04:31 -0000	1.75
+++ routers.c	7 Oct 2003 23:25:10 -0000	1.76
@@ -950,6 +950,7 @@
 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 @@
 
   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;



More information about the tor-commits mailing list