summaryrefslogtreecommitdiff
path: root/src/test/test_hs_control.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-11-25 18:31:29 +0200
committerDavid Goulet <dgoulet@torproject.org>2019-12-03 09:22:17 -0500
commit12305b6bb6a68640e011dc5e2f2557bdccc2ae22 (patch)
tree4c0fa5366311f39e53faa24b0699225acf306dcd /src/test/test_hs_control.c
parent8ed8707f0ab78e9c954dad870f0529369c01c518 (diff)
downloadtor-12305b6bb6a68640e011dc5e2f2557bdccc2ae22.tar.gz
tor-12305b6bb6a68640e011dc5e2f2557bdccc2ae22.zip
hsv3: ONION_CLIENT_AUTH_REMOVE now also removes the credential file.
Diffstat (limited to 'src/test/test_hs_control.c')
-rw-r--r--src/test/test_hs_control.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/test/test_hs_control.c b/src/test/test_hs_control.c
index 572b7f3ab1..d064f203a6 100644
--- a/src/test/test_hs_control.c
+++ b/src/test/test_hs_control.c
@@ -585,7 +585,7 @@ test_hs_control_store_permanent_creds(void *arg)
/* This is the base32 represenation of the base64 UDRv... key above */
"x25519:ka2g6zf33qti2ecexpbx4stan3nsu3sijbiqm4t2rwctigxajnpq");
- /* Now for our final act!!! Actually get the HS client subsystem to parse the
+ /* Now for our next act!!! Actually get the HS client subsystem to parse the
* whole directory and make sure that it extracted the right credential! */
hs_config_client_authorization(get_options(), 0);
@@ -600,6 +600,27 @@ test_hs_control_store_permanent_creds(void *arg)
tt_str_op(hex_str((char*)client_2fv->enc_seckey.secret_key, 32), OP_EQ,
"50346F64BBDC268D1044BBC37E4A606EDB2A6E48485106727A8D85341AE04B5F");
+ /* And now for the final act! Use the REMOVE control port command to remove
+ the credential, and ensure that the file has also been removed! */
+ tor_free(conn.current_cmd);
+ tor_free(cp1);
+ tor_free(args);
+
+ /* Ensure that the creds file exists */
+ tt_int_op(file_status(creds_fname), OP_EQ, FN_FILE);
+
+ /* Do the REMOVE */
+ conn.current_cmd = tor_strdup("ONION_CLIENT_AUTH_REMOVE");
+ args =tor_strdup("2fvhjskjet3n5syd6yfg5lhvwcs62bojmthr35ko5bllr3iqdb4ctdyd");
+ retval = handle_control_command(&conn, (uint32_t) strlen(args), args);
+ tt_int_op(retval, OP_EQ, 0);
+ cp1 = buf_get_contents(TO_CONN(&conn)->outbuf, &sz);
+ tt_str_op(cp1, OP_EQ, "250 OK\r\n");
+
+ /* Ensure that the file has been removed and the map is empty */
+ tt_int_op(file_status(creds_fname), OP_EQ, FN_NOENT);
+ tt_uint_op(digest256map_size(client_auths), OP_EQ, 0);
+
done:
tor_free(args);
tor_free(cp1);