[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] dump exit policies correctly to descriptor



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

Modified Files:
	routers.c 
Log Message:
dump exit policies correctly to descriptor


Index: routers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routers.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- routers.c	16 Nov 2003 17:00:02 -0000	1.91
+++ routers.c	16 Nov 2003 17:15:40 -0000	1.92
@@ -1198,6 +1198,10 @@
   return;
 }
 
+/* XXX need to audit this thing and count fenceposts. maybe
+ *     refactor so we don't have to keep asking if we're
+ *     near the end of maxlen?
+ */
 #define DEBUG_ROUTER_DUMP_ROUTER_TO_STRING
 int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
                                  crypto_pk_env_t *ident_key) {
@@ -1251,7 +1255,7 @@
                     "onion-key\n%s"
                     "link-key\n%s"
                     "signing-key\n%s",
-    router->nickname,             
+    router->nickname,
     router->address,
     router->or_port,
     router->socks_port,
@@ -1294,11 +1298,15 @@
         return -1;
       written += result;
     } else {
-      if (written > maxlen-3)
+      if (written > maxlen-4)
         return -1;
       strcat(s+written, ":*");
     }
-  }
+    if(written > maxlen-1)
+      return -1;
+    strcat(s+written, "\n");
+    written++;
+  } /* end for */
   if (written > maxlen-256) /* Not enough room for signature. */
     return -1;