# HG changeset patch # User Matt Johnston # Date 1386075543 -28800 # Node ID 17b15683648db815e4e74146b0f955470e57c6a0 # Parent a287954a16d632cb7dc44dbdac682972786442d9 Exit if we don't have keys and -R wasn't specified diff -r a287954a16d6 -r 17b15683648d svr-runopts.c --- a/svr-runopts.c Tue Dec 03 00:06:35 2013 +0800 +++ b/svr-runopts.c Tue Dec 03 20:59:03 2013 +0800 @@ -452,6 +452,7 @@ 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 @@ 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 @@ && !svr_opts.hostkey->ecckey256) { disablekey(DROPBEAR_SIGNKEY_ECDSA_NISTP256); } + else + { + any_keys = 1; + } #endif #ifdef DROPBEAR_ECC_384 @@ -506,6 +519,10 @@ && !svr_opts.hostkey->ecckey384) { disablekey(DROPBEAR_SIGNKEY_ECDSA_NISTP384); } + else + { + any_keys = 1; + } #endif #ifdef DROPBEAR_ECC_521 @@ -513,7 +530,16 @@ && !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"); + } + }