[or-cvs] Add some "to-be-safe" escaped() wrappers to log statements ...

Nick Mathewson nickm at seul.org
Mon Mar 6 00:25:42 UTC 2006


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv16315/src/or

Modified Files:
	rendclient.c rendservice.c 
Log Message:
Add some "to-be-safe" escaped() wrappers to log statements in rend*.c, though I am not 100% sure that each one is necessary.

Index: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendclient.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -p -d -r1.106 -r1.107
--- rendclient.c	19 Feb 2006 22:02:02 -0000	1.106
+++ rendclient.c	6 Mar 2006 00:25:39 -0000	1.107
@@ -71,8 +71,8 @@ rend_client_send_introduction(circuit_t 
 
   if (rend_cache_lookup_entry(introcirc->rend_query, -1, &entry) < 1) {
     log_warn(LD_REND,
-             "query '%s' didn't have valid rend desc in cache. Failing.",
-             safe_str(introcirc->rend_query));
+             "query %s didn't have valid rend desc in cache. Failing.",
+             escaped_safe_str(introcirc->rend_query));
     goto err;
   }
 
@@ -227,14 +227,14 @@ rend_client_introduction_acked(circuit_t
       extend_info = rend_client_get_random_intro(circ->rend_query);
       if (!extend_info) {
         log_warn(LD_REND, "No introduction points left for %s. Closing.",
-                 safe_str(circ->rend_query));
+                 escaped_safe_str(circ->rend_query));
         circuit_mark_for_close(circ, END_CIRC_AT_ORIGIN);
         return -1;
       }
       log_info(LD_REND,
                "Got nack for %s from %s. Re-extending circ %d, "
                "this time to %s.",
-               safe_str(circ->rend_query),
+               escaped_safe_str(circ->rend_query),
                circ->build_state->chosen_exit->nickname, circ->n_circ_id,
                extend_info->nickname);
       result = circuit_extend_to_new_exit(circ, extend_info);
@@ -256,7 +256,7 @@ rend_client_refetch_renddesc(const char 
     return;
   if (connection_get_by_type_state_rendquery(CONN_TYPE_DIR, 0, query)) {
     log_info(LD_REND,"Would fetch a new renddesc here (for %s), but one is "
-             "already in progress.", safe_str(query));
+             "already in progress.", escaped_safe_str(query));
   } else {
     /* not one already; initiate a dir rend desc lookup */
     directory_get_from_dirserver(DIR_PURPOSE_FETCH_RENDDESC, query, 1);
@@ -278,12 +278,12 @@ rend_client_remove_intro_point(extend_in
 
   r = rend_cache_lookup_entry(query, -1, &ent);
   if (r<0) {
-    log_warn(LD_BUG, "Bug: malformed service ID '%s'.", safe_str(query));
+    log_warn(LD_BUG, "Bug: malformed service ID %s.", escaped_safe_str(query));
     return -1;
   }
   if (r==0) {
     log_info(LD_REND, "Unknown service %s. Re-fetching descriptor.",
-             safe_str(query));
+             escaped_safe_str(query));
     rend_client_refetch_renddesc(query);
     return 0;
   }
@@ -319,7 +319,7 @@ rend_client_remove_intro_point(extend_in
   if (!ent->parsed->n_intro_points) {
     log_info(LD_REND,
              "No more intro points remain for %s. Re-fetching descriptor.",
-             safe_str(query));
+             escaped_safe_str(query));
     rend_client_refetch_renddesc(query);
 
     /* move all pending streams back to renddesc_wait */
@@ -331,7 +331,7 @@ rend_client_remove_intro_point(extend_in
     return 0;
   }
   log_info(LD_REND,"%d options left for %s.",
-           ent->parsed->n_intro_points, safe_str(query));
+           ent->parsed->n_intro_points, escaped_safe_str(query));
   return 1;
 }
 

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendservice.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -p -d -r1.156 -r1.157
--- rendservice.c	19 Feb 2006 22:02:02 -0000	1.156
+++ rendservice.c	6 Mar 2006 00:25:39 -0000	1.157
@@ -430,7 +430,7 @@ rend_service_introduce(circuit_t *circui
   base32_encode(serviceid, REND_SERVICE_ID_LEN+1,
                 circuit->rend_pk_digest,10);
   log_info(LD_REND, "Received INTRODUCE2 cell for service %s on circ %d.",
-           serviceid, circuit->n_circ_id);
+           escaped(serviceid), circuit->n_circ_id);
 
   if (circuit->purpose != CIRCUIT_PURPOSE_S_INTRO) {
     log_warn(LD_PROTOCOL,
@@ -451,13 +451,13 @@ rend_service_introduce(circuit_t *circui
   service = rend_service_get_by_pk_digest(request);
   if (!service) {
     log_warn(LD_REND, "Got an INTRODUCE2 cell for an unrecognized service %s.",
-             serviceid);
+             escaped(serviceid));
     return -1;
   }
   if (memcmp(circuit->rend_pk_digest, request, DIGEST_LEN)) {
     base32_encode(serviceid, REND_SERVICE_ID_LEN+1, request, 10);
     log_warn(LD_REND, "Got an INTRODUCE2 cell for the wrong service (%s).",
-             serviceid);
+             escaped(serviceid));
     return -1;
   }
 
@@ -534,8 +534,8 @@ rend_service_introduce(circuit_t *circui
                                * any */
     router = router_get_by_nickname(rp_nickname, 0);
     if (!router) {
-      log_info(LD_REND, "Couldn't find router '%s' named in rendezvous cell.",
-               rp_nickname);
+      log_info(LD_REND, "Couldn't find router %s named in rendezvous cell.",
+               escaped(rp_nickname));
       goto err;
     }
 
@@ -646,13 +646,13 @@ rend_service_relaunch_rendezvous(circuit
     return;
   }
 
-  log_info(LD_REND,"Reattempting rendezvous circuit to %s",
+  log_info(LD_REND,"Reattempting rendezvous circuit to '%s'",
            oldstate->chosen_exit->nickname);
 
   newcirc = circuit_launch_by_extend_info(CIRCUIT_PURPOSE_S_CONNECT_REND,
                                oldstate->chosen_exit, 0, 1, 1);
   if (!newcirc) {
-    log_warn(LD_REND,"Couldn't relaunch rendezvous circuit to %s.",
+    log_warn(LD_REND,"Couldn't relaunch rendezvous circuit to '%s'.",
              oldstate->chosen_exit->nickname);
     return;
   }



More information about the tor-commits mailing list