diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-11-10 16:06:43 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-11-10 16:06:43 -0500 |
commit | a4bf5b51e9c84a74720ea95eed19d21faf8333ae (patch) | |
tree | e4b75a2aa05c44a48c1b75af97bc36415d0f94d8 /src/or/routerparse.c | |
parent | 6b4db953c9c1416683da160bd2419dc0eb50e9bd (diff) | |
parent | 2a50dd9359ec9bd113c64aa91cb5c2dd875de7dd (diff) | |
download | tor-a4bf5b51e9c84a74720ea95eed19d21faf8333ae.tar.gz tor-a4bf5b51e9c84a74720ea95eed19d21faf8333ae.zip |
Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r-- | src/or/routerparse.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 96749e5a74..1ce105abab 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -1312,10 +1312,16 @@ router_parse_entry_from_string(const char *s, const char *end, s = cp+1; } - if (allow_annotations && start_of_annotations != s) { - if (tokenize_string(area,start_of_annotations,s,tokens, - routerdesc_token_table,TS_NOCHECK)) { - log_warn(LD_DIR, "Error tokenizing router descriptor (annotations)."); + if (start_of_annotations != s) { /* We have annotations */ + if (allow_annotations) { + if (tokenize_string(area,start_of_annotations,s,tokens, + routerdesc_token_table,TS_NOCHECK)) { + log_warn(LD_DIR, "Error tokenizing router descriptor (annotations)."); + goto err; + } + } else { + log_warn(LD_DIR, "Found unexpected annotations on router descriptor not " + "loaded from disk. Dropping it."); goto err; } } @@ -3967,6 +3973,9 @@ tokenize_string(memarea_t *area, end = start+strlen(start); for (i = 0; i < _NIL; ++i) counts[i] = 0; + + SMARTLIST_FOREACH(out, const directory_token_t *, t, ++counts[t->tp]); + while (*s < end && (!tok || tok->tp != _EOF)) { tok = get_next_token(area, s, end, table); if (tok->tp == _ERR) { |