[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Do not replace old directory if new one is invalid
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv22725/src/or
Modified Files:
routers.c
Log Message:
Do not replace old directory if new one is invalid
Index: routers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routers.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- routers.c 7 May 2003 18:30:46 -0000 1.25
+++ routers.c 7 May 2003 18:39:44 -0000 1.26
@@ -524,7 +524,7 @@
int router_get_list_from_string_impl(char *s, directory_t **dest) {
directory_token_t tok;
if (router_get_next_token(&s, &tok)) {
- return NULL;
+ return -1;
}
return router_get_list_from_string_tok(&s, dest, &tok);
}
@@ -557,6 +557,7 @@
directory_token_t tok;
char digest[20];
char signed_digest[128];
+ directory_t *new_dir = NULL;
#define NEXT_TOK() \
do { \
@@ -584,7 +585,7 @@
TOK_IS(K_SERVER_SOFTWARE, "server-software");
NEXT_TOK();
- if (router_get_list_from_string_tok(&s, dest, &tok))
+ if (router_get_list_from_string_tok(&s, &new_dir, &tok))
return -1;
TOK_IS(K_DIRECTORY_SIGNATURE, "directory-signature");
@@ -608,6 +609,10 @@
NEXT_TOK();
TOK_IS(_EOF, "end of directory");
+ if (*dest)
+ directory_free(*dest);
+ *dest = new_dir;
+
return 0;
#undef NEXT_TOK
#undef TOK_IS
@@ -655,7 +660,8 @@
}
return -1;
}
-static int
+
+int
router_resolve(routerinfo_t *router)
{
struct hostent *rent;