commit 19bf5806adb80e513bb2707a1686216225fef420 Author: teor teor@torproject.org Date: Thu Jun 6 08:52:13 2019 +1000
dirauth: Return a distinct status when formatting annotations fails
Adds ROUTER_AUTHDIR_BUG_ANNOTATIONS to was_router_added_t.
The out-of-order numbering is deliberate: it will be fixed by later commits for 16564.
Fixes bug 30780; bugfix on 0.2.0.8-alpha. --- changes/bug30780 | 3 +++ src/feature/dirauth/process_descs.c | 4 +--- src/feature/nodelist/routerlist.h | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/changes/bug30780 b/changes/bug30780 new file mode 100644 index 000000000..5731d201a --- /dev/null +++ b/changes/bug30780 @@ -0,0 +1,3 @@ + o Minor bugfixes (directory authorities): + - Return a distinct status when formatting annotations fails. + Fixes bug 30780; bugfix on 0.2.0.8-alpha. diff --git a/src/feature/dirauth/process_descs.c b/src/feature/dirauth/process_descs.c index 17936add5..a68d15565 100644 --- a/src/feature/dirauth/process_descs.c +++ b/src/feature/dirauth/process_descs.c @@ -556,9 +556,7 @@ dirserv_add_multiple_descriptors(const char *desc, size_t desclen, !general ? router_purpose_to_string(purpose) : "", !general ? "\n" : "")<0) { *msg = "Couldn't format annotations"; - /* XXX Not cool: we return -1 below, but (was_router_added_t)-1 is - * ROUTER_BAD_EI, which isn't what's gone wrong here. :( */ - return -1; + return ROUTER_AUTHDIR_BUG_ANNOTATIONS; }
s = desc; diff --git a/src/feature/nodelist/routerlist.h b/src/feature/nodelist/routerlist.h index d7f44cb80..dc9203e01 100644 --- a/src/feature/nodelist/routerlist.h +++ b/src/feature/nodelist/routerlist.h @@ -39,7 +39,10 @@ typedef enum was_router_added_t { * OLD_ROUTER_DESC_MAX_AGE. */ ROUTER_WAS_TOO_OLD = -7, /* note contrast with 'ROUTER_IS_ALREADY_KNOWN' */ /* Some certs on this router are expired. */ - ROUTER_CERTS_EXPIRED = -8 + ROUTER_CERTS_EXPIRED = -8, + /* We couldn't format the annotations for this router. This is a directory + * authority bug. */ + ROUTER_AUTHDIR_BUG_ANNOTATIONS = -10 } was_router_added_t;
/** How long do we avoid using a directory server after it's given us a 503? */
tor-commits@lists.torproject.org