Skip to content

Commit

Permalink
cli-runopts.c: sort options and their parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
stokito committed Dec 24, 2023
1 parent b342ab3 commit 99ea64b
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/cli-runopts.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,29 +888,28 @@ static void add_extendedopt(const char* origstr) {

if (strcmp(origstr, "help") == 0) {
dropbear_log(LOG_INFO, "Available options:\n"
"\tBindAddress\n"
"\tDisableTrivialAuth\n"
#if DROPBEAR_CLI_ANYTCPFWD
"\tExitOnForwardFailure\n"
#endif
"\tDisableTrivialAuth\n"
"\tPort\n"
"\tStrictHostKeyChecking\n"
#ifndef DISABLE_SYSLOG
"\tUseSyslog\n"
#endif
"\tPort\n"
"\tStrictHostKeyChecking\n"
);
exit(EXIT_SUCCESS);
}

#if DROPBEAR_CLI_ANYTCPFWD
if (match_extendedopt(&optstr, "ExitOnForwardFailure") == DROPBEAR_SUCCESS) {
cli_opts.exit_on_fwd_failure = parse_flag_value(optstr);
if (match_extendedopt(&optstr, "DisableTrivialAuth") == DROPBEAR_SUCCESS) {
cli_opts.disable_trivial_auth = parse_flag_value(optstr);
return;
}
#endif

#ifndef DISABLE_SYSLOG
if (match_extendedopt(&optstr, "UseSyslog") == DROPBEAR_SUCCESS) {
opts.usingsyslog = parse_flag_value(optstr);
#if DROPBEAR_CLI_ANYTCPFWD
if (match_extendedopt(&optstr, "ExitOnForwardFailure") == DROPBEAR_SUCCESS) {
cli_opts.exit_on_fwd_failure = parse_flag_value(optstr);
return;
}
#endif
Expand All @@ -920,11 +919,6 @@ static void add_extendedopt(const char* origstr) {
return;
}

if (match_extendedopt(&optstr, "DisableTrivialAuth") == DROPBEAR_SUCCESS) {
cli_opts.disable_trivial_auth = parse_flag_value(optstr);
return;
}

if (match_extendedopt(&optstr, "StrictHostKeyChecking") == DROPBEAR_SUCCESS) {
if (strcmp(optstr, "accept-new") == 0) {
cli_opts.always_accept_key = 1;
Expand All @@ -935,5 +929,12 @@ static void add_extendedopt(const char* origstr) {
return;
}

#ifndef DISABLE_SYSLOG
if (match_extendedopt(&optstr, "UseSyslog") == DROPBEAR_SUCCESS) {
opts.usingsyslog = parse_flag_value(optstr);
return;
}
#endif

dropbear_log(LOG_WARNING, "Ignoring unknown configuration option '%s'", origstr);
}

0 comments on commit 99ea64b

Please sign in to comment.