diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-06-27 22:25:09 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-06-27 22:25:09 +0000 |
commit | 30571317dda56a83eeb077af5f1fefc61c7d3c9c (patch) | |
tree | bf19654228a9d2b50a54a9e9b15309d9d5a188db | |
parent | 68d706a9b0517bbb958d2f72804262a1254ff71d (diff) | |
download | tor-30571317dda56a83eeb077af5f1fefc61c7d3c9c.tar.gz tor-30571317dda56a83eeb077af5f1fefc61c7d3c9c.zip |
Fix unit tests that used old signature for add_fingerprint_to_dir
svn:r4495
-rw-r--r-- | src/or/dirserv.c | 3 | ||||
-rw-r--r-- | src/or/test.c | 15 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 9de54db06a..95ed689bc3 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -35,7 +35,8 @@ typedef struct fingerprint_entry_t { /** 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 diff --git a/src/or/test.c b/src/or/test.c index 0ec4390680..6f1ee4f9f6 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -29,7 +29,8 @@ const char test_c_id[] = "$Id$"; 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 @@ test_dir_format(void) #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; |