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

[or-cvs] Fix unit tests that used old signature for add_fingerprint_...



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

Modified Files:
	test.c dirserv.c 
Log Message:
Fix unit tests that used old signature for add_fingerprint_to_dir

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/test.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -d -r1.182 -r1.183
--- test.c	11 Jun 2005 18:52:11 -0000	1.182
+++ test.c	27 Jun 2005 22:25:09 -0000	1.183
@@ -29,7 +29,8 @@
 int have_failed = 0;
 
 /* These functions are file-local, but are exposed so we can test. */
-void add_fingerprint_to_dir(const char *nickname, const char *fp);
+void add_fingerprint_to_dir(const char *nickname, const char *fp,
+                            smartlist_t *list);
 void get_platform_str(char *platform, size_t len);
 int is_obsolete_version(const char *myversion, const char *start);
 
@@ -1245,10 +1246,14 @@
 #endif
 
   /* Okay, now for the directories. */
-  crypto_pk_get_fingerprint(pk2, buf, 1);
-  add_fingerprint_to_dir("Magri", buf);
-  crypto_pk_get_fingerprint(pk1, buf, 1);
-  add_fingerprint_to_dir("Fred", buf);
+  {
+    extern smartlist_t *fingerprint_list;
+    fingerprint_list = smartlist_create();
+    crypto_pk_get_fingerprint(pk2, buf, 1);
+    add_fingerprint_to_dir("Magri", buf, fingerprint_list);
+    crypto_pk_get_fingerprint(pk1, buf, 1);
+    add_fingerprint_to_dir("Fred", buf, fingerprint_list);
+  }
   /* Make sure routers aren't too far in the past any more. */
   r1.published_on = time(NULL);
   r2.published_on = time(NULL)-3*60*60;

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -d -r1.170 -r1.171
--- dirserv.c	21 Jun 2005 01:00:42 -0000	1.170
+++ dirserv.c	27 Jun 2005 22:25:09 -0000	1.171
@@ -35,7 +35,8 @@
 
 /** List of nickname-\>identity fingerprint mappings for all the routers
  * that we recognize. Used to prevent Sybil attacks. */
-static smartlist_t *fingerprint_list = NULL;
+/* Should be static; exposed for testing */
+smartlist_t *fingerprint_list = NULL;
 
 /** Add the fingerprint <b>fp</b> for the nickname <b>nickname</b> to
  * the smartlist of fingerprint_entry_t's <b>list</b>. Return 0 if it's