[or-cvs] Fix dirserv_get_networkstatus_v2"s api: its function comments

arma at seul.org arma at seul.org
Sat Apr 1 22:00:51 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 directory.c dirserv.c or.h 
Log Message:
Fix dirserv_get_networkstatus_v2's api: its function comments
did not at all match its behavior, and I can't think of a case
when it should return anything other than 0.

This fix may allow getinfo dir/status/foo to work.


Index: control.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -p -d -r1.185 -r1.186
--- control.c	1 Apr 2006 09:54:54 -0000	1.185
+++ control.c	1 Apr 2006 22:00:48 -0000	1.186
@@ -1509,11 +1509,8 @@ handle_getinfo_helper(const char *questi
     if (!get_options()->DirPort)
       return 0;
     status_list = smartlist_create();
-    if (!dirserv_get_networkstatus_v2(status_list,
-                                      question+strlen("dir/status/"))) {
-      smartlist_free(status_list);
-      return 0;
-    }
+    dirserv_get_networkstatus_v2(status_list,
+                                 question+strlen("dir/status/"));
     len = 0;
     SMARTLIST_FOREACH(status_list, cached_dir_t *, d, len += d->dir_len);
     cp = *answer = tor_malloc(len+1);

Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.366
retrieving revision 1.367
diff -u -p -d -r1.366 -r1.367
--- directory.c	27 Mar 2006 07:33:13 -0000	1.366
+++ directory.c	1 Apr 2006 22:00:49 -0000	1.367
@@ -1430,10 +1430,7 @@ directory_handle_command_get(connection_
     const char *key = url + strlen("/tor/status/");
     if (deflated)
       url[url_len-2] = '\0';
-    if (dirserv_get_networkstatus_v2(dir_objs, key)) {
-      smartlist_free(dir_objs);
-      return 0;
-    }
+    dirserv_get_networkstatus_v2(dir_objs, key);
     if (!strcmpstart(key, "fp/"))
       request_type = deflated?"/tor/status/fp.z":"/tor/status/fp";
     else if (!strcmpstart(key, "authority"))

Index: dirserv.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.319
retrieving revision 1.320
diff -u -p -d -r1.319 -r1.320
--- dirserv.c	29 Mar 2006 09:21:23 -0000	1.319
+++ dirserv.c	1 Apr 2006 22:00:49 -0000	1.320
@@ -1454,12 +1454,9 @@ generate_v2_networkstatus(void)
 /** Look for a network status object as specified by <b>key</b>, which should
  * be either "authority" (to find a network status generated by us), a hex
  * identity digest (to find a network status generated by given directory), or
- * "all" (to return all the v2 network status objects we have, concatenated).
- * If <b>compress</b>, find the version compressed with zlib.  Return 0 if
- * nothing was found; otherwise set *<b>directory</b> to the matching network
- * status and return its length.
+ * "all" (to return all the v2 network status objects we have).
  */
-int
+void
 dirserv_get_networkstatus_v2(smartlist_t *result,
                              const char *key)
 {
@@ -1468,7 +1465,7 @@ dirserv_get_networkstatus_v2(smartlist_t
   if (!cached_v2_networkstatus)
     cached_v2_networkstatus = digestmap_new();
 
-  if (!(strcmp(key,"authority"))) {
+  if (!strcmp(key,"authority")) {
     if (get_options()->AuthoritativeDir) {
       cached_dir_t *d =
         dirserv_pick_cached_dir_obj(NULL,
@@ -1518,7 +1515,6 @@ dirserv_get_networkstatus_v2(smartlist_t
         });
     smartlist_free(digests);
   }
-  return 0;
 }
 
 /** Add a signed_descriptor_t to <b>descs_out</b> for each router matching

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.817
retrieving revision 1.818
diff -u -p -d -r1.817 -r1.818
--- or.h	28 Mar 2006 12:01:58 -0000	1.817
+++ or.h	1 Apr 2006 22:00:49 -0000	1.818
@@ -1924,7 +1924,7 @@ void dirserv_set_cached_directory(const 
 void dirserv_set_cached_networkstatus_v2(const char *directory,
                                          const char *identity,
                                          time_t published);
-int dirserv_get_networkstatus_v2(smartlist_t *result, const char *key);
+void dirserv_get_networkstatus_v2(smartlist_t *result, const char *key);
 int dirserv_get_routerdescs(smartlist_t *descs_out, const char *key,
                             const char **msg);
 void dirserv_orconn_tls_done(const char *address,



More information about the tor-commits mailing list