summaryrefslogtreecommitdiffhomepage
path: root/svr-runopts.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2013-12-03 20:59:03 +0800
committerMatt Johnston <matt@ucc.asn.au>2013-12-03 20:59:03 +0800
commit9ff337aa3b0db3f8244ecbefe4318e32634a37ee (patch)
tree2a52b2f1517775282927b67a0e6fcdc4c2ac0763 /svr-runopts.c
parent441facc6e0e781c6297d382645a0db6165f82baf (diff)
Exit if we don't have keys and -R wasn't specified
Diffstat (limited to 'svr-runopts.c')
-rw-r--r--svr-runopts.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/svr-runopts.c b/svr-runopts.c
index f78190f..9fbacf7 100644
--- a/svr-runopts.c
+++ b/svr-runopts.c
@@ -452,6 +452,7 @@ static void addhostkey(const char *keyfile) {
void load_all_hostkeys() {
int i;
int disable_unset_keys = 1;
+ int any_keys = 0;
svr_opts.hostkey = new_sign_key();
@@ -484,12 +485,20 @@ void load_all_hostkeys() {
if (disable_unset_keys && !svr_opts.hostkey->rsakey) {
disablekey(DROPBEAR_SIGNKEY_RSA);
}
+ else
+ {
+ any_keys = 1;
+ }
#endif
#ifdef DROPBEAR_DSS
if (disable_unset_keys && !svr_opts.hostkey->dsskey) {
disablekey(DROPBEAR_SIGNKEY_RSA);
}
+ else
+ {
+ any_keys = 1;
+ }
#endif
@@ -499,6 +508,10 @@ void load_all_hostkeys() {
&& !svr_opts.hostkey->ecckey256) {
disablekey(DROPBEAR_SIGNKEY_ECDSA_NISTP256);
}
+ else
+ {
+ any_keys = 1;
+ }
#endif
#ifdef DROPBEAR_ECC_384
@@ -506,6 +519,10 @@ void load_all_hostkeys() {
&& !svr_opts.hostkey->ecckey384) {
disablekey(DROPBEAR_SIGNKEY_ECDSA_NISTP384);
}
+ else
+ {
+ any_keys = 1;
+ }
#endif
#ifdef DROPBEAR_ECC_521
@@ -513,7 +530,16 @@ void load_all_hostkeys() {
&& !svr_opts.hostkey->ecckey521) {
disablekey(DROPBEAR_SIGNKEY_ECDSA_NISTP521);
}
+ else
+ {
+ any_keys = 1;
+ }
#endif
#endif /* DROPBEAR_ECDSA */
+ if (!any_keys)
+ {
+ dropbear_exit("No hostkeys available");
+ }
+
}