[or-cvs] if you give mapaddress no args at all, it should answer

arma at seul.org arma at seul.org
Sun Apr 2 22:13:36 UTC 2006


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

Modified Files:
	control.c 
Log Message:
if you give mapaddress no args at all, it should answer
something more than \r\n.


Index: control.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -p -d -r1.187 -r1.188
--- control.c	1 Apr 2006 22:17:37 -0000	1.187
+++ control.c	2 Apr 2006 22:13:34 -0000	1.188
@@ -1247,16 +1247,22 @@ handle_control_mapaddress(connection_t *
   if (v0) {
     r = smartlist_join_strings(reply, "\n", 1, &sz);
     send_control_done2(conn,r,sz);
+    tor_free(r);
   } else {
-    if (smartlist_len(reply))
+    if (smartlist_len(reply)) {
       ((char*)smartlist_get(reply,smartlist_len(reply)-1))[3] = ' ';
-    r = smartlist_join_strings(reply, "\r\n", 1, &sz);
-    connection_write_to_buf(r, sz, conn);
+      r = smartlist_join_strings(reply, "\r\n", 1, &sz);
+      connection_write_to_buf(r, sz, conn);
+      tor_free(r);
+    } else {
+      const char *response =
+        "512 syntax error: not enough arguments to mapaddress.";
+      connection_write_to_buf(response, strlen(response), conn);
+    }
   }
 
   SMARTLIST_FOREACH(reply, char *, cp, tor_free(cp));
   smartlist_free(reply);
-  tor_free(r);
   return 0;
 }
 



More information about the tor-commits mailing list