Convert #ifdef to #if, other build changes
... | ... | @@ -24,6 +24,10 @@ CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/ |
LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM) | ||
endif | ||
ifneq ($(wildcard localoptions.h),) | ||
CFLAGS+=-DLOCALOPTIONS_H_EXISTS | ||
endif | ||
COMMONOBJS=dbutil.o buffer.o dbhelpers.o \ | ||
dss.o bignum.o \ | ||
signkey.o rsa.o dbrandom.o \ | ||
... | ... | @@ -76,6 +80,8 @@ [email protected]@ |
sbindir=@[email protected] | ||
mandir=@[email protected] | ||
.DELETE_ON_ERROR: | ||
CC=@[email protected] | ||
AR=@[email protected] | ||
RANLIB=@[email protected] | ||
... | ... | @@ -194,12 +200,14 @@ link%: |
-rm -f $*$(EXEEXT) | ||
-ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT) | ||
$(STATIC_LTC): options.h | ||
$(STATIC_LTC): options.h default_options.h | ||
cd libtomcrypt && $(MAKE) | ||
$(STATIC_LTM): options.h | ||
$(STATIC_LTM): options.h default_options.h | ||
cd libtommath && $(MAKE) | ||
%.o: default_options.h | ||
.PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean | ||
ltc-clean: | ||
... | ... | @@ -215,7 +223,7 @@ clean: ltc-clean ltm-clean thisclean |
thisclean: | ||
-rm -f dropbear dbclient dropbearkey dropbearconvert scp scp-progress \ | ||
dropbearmulti *.o *.da *.bb *.bbg *.prof | ||
dropbearmulti *.o *.da *.bb *.bbg *.prof default_options.h | ||
distclean: clean tidy | ||
-rm -f config.h | ||
... | ... | @@ -223,3 +231,8 @@ distclean: clean tidy |
tidy: | ||
-rm -f *~ *.gcov */*~ | ||
default_options.h: default_options.h.in | ||
echo "# > > > Generated from $^, edit that file instead !" > [email protected] | ||
echo >> [email protected] | ||
$(srcdir)/ifndef_wrapper.sh < $^ > [email protected] |
... | ... | @@ -29,9 +29,9 @@ |
#include "ssh.h" | ||
#include "runopts.h" | ||
#ifdef ENABLE_CLI_PASSWORD_AUTH | ||
#if DROPBEAR_CLI_PASSWORD_AUTH | ||
#ifdef ENABLE_CLI_ASKPASS_HELPER | ||
#if DROPBEAR_CLI_ASKPASS_HELPER | ||
/* Returns 1 if we want to use the askpass program, 0 otherwise */ | ||
static int want_askpass() | ||
{ | ||
... | ... | @@ -113,7 +113,7 @@ static char *gui_getpass(const char *prompt) { |
TRACE(("leave gui_getpass")) | ||
return(buf); | ||
} | ||
#endif /* ENABLE_CLI_ASKPASS_HELPER */ | ||
#endif /* DROPBEAR_CLI_ASKPASS_HELPER */ | ||
void cli_auth_password() { | ||
... | ... | @@ -125,7 +125,7 @@ void cli_auth_password() { |
snprintf(prompt, sizeof(prompt), "%[email protected]%s's password: ", | ||
cli_opts.username, cli_opts.remotehost); | ||
#ifdef ENABLE_CLI_ASKPASS_HELPER | ||
#if DROPBEAR_CLI_ASKPASS_HELPER | ||
if (want_askpass()) | ||
{ | ||
password = gui_getpass(prompt); | ||
... | ... | @@ -158,4 +158,4 @@ void cli_auth_password() { |
TRACE(("leave cli_auth_password")) | ||
} | ||
#endif /* ENABLE_CLI_PASSWORD_AUTH */ | ||
#endif /* DROPBEAR_CLI_PASSWORD_AUTH */ |
... | ... | @@ -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] [[email protected]]host[/port][,[[email protected]]host/port],...] [command]\n" | ||
#else | ||
"Usage: %s [options] [[email protected]]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 */ | ||