summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeel Chauhan <neel@neelc.org>2020-10-27 11:10:11 -0700
committerNeel Chauhan <neel@neelc.org>2020-10-27 14:47:42 -0700
commit0c79cddc6b9f8f62eef0ebf0d6aa05563061954f (patch)
treef4d8656a98246307e11811e3a8699a5bb7c7cf2c
parent362229f184c92712ee5a3027ce5d29024ca5b382 (diff)
downloadtor-0c79cddc6b9f8f62eef0ebf0d6aa05563061954f.tar.gz
tor-0c79cddc6b9f8f62eef0ebf0d6aa05563061954f.zip
Avoid asserts with flag
-rw-r--r--changes/bug400154
-rw-r--r--src/feature/relay/router.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/changes/bug40015 b/changes/bug40015
new file mode 100644
index 0000000000..1d190df751
--- /dev/null
+++ b/changes/bug40015
@@ -0,0 +1,4 @@
+ o Major bugfixes (crash, relay, signing key):
+ - Avoid asserts when we run Tor from the command line with
+ `--key-expiration sign` when an ORPort is not set. Fixes
+ bug 40015; bugfix on 0.3.2.1-alpha. Patch by Neel Chauhan.
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 5ca21964b6..29103ed6c6 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -386,7 +386,8 @@ MOCK_IMPL(crypto_pk_t *,
get_server_identity_key,(void))
{
tor_assert(server_identitykey);
- tor_assert(server_mode(get_options()));
+ tor_assert(server_mode(get_options()) ||
+ get_options()->command == CMD_KEY_EXPIRATION);
assert_identity_keys_ok();
return server_identitykey;
}
@@ -398,7 +399,9 @@ get_server_identity_key,(void))
int
server_identity_key_is_set(void)
{
- return server_mode(get_options()) && server_identitykey != NULL;
+ return (server_mode(get_options()) ||
+ get_options()->command == CMD_KEY_EXPIRATION) &&
+ server_identitykey != NULL;
}
/** Set the current client identity key to <b>k</b>.
@@ -941,7 +944,7 @@ init_keys(void)
/* OP's don't need persistent keys; just make up an identity and
* initialize the TLS context. */
- if (!server_mode(options)) {
+ if (!server_mode(options) && !(options->command == CMD_KEY_EXPIRATION)) {
return init_keys_client();
}
if (init_keys_common() < 0)