Mercurial > dropbear
comparison common-runopts.c @ 1687:f8d8af12ac14
Make "dbclient -m help -c help" work
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 26 May 2020 20:15:39 +0800 |
parents | b9a466b43de0 |
children | 94dc11094e26 |
comparison
equal
deleted
inserted
replaced
1686:83d48276885b | 1687:f8d8af12ac14 |
---|---|
62 return ret; | 62 return ret; |
63 } | 63 } |
64 | 64 |
65 #if DROPBEAR_USER_ALGO_LIST | 65 #if DROPBEAR_USER_ALGO_LIST |
66 void | 66 void |
67 parse_ciphers_macs() | 67 parse_ciphers_macs() { |
68 { | 68 int printed_help = 0; |
69 if (opts.cipher_list) | 69 if (opts.cipher_list) { |
70 { | 70 if (strcmp(opts.cipher_list, "help") == 0) { |
71 if (strcmp(opts.cipher_list, "help") == 0) | |
72 { | |
73 char *ciphers = algolist_string(sshciphers); | 71 char *ciphers = algolist_string(sshciphers); |
74 dropbear_log(LOG_INFO, "Available ciphers:\n%s\n", ciphers); | 72 dropbear_log(LOG_INFO, "Available ciphers: %s", ciphers); |
75 m_free(ciphers); | 73 m_free(ciphers); |
76 dropbear_exit("."); | 74 printed_help = 1; |
77 } | 75 } else { |
78 | 76 if (check_user_algos(opts.cipher_list, sshciphers, "cipher") == 0) { |
79 if (check_user_algos(opts.cipher_list, sshciphers, "cipher") == 0) | 77 dropbear_exit("No valid ciphers specified for '-c'"); |
80 { | 78 } |
81 dropbear_exit("No valid ciphers specified for '-c'"); | |
82 } | 79 } |
83 } | 80 } |
84 | 81 |
85 if (opts.mac_list) | 82 if (opts.mac_list) { |
86 { | 83 if (strcmp(opts.mac_list, "help") == 0) { |
87 if (strcmp(opts.mac_list, "help") == 0) | |
88 { | |
89 char *macs = algolist_string(sshhashes); | 84 char *macs = algolist_string(sshhashes); |
90 dropbear_log(LOG_INFO, "Available MACs:\n%s\n", macs); | 85 dropbear_log(LOG_INFO, "Available MACs: %s", macs); |
91 m_free(macs); | 86 m_free(macs); |
92 dropbear_exit("."); | 87 printed_help = 1; |
88 } else { | |
89 if (check_user_algos(opts.mac_list, sshhashes, "MAC") == 0) { | |
90 dropbear_exit("No valid MACs specified for '-m'"); | |
91 } | |
93 } | 92 } |
94 | 93 } |
95 if (check_user_algos(opts.mac_list, sshhashes, "MAC") == 0) | 94 if (printed_help) { |
96 { | 95 dropbear_exit("."); |
97 dropbear_exit("No valid MACs specified for '-m'"); | |
98 } | |
99 } | 96 } |
100 } | 97 } |
101 #endif | 98 #endif |
102 | 99 |
103 void print_version() { | 100 void print_version() { |