diff options
author | Matt Johnston <matt@ucc.asn.au> | 2016-05-04 15:33:40 +0200 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2016-05-04 15:33:40 +0200 |
commit | 32a28d0d9cf7c567671366d6ec71df87627e2c49 (patch) | |
tree | eed0f72ed707d62a28b4cb1d8da05c5d1b3f23c3 /cli-runopts.c | |
parent | d6daad29fcfc20295473bf7e6a96f3016282e9e6 (diff) |
Convert #ifdef to #if, other build changes
Diffstat (limited to 'cli-runopts.c')
-rw-r--r-- | cli-runopts.c | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/cli-runopts.c b/cli-runopts.c index 24169c9..4a89ba3 100644 --- a/cli-runopts.c +++ b/cli-runopts.c @@ -37,13 +37,13 @@ static void printhelp(void); static void parse_hostname(const char* orighostarg); static void parse_multihop_hostname(const char* orighostarg, const char* argv0); static void fill_own_user(void); -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH static void loadidentityfile(const char* filename, int warnfail); #endif -#ifdef ENABLE_CLI_ANYTCPFWD +#if DROPBEAR_CLI_ANYTCPFWD static void addforward(const char* str, m_list *fwdlist); #endif -#ifdef ENABLE_CLI_NETCAT +#if DROPBEAR_CLI_NETCAT static void add_netcat(const char *str); #endif static void add_extendedopt(const char *str); @@ -51,7 +51,7 @@ static void add_extendedopt(const char *str); static void printhelp() { fprintf(stderr, "Dropbear SSH client v%s https://matt.ucc.asn.au/dropbear/dropbear.html\n" -#ifdef ENABLE_CLI_MULTIHOP +#if DROPBEAR_CLI_MULTIHOP "Usage: %s [options] [user@]host[/port][,[user@]host/port],...] [command]\n" #else "Usage: %s [options] [user@]host[/port] [command]\n" @@ -66,38 +66,38 @@ static void printhelp() { "-y -y Don't perform any remote host key checking (caution)\n" "-s Request a subsystem (use by external sftp)\n" "-o option Set option in OpenSSH-like format ('-o help' to list options)\n" -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH "-i <identityfile> (multiple allowed, default %s)\n" #endif -#ifdef ENABLE_CLI_AGENTFWD +#if DROPBEAR_CLI_AGENTFWD "-A Enable agent auth forwarding\n" #endif -#ifdef ENABLE_CLI_LOCALTCPFWD +#if DROPBEAR_CLI_LOCALTCPFWD "-L <[listenaddress:]listenport:remotehost:remoteport> Local port forwarding\n" "-g Allow remote hosts to connect to forwarded ports\n" #endif -#ifdef ENABLE_CLI_REMOTETCPFWD +#if DROPBEAR_CLI_REMOTETCPFWD "-R <[listenaddress:]listenport:remotehost:remoteport> Remote port forwarding\n" #endif "-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n" "-K <keepalive> (0 is never, default %d)\n" "-I <idle_timeout> (0 is never, default %d)\n" -#ifdef ENABLE_CLI_NETCAT +#if DROPBEAR_CLI_NETCAT "-B <endhost:endport> Netcat-alike forwarding\n" #endif -#ifdef ENABLE_CLI_PROXYCMD +#if DROPBEAR_CLI_PROXYCMD "-J <proxy_program> Use program pipe rather than TCP connection\n" #endif -#ifdef ENABLE_USER_ALGO_LIST +#if DROPBEAR_USER_ALGO_LIST "-c <cipher list> Specify preferred ciphers ('-c help' to list options)\n" "-m <MAC list> Specify preferred MACs for packet verification (or '-m help')\n" #endif "-V Version\n" -#ifdef DEBUG_TRACE +#if DEBUG_TRACE "-v verbose (compiled with DEBUG_TRACE)\n" #endif ,DROPBEAR_VERSION, cli_opts.progname, -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH DROPBEAR_DEFAULT_CLI_AUTHKEY, #endif DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT); @@ -109,16 +109,16 @@ void cli_getopts(int argc, char ** argv) { char ** next = 0; enum { OPT_EXTENDED_OPTIONS, -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH OPT_AUTHKEY, #endif -#ifdef ENABLE_CLI_LOCALTCPFWD +#if DROPBEAR_CLI_LOCALTCPFWD OPT_LOCALTCPFWD, #endif -#ifdef ENABLE_CLI_REMOTETCPFWD +#if DROPBEAR_CLI_REMOTETCPFWD OPT_REMOTETCPFWD, #endif -#ifdef ENABLE_CLI_NETCAT +#if DROPBEAR_CLI_NETCAT OPT_NETCAT, #endif /* a flag (no arg) if 'next' is NULL, a string-valued option otherwise */ @@ -145,31 +145,31 @@ void cli_getopts(int argc, char ** argv) { cli_opts.always_accept_key = 0; cli_opts.no_hostkey_check = 0; cli_opts.is_subsystem = 0; -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH cli_opts.privkeys = list_new(); #endif -#ifdef ENABLE_CLI_ANYTCPFWD +#if DROPBEAR_CLI_ANYTCPFWD cli_opts.exit_on_fwd_failure = 0; #endif -#ifdef ENABLE_CLI_LOCALTCPFWD +#if DROPBEAR_CLI_LOCALTCPFWD cli_opts.localfwds = list_new(); opts.listen_fwd_all = 0; #endif -#ifdef ENABLE_CLI_REMOTETCPFWD +#if DROPBEAR_CLI_REMOTETCPFWD cli_opts.remotefwds = list_new(); #endif -#ifdef ENABLE_CLI_AGENTFWD +#if DROPBEAR_CLI_AGENTFWD cli_opts.agent_fwd = 0; cli_opts.agent_fd = -1; cli_opts.agent_keys_loaded = 0; #endif -#ifdef ENABLE_CLI_PROXYCMD +#if DROPBEAR_CLI_PROXYCMD cli_opts.proxycmd = NULL; #endif #ifndef DISABLE_ZLIB opts.compress_mode = DROPBEAR_COMPRESS_ON; #endif -#ifdef ENABLE_USER_ALGO_LIST +#if DROPBEAR_USER_ALGO_LIST opts.cipher_list = NULL; opts.mac_list = NULL; #endif @@ -213,7 +213,7 @@ void cli_getopts(int argc, char ** argv) { case 'p': /* remoteport */ next = &cli_opts.remoteport; break; -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH case 'i': /* an identityfile */ opt = OPT_AUTHKEY; break; @@ -236,7 +236,7 @@ void cli_getopts(int argc, char ** argv) { case 'o': opt = OPT_EXTENDED_OPTIONS; break; -#ifdef ENABLE_CLI_LOCALTCPFWD +#if DROPBEAR_CLI_LOCALTCPFWD case 'L': opt = OPT_LOCALTCPFWD; break; @@ -244,17 +244,17 @@ void cli_getopts(int argc, char ** argv) { opts.listen_fwd_all = 1; break; #endif -#ifdef ENABLE_CLI_REMOTETCPFWD +#if DROPBEAR_CLI_REMOTETCPFWD case 'R': opt = OPT_REMOTETCPFWD; break; #endif -#ifdef ENABLE_CLI_NETCAT +#if DROPBEAR_CLI_NETCAT case 'B': opt = OPT_NETCAT; break; #endif -#ifdef ENABLE_CLI_PROXYCMD +#if DROPBEAR_CLI_PROXYCMD case 'J': next = &cli_opts.proxycmd; break; @@ -278,12 +278,12 @@ void cli_getopts(int argc, char ** argv) { case 'I': next = &idle_timeout_arg; break; -#ifdef ENABLE_CLI_AGENTFWD +#if DROPBEAR_CLI_AGENTFWD case 'A': cli_opts.agent_fwd = 1; break; #endif -#ifdef ENABLE_USER_ALGO_LIST +#if DROPBEAR_USER_ALGO_LIST case 'c': next = &opts.cipher_list; break; @@ -291,22 +291,22 @@ void cli_getopts(int argc, char ** argv) { next = &opts.mac_list; break; #endif -#ifdef DEBUG_TRACE +#if DEBUG_TRACE case 'v': debug_trace = 1; break; #endif case 'F': case 'e': -#ifndef ENABLE_USER_ALGO_LIST +#if !DROPBEAR_USER_ALGO_LIST case 'c': case 'm': #endif case 'D': -#ifndef ENABLE_CLI_REMOTETCPFWD +#ifndef DROPBEAR_CLI_REMOTETCPFWD case 'R': #endif -#ifndef ENABLE_CLI_LOCALTCPFWD +#ifndef DROPBEAR_CLI_LOCALTCPFWD case 'L': #endif case 'V': @@ -338,28 +338,28 @@ void cli_getopts(int argc, char ** argv) { add_extendedopt(&argv[i][j]); } else -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH if (opt == OPT_AUTHKEY) { TRACE(("opt authkey")) loadidentityfile(&argv[i][j], 1); } else #endif -#ifdef ENABLE_CLI_REMOTETCPFWD +#if DROPBEAR_CLI_REMOTETCPFWD if (opt == OPT_REMOTETCPFWD) { TRACE(("opt remotetcpfwd")) addforward(&argv[i][j], cli_opts.remotefwds); } else #endif -#ifdef ENABLE_CLI_LOCALTCPFWD +#if DROPBEAR_CLI_LOCALTCPFWD if (opt == OPT_LOCALTCPFWD) { TRACE(("opt localtcpfwd")) addforward(&argv[i][j], cli_opts.localfwds); } else #endif -#ifdef ENABLE_CLI_NETCAT +#if DROPBEAR_CLI_NETCAT if (opt == OPT_NETCAT) { TRACE(("opt netcat")) add_netcat(&argv[i][j]); @@ -405,11 +405,11 @@ void cli_getopts(int argc, char ** argv) { /* And now a few sanity checks and setup */ -#ifdef ENABLE_USER_ALGO_LIST +#if DROPBEAR_USER_ALGO_LIST parse_ciphers_macs(); #endif -#ifdef ENABLE_CLI_PROXYCMD +#if DROPBEAR_CLI_PROXYCMD if (cli_opts.proxycmd) { /* To match the common path of m_freeing it */ cli_opts.proxycmd = m_strdup(cli_opts.proxycmd); @@ -457,13 +457,13 @@ void cli_getopts(int argc, char ** argv) { opts.idle_timeout_secs = val; } -#ifdef ENABLE_CLI_NETCAT +#if DROPBEAR_CLI_NETCAT if (cli_opts.cmd && cli_opts.netcat_host) { dropbear_log(LOG_INFO, "Ignoring command '%s' in netcat mode", cli_opts.cmd); } #endif -#if defined(DROPBEAR_DEFAULT_CLI_AUTHKEY) && defined(ENABLE_CLI_PUBKEY_AUTH) +#if (DROPBEAR_CLI_PUBKEY_AUTH) { char *expand_path = expand_homedir_path(DROPBEAR_DEFAULT_CLI_AUTHKEY); loadidentityfile(expand_path, 0); @@ -474,14 +474,14 @@ void cli_getopts(int argc, char ** argv) { /* The hostname gets set up last, since * in multi-hop mode it will require knowledge * of other flags such as -i */ -#ifdef ENABLE_CLI_MULTIHOP +#if DROPBEAR_CLI_MULTIHOP parse_multihop_hostname(host_arg, argv[0]); #else parse_hostname(host_arg); #endif } -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH static void loadidentityfile(const char* filename, int warnfail) { sign_key *key; enum signkey_type keytype; @@ -504,7 +504,7 @@ static void loadidentityfile(const char* filename, int warnfail) { } #endif -#ifdef ENABLE_CLI_MULTIHOP +#if DROPBEAR_CLI_MULTIHOP static char* multihop_passthrough_args() { @@ -514,13 +514,13 @@ multihop_passthrough_args() { m_list_elem *iter; /* Fill out -i, -y, -W options that make sense for all * the intermediate processes */ -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH for (iter = cli_opts.privkeys->first; iter; iter = iter->next) { sign_key * key = (sign_key*)iter->item; len += 3 + strlen(key->filename); } -#endif /* ENABLE_CLI_PUBKEY_AUTH */ +#endif /* DROPBEAR_CLI_PUBKEY_AUTH */ len += 30; /* space for -W <size>, terminator. */ ret = m_malloc(len); @@ -543,7 +543,7 @@ multihop_passthrough_args() { total += written; } -#ifdef ENABLE_CLI_PUBKEY_AUTH +#if DROPBEAR_CLI_PUBKEY_AUTH for (iter = cli_opts.privkeys->first; iter; iter = iter->next) { sign_key * key = (sign_key*)iter->item; @@ -552,7 +552,7 @@ multihop_passthrough_args() { dropbear_assert((unsigned int)written < size); total += written; } -#endif /* ENABLE_CLI_PUBKEY_AUTH */ +#endif /* DROPBEAR_CLI_PUBKEY_AUTH */ /* if args were passed, total will be not zero, and it will have a space at the end, so remove that */ if (total > 0) @@ -636,7 +636,7 @@ static void parse_multihop_hostname(const char* orighostarg, const char* argv0) } m_free(hostbuf); } -#endif /* !ENABLE_CLI_MULTIHOP */ +#endif /* !DROPBEAR_CLI_MULTIHOP */ /* Parses a [user@]hostname[/port] argument. */ static void parse_hostname(const char* orighostarg) { @@ -675,7 +675,7 @@ static void parse_hostname(const char* orighostarg) { } } -#ifdef ENABLE_CLI_NETCAT +#if DROPBEAR_CLI_NETCAT static void add_netcat(const char* origstr) { char *portstr = NULL; @@ -728,7 +728,7 @@ static void fill_own_user() { } -#ifdef ENABLE_CLI_ANYTCPFWD +#if DROPBEAR_CLI_ANYTCPFWD /* Turn a "[listenaddr:]listenport:remoteaddr:remoteport" string into into a forwarding * set, and add it to the forwarding list */ static void addforward(const char* origstr, m_list *fwdlist) { @@ -870,7 +870,7 @@ static void add_extendedopt(const char* origstr) { if (strcmp(origstr, "help") == 0) { dropbear_log(LOG_INFO, "Available options:\n" -#ifdef ENABLE_CLI_ANYTCPFWD +#if DROPBEAR_CLI_ANYTCPFWD "\tExitOnForwardFailure\n" #endif #ifndef DISABLE_SYSLOG @@ -880,7 +880,7 @@ static void add_extendedopt(const char* origstr) { exit(EXIT_SUCCESS); } -#ifdef ENABLE_CLI_ANYTCPFWD +#if DROPBEAR_CLI_ANYTCPFWD if (match_extendedopt(&optstr, "ExitOnForwardFailure") == DROPBEAR_SUCCESS) { cli_opts.exit_on_fwd_failure = parse_flag_value(optstr); return; |