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

[or-cvs] New, more flexible directory parsing backend. Uses a bit mo...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv9740/src/or

Modified Files:
	dirserv.c or.h router.c routerlist.c test.c 
Log Message:
New, more flexible directory parsing backend. Uses a bit more RAM, but implements the new spec.  Uses more RAM, but not so you would notice.

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dirserv.c	17 Dec 2003 21:09:31 -0000	1.24
+++ dirserv.c	5 Mar 2004 05:48:28 -0000	1.25
@@ -218,7 +218,7 @@
   cp = desc_tmp = tor_strndup(start, desc_len);
 
   /* Check: is the descriptor syntactically valid? */
-  ri = router_get_entry_from_string(&cp);
+  ri = router_get_entry_from_string(cp, NULL);
   if (!ri) {
     log(LOG_WARN, "Couldn't parse descriptor");
     goto err;

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.244
retrieving revision 1.245
diff -u -d -r1.244 -r1.245
--- or.h	3 Mar 2004 22:49:15 -0000	1.244
+++ or.h	5 Mar 2004 05:48:28 -0000	1.245
@@ -860,7 +860,7 @@
 int router_get_dir_hash(const char *s, char *digest);
 int router_get_router_hash(const char *s, char *digest);
 int router_set_routerlist_from_directory(const char *s, crypto_pk_env_t *pkey);
-routerinfo_t *router_get_entry_from_string(const char **s);
+routerinfo_t *router_get_entry_from_string(const char *s, const char *end);
 int router_add_exit_policy_from_string(routerinfo_t *router, const char *s);
 int router_compare_addr_to_exit_policy(uint32_t addr, uint16_t port,
                                        struct exit_policy_t *policy);

Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- router.c	4 Mar 2004 01:53:56 -0000	1.13
+++ router.c	5 Mar 2004 05:48:28 -0000	1.14
@@ -499,7 +499,7 @@
 
 #ifdef DEBUG_ROUTER_DUMP_ROUTER_TO_STRING
   cp = s_tmp = s_dup = tor_strdup(s);
-  ri_tmp = router_get_entry_from_string(&cp);
+  ri_tmp = router_get_entry_from_string(cp, NULL);
   if (!ri_tmp) {
     log_fn(LOG_ERR, "We just generated a router descriptor we can't parse: <<%s>>",
            s);

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- routerlist.c	4 Mar 2004 01:53:56 -0000	1.30
+++ routerlist.c	5 Mar 2004 05:48:28 -0000	1.31
@@ -2,11 +2,6 @@
 /* See LICENSE for licensing information */
 /* $Id$ */
 
-#define OR_PUBLICKEY_BEGIN_TAG "-----BEGIN RSA PUBLIC KEY-----\n"
-#define OR_PUBLICKEY_END_TAG "-----END RSA PUBLIC KEY-----\n"
-#define OR_SIGNATURE_BEGIN_TAG "-----BEGIN SIGNATURE-----\n"
-#define OR_SIGNATURE_END_TAG "-----END SIGNATURE-----\n"
-
 #define _GNU_SOURCE
 /* XXX this is required on rh7 to make strptime not complain. how bad
  * is this for portability?
[...1208 lines suppressed...]
+    }
+  }
+  return out;
 }
-#else
-#define router_get_next_token _router_get_next_token
-#endif
+
 
 /* Compute the SHA digest of the substring of s taken from the first
  * occurrence of start_str through the first newline after the first
@@ -1318,8 +1430,6 @@
   return 0;
 }
 
-
-
 /*
   Local Variables:
   mode:c

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/src/or/test.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- test.c	1 Mar 2004 06:45:32 -0000	1.61
+++ test.c	5 Mar 2004 05:48:28 -0000	1.62
@@ -611,7 +611,7 @@
 
   test_assert(router_dump_router_to_string(buf, 2048, &r1, pk2)>0);
   cp = buf;
-  rp1 = router_get_entry_from_string((const char**)&cp);
+  rp1 = router_get_entry_from_string((const char*)cp,NULL);
   test_assert(rp1);
   test_streq(rp1->address, r1.address);
   test_eq(rp1->or_port, r1.or_port);
@@ -715,6 +715,7 @@
   test_onion();
   test_onion_handshake();
   puts("\n========================= Directory Formats ===============");
+  add_stream_log(LOG_DEBUG, NULL, stdout);
   test_dir_format();
   puts("");