commit 74d710e7dc93c5449e4c88ffa0048afdb3c31e8f
Author: Sebastian Hahn <sebastian(a)torproject.org>
Date: Tue Sep 6 00:11:45 2016 +0200
Give useful error if authority_signing_key doesn't exist
---
changes/bug20065 | 5 +++++
src/or/router.c | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/changes/bug20065 b/changes/bug20065
new file mode 100644
index 0000000..cdeb698
--- /dev/null
+++ b/changes/bug20065
@@ -0,0 +1,5 @@
+ o Minor bugfixes (directory authorities):
+ - Die with a useful error when the operator forgets to place the
+ authority_signing_key file into the keys directory. This avoids an
+ uninformative assert & traceback about having an invalid key.
+ Fixes bug 20065; bugfix on 0.2.0.1-alpha.
diff --git a/src/or/router.c b/src/or/router.c
index b664a88..8fa5799 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -452,7 +452,8 @@ init_key_from_file(const char *fname, int generate, int severity,
goto error;
}
} else {
- log_info(LD_GENERAL, "No key found in \"%s\"", fname);
+ tor_log(severity, LD_GENERAL, "No key found in \"%s\"", fname);
+ goto error;
}
return prkey;
case FN_FILE:
@@ -560,7 +561,7 @@ load_authority_keyset(int legacy, crypto_pk_t **key_out,
fname = get_datadir_fname2("keys",
legacy ? "legacy_signing_key" : "authority_signing_key");
- signing_key = init_key_from_file(fname, 0, LOG_INFO, 0);
+ signing_key = init_key_from_file(fname, 0, LOG_ERR, 0);
if (!signing_key) {
log_warn(LD_DIR, "No version 3 directory key found in %s", fname);
goto done;