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

[or-cvs] fix bug 180: handle duplicate lines in approved-routers fil...



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

Modified Files:
	dirserv.c 
Log Message:
fix bug 180: handle duplicate lines in approved-routers files.

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -d -r1.176 -r1.177
--- dirserv.c	14 Aug 2005 08:38:34 -0000	1.176
+++ dirserv.c	23 Aug 2005 22:00:35 -0000	1.177
@@ -47,22 +47,25 @@
 {
   int i;
   fingerprint_entry_t *ent;
+  char *fingerprint;
   tor_assert(nickname);
   tor_assert(fp);
   tor_assert(list);
 
+  fingerprint = tor_strdup(fp);
+  tor_strstrip(fingerprint, " ");
+
   for (i = 0; i < smartlist_len(list); ++i) {
     ent = smartlist_get(list, i);
     if (!strcasecmp(ent->nickname,nickname)) {
       tor_free(ent->fingerprint);
-      ent->fingerprint = tor_strdup(fp);
+      ent->fingerprint = fingerprint;
       return 1;
     }
   }
   ent = tor_malloc(sizeof(fingerprint_entry_t));
   ent->nickname = tor_strdup(nickname);
-  ent->fingerprint = tor_strdup(fp);
-  tor_strstrip(ent->fingerprint, " ");
+  ent->fingerprint = fingerprint;
   smartlist_add(list, ent);
   return 0;
 }