diff options
author | David Goulet <dgoulet@torproject.org> | 2019-05-28 13:49:03 -0400 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-11-18 19:06:43 +0200 |
commit | 542402cd60bc6b26f43c399b238602a1f3c18d85 (patch) | |
tree | f01022bb3efb2de38933c4ec3a5b6dd71c0b30bc /src/feature/dirclient | |
parent | fb1d2120212bef100f2b5e90d27b8c251280cb0c (diff) | |
download | tor-542402cd60bc6b26f43c399b238602a1f3c18d85.tar.gz tor-542402cd60bc6b26f43c399b238602a1f3c18d85.zip |
hs-v3: Set extended error when missing/bad client auth
Part of #30382
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/dirclient')
-rw-r--r-- | src/feature/dirclient/dirclient.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/feature/dirclient/dirclient.c b/src/feature/dirclient/dirclient.c index 64205a44e3..abece62dd4 100644 --- a/src/feature/dirclient/dirclient.c +++ b/src/feature/dirclient/dirclient.c @@ -2734,21 +2734,40 @@ handle_response_fetch_hsdesc_v3(dir_connection_t *conn, /* We got something: Try storing it in the cache. */ decode_status = hs_cache_store_as_client(body, &conn->hs_ident->identity_pk); - if (decode_status != HS_DESC_DECODE_OK) { - log_info(LD_REND, "Failed to store hidden service descriptor"); - /* Fire control port FAILED event. */ - hs_control_desc_event_failed(conn->hs_ident, conn->identity_digest, - "BAD_DESC"); - hs_control_desc_event_content(conn->hs_ident, conn->identity_digest, - NULL); - } else { + switch (decode_status) { + case HS_DESC_DECODE_OK: + case HS_DESC_DECODE_NEED_CLIENT_AUTH: + case HS_DESC_DECODE_BAD_CLIENT_AUTH: log_info(LD_REND, "Stored hidden service descriptor successfully."); TO_CONN(conn)->purpose = DIR_PURPOSE_HAS_FETCHED_HSDESC; - hs_client_desc_has_arrived(conn->hs_ident); + if (decode_status == HS_DESC_DECODE_OK) { + hs_client_desc_has_arrived(conn->hs_ident); + } else { + /* This handles both client auth decode status. */ + hs_client_desc_missing_bad_client_auth(conn->hs_ident, decode_status); + log_info(LD_REND, "Stored hidden service descriptor requires " + "%s client authorization.", + decode_status == HS_DESC_DECODE_NEED_CLIENT_AUTH ? "missing" + : "new"); + } /* Fire control port RECEIVED event. */ hs_control_desc_event_received(conn->hs_ident, conn->identity_digest); hs_control_desc_event_content(conn->hs_ident, conn->identity_digest, body); + break; + case HS_DESC_DECODE_ENCRYPTED_ERROR: + case HS_DESC_DECODE_SUPERENC_ERROR: + case HS_DESC_DECODE_PLAINTEXT_ERROR: + case HS_DESC_DECODE_GENERIC_ERROR: + default: + log_info(LD_REND, "Failed to store hidden service descriptor. " + "Descriptor decoding status: %d", decode_status); + /* Fire control port FAILED event. */ + hs_control_desc_event_failed(conn->hs_ident, conn->identity_digest, + "BAD_DESC"); + hs_control_desc_event_content(conn->hs_ident, conn->identity_digest, + NULL); + break; } break; case 404: |