summaryrefslogtreecommitdiff
path: root/common-runopts.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2020-05-26 20:15:39 +0800
committerMatt Johnston <matt@ucc.asn.au>2020-05-26 20:15:39 +0800
commiteea05aefbb9e83461c6b4e33315e9422e812fc5d (patch)
tree0203c8b99b87ee744c11e45fdc5eb2b086a0acc7 /common-runopts.c
parent8a4211c0ef1ce397bc0f03a5e02c0a9a321efa03 (diff)
downloaddropbear-eea05aefbb9e83461c6b4e33315e9422e812fc5d.tar.gz
Make "dbclient -m help -c help" work
Diffstat (limited to 'common-runopts.c')
-rw-r--r--common-runopts.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/common-runopts.c b/common-runopts.c
index 2762e1a..4d9bbc6 100644
--- a/common-runopts.c
+++ b/common-runopts.c
@@ -64,39 +64,36 @@ out:
#if DROPBEAR_USER_ALGO_LIST
void
-parse_ciphers_macs()
-{
- if (opts.cipher_list)
- {
- if (strcmp(opts.cipher_list, "help") == 0)
- {
+parse_ciphers_macs() {
+ int printed_help = 0;
+ if (opts.cipher_list) {
+ if (strcmp(opts.cipher_list, "help") == 0) {
char *ciphers = algolist_string(sshciphers);
- dropbear_log(LOG_INFO, "Available ciphers:\n%s\n", ciphers);
+ dropbear_log(LOG_INFO, "Available ciphers: %s", ciphers);
m_free(ciphers);
- dropbear_exit(".");
- }
-
- if (check_user_algos(opts.cipher_list, sshciphers, "cipher") == 0)
- {
- dropbear_exit("No valid ciphers specified for '-c'");
+ printed_help = 1;
+ } else {
+ if (check_user_algos(opts.cipher_list, sshciphers, "cipher") == 0) {
+ dropbear_exit("No valid ciphers specified for '-c'");
+ }
}
}
- if (opts.mac_list)
- {
- if (strcmp(opts.mac_list, "help") == 0)
- {
+ if (opts.mac_list) {
+ if (strcmp(opts.mac_list, "help") == 0) {
char *macs = algolist_string(sshhashes);
- dropbear_log(LOG_INFO, "Available MACs:\n%s\n", macs);
+ dropbear_log(LOG_INFO, "Available MACs: %s", macs);
m_free(macs);
- dropbear_exit(".");
- }
-
- if (check_user_algos(opts.mac_list, sshhashes, "MAC") == 0)
- {
- dropbear_exit("No valid MACs specified for '-m'");
+ printed_help = 1;
+ } else {
+ if (check_user_algos(opts.mac_list, sshhashes, "MAC") == 0) {
+ dropbear_exit("No valid MACs specified for '-m'");
+ }
}
}
+ if (printed_help) {
+ dropbear_exit(".");
+ }
}
#endif