mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
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.
svn:r1235
This commit is contained in:
parent
9d00c4b81c
commit
1e5b7bc6f1
@ -218,7 +218,7 @@ dirserv_add_descriptor(const char **desc)
|
||||
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;
|
||||
|
@ -860,7 +860,7 @@ int router_set_routerlist_from_string(const char *s);
|
||||
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);
|
||||
|
@ -499,7 +499,7 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
|
||||
|
||||
#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);
|
||||
|
1000
src/or/routerlist.c
1000
src/or/routerlist.c
File diff suppressed because it is too large
Load Diff
@ -611,7 +611,7 @@ test_dir_format()
|
||||
|
||||
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 @@ main(int c, char**v){
|
||||
test_onion();
|
||||
test_onion_handshake();
|
||||
puts("\n========================= Directory Formats ===============");
|
||||
add_stream_log(LOG_DEBUG, NULL, stdout);
|
||||
test_dir_format();
|
||||
puts("");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user