mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 13:21:15 +00:00
Make "dbclient -m help -c help" work
This commit is contained in:
parent
6a3bc73a78
commit
0aefec6c89
@ -378,6 +378,11 @@ void cli_getopts(int argc, char ** argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DROPBEAR_USER_ALGO_LIST
|
||||||
|
/* -c help doesn't need a hostname */
|
||||||
|
parse_ciphers_macs();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Done with options/flags; now handle the hostname (which may not
|
/* Done with options/flags; now handle the hostname (which may not
|
||||||
* start with a hyphen) and optional command */
|
* start with a hyphen) and optional command */
|
||||||
|
|
||||||
@ -408,10 +413,6 @@ void cli_getopts(int argc, char ** argv) {
|
|||||||
|
|
||||||
/* And now a few sanity checks and setup */
|
/* And now a few sanity checks and setup */
|
||||||
|
|
||||||
#if DROPBEAR_USER_ALGO_LIST
|
|
||||||
parse_ciphers_macs();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DROPBEAR_CLI_PROXYCMD
|
#if DROPBEAR_CLI_PROXYCMD
|
||||||
if (cli_opts.proxycmd) {
|
if (cli_opts.proxycmd) {
|
||||||
/* To match the common path of m_freeing it */
|
/* To match the common path of m_freeing it */
|
||||||
|
@ -64,39 +64,36 @@ out:
|
|||||||
|
|
||||||
#if DROPBEAR_USER_ALGO_LIST
|
#if DROPBEAR_USER_ALGO_LIST
|
||||||
void
|
void
|
||||||
parse_ciphers_macs()
|
parse_ciphers_macs() {
|
||||||
{
|
int printed_help = 0;
|
||||||
if (opts.cipher_list)
|
if (opts.cipher_list) {
|
||||||
{
|
if (strcmp(opts.cipher_list, "help") == 0) {
|
||||||
if (strcmp(opts.cipher_list, "help") == 0)
|
|
||||||
{
|
|
||||||
char *ciphers = algolist_string(sshciphers);
|
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);
|
m_free(ciphers);
|
||||||
dropbear_exit(".");
|
printed_help = 1;
|
||||||
}
|
} else {
|
||||||
|
if (check_user_algos(opts.cipher_list, sshciphers, "cipher") == 0) {
|
||||||
if (check_user_algos(opts.cipher_list, sshciphers, "cipher") == 0)
|
dropbear_exit("No valid ciphers specified for '-c'");
|
||||||
{
|
}
|
||||||
dropbear_exit("No valid ciphers specified for '-c'");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.mac_list)
|
if (opts.mac_list) {
|
||||||
{
|
if (strcmp(opts.mac_list, "help") == 0) {
|
||||||
if (strcmp(opts.mac_list, "help") == 0)
|
|
||||||
{
|
|
||||||
char *macs = algolist_string(sshhashes);
|
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);
|
m_free(macs);
|
||||||
dropbear_exit(".");
|
printed_help = 1;
|
||||||
}
|
} else {
|
||||||
|
if (check_user_algos(opts.mac_list, sshhashes, "MAC") == 0) {
|
||||||
if (check_user_algos(opts.mac_list, sshhashes, "MAC") == 0)
|
dropbear_exit("No valid MACs specified for '-m'");
|
||||||
{
|
}
|
||||||
dropbear_exit("No valid MACs specified for '-m'");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (printed_help) {
|
||||||
|
dropbear_exit(".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user