summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2004-12-22 15:37:50 +0000
committerMatt Johnston <matt@ucc.asn.au>2004-12-22 15:37:50 +0000
commit706d0cbf66d0ac1096d2763379e70d106403bfb7 (patch)
tree445e655df5d10a7b9f405bbaf0355efb8a48cc47
parentf2fecc0294c11ce99a0e9c5c41773b1e744e9e4c (diff)
downloaddropbear-706d0cbf66d0ac1096d2763379e70d106403bfb7.tar.gz
Rearrange preprocessor parts so that compilation with various options
disabled works OK.
-rw-r--r--channel.h2
-rw-r--r--cli-tcpfwd.c13
-rw-r--r--common-channel.c5
-rw-r--r--session.h3
-rw-r--r--svr-main.c4
-rw-r--r--svr-session.c6
-rw-r--r--svr-tcpfwd.c2
7 files changed, 26 insertions, 9 deletions
diff --git a/channel.h b/channel.h
index be6dd60..225fafb 100644
--- a/channel.h
+++ b/channel.h
@@ -122,7 +122,7 @@ void common_recv_msg_channel_data(struct Channel *channel, int fd,
const struct ChanType clichansess;
#endif
-#ifdef USING_LISTENERS
+#if defined(USING_LISTENERS) || defined(DROPBEAR_CLIENT)
int send_msg_channel_open_init(int fd, const struct ChanType *type);
void recv_msg_channel_open_confirmation();
void recv_msg_channel_open_failure();
diff --git a/cli-tcpfwd.c b/cli-tcpfwd.c
index 4dbef01..b4d99e9 100644
--- a/cli-tcpfwd.c
+++ b/cli-tcpfwd.c
@@ -31,8 +31,7 @@
#include "session.h"
#include "ssh.h"
-static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
- unsigned int remoteport);
+#ifdef ENABLE_CLI_REMOTETCPFWD
static int newtcpforwarded(struct Channel * channel);
const struct ChanType cli_chan_tcpremote = {
@@ -43,6 +42,11 @@ const struct ChanType cli_chan_tcpremote = {
NULL,
NULL
};
+#endif
+
+#ifdef ENABLE_CLI_LOCALTCPFWD
+static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
+ unsigned int remoteport);
static const struct ChanType cli_chan_tcplocal = {
1, /* sepfds */
"direct-tcpip",
@@ -51,7 +55,9 @@ static const struct ChanType cli_chan_tcplocal = {
NULL,
NULL
};
+#endif
+#ifdef ENABLE_CLI_LOCALTCPFWD
void setup_localtcp() {
int ret;
@@ -102,7 +108,9 @@ static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
TRACE(("leave cli_localtcp: %d", ret));
return ret;
}
+#endif /* ENABLE_CLI_LOCALTCPFWD */
+#ifdef ENABLE_CLI_REMOTETCPFWD
static void send_msg_global_request_remotetcp(int port) {
TRACE(("enter send_msg_global_request_remotetcp"));
@@ -191,3 +199,4 @@ out:
TRACE(("leave newtcpdirect: err %d", err));
return err;
}
+#endif /* ENABLE_CLI_REMOTETCPFWD */
diff --git a/common-channel.c b/common-channel.c
index d30528c..1d703a2 100644
--- a/common-channel.c
+++ b/common-channel.c
@@ -921,7 +921,7 @@ static void send_msg_channel_open_confirmation(struct Channel* channel,
TRACE(("leave send_msg_channel_open_confirmation"));
}
-#ifdef USING_LISTENERS
+#if defined(USING_LISTENERS) || defined(DROPBEAR_CLIENT)
/* Create a new channel, and start the open request. This is intended
* for X11, agent, tcp forwarding, and should be filled with channel-specific
* options, with the calling function calling encrypt_packet() after
@@ -1006,6 +1006,7 @@ void recv_msg_channel_open_failure() {
removechannel(channel);
}
+#endif /* USING_LISTENERS */
/* close a stdout/stderr fd */
static void closeoutfd(struct Channel * channel, int fd) {
@@ -1057,5 +1058,3 @@ static void closechanfd(struct Channel *channel, int fd, int how) {
channel->errfd = FD_CLOSED;
}
}
-
-#endif /* USING_LISTENERS */
diff --git a/session.h b/session.h
index 9142882..629dc65 100644
--- a/session.h
+++ b/session.h
@@ -158,12 +158,11 @@ struct sshsession {
/* TCP forwarding - where manage listeners */
-#ifdef USING_LISTENERS
struct Listener ** listeners;
unsigned int listensize;
+
/* Whether to allow binding to privileged ports (<1024). This doesn't
* really belong here, but nowhere else fits nicely */
-#endif
int allowprivport;
};
diff --git a/svr-main.c b/svr-main.c
index ae05c0d..60ed212 100644
--- a/svr-main.c
+++ b/svr-main.c
@@ -33,8 +33,12 @@ static int listensockets(int *sock, int sockcount, int *maxfd);
static void sigchld_handler(int dummy);
static void sigsegv_handler(int);
static void sigintterm_handler(int fish);
+#ifdef INETD_MODE
static void main_inetd();
+#endif
+#ifdef NON_INETD_MODE
static void main_noinetd();
+#endif
static void commonsetup();
static int childpipes[MAX_UNAUTH_CLIENTS];
diff --git a/svr-session.c b/svr-session.c
index f37e81b..8dc8a44 100644
--- a/svr-session.c
+++ b/svr-session.c
@@ -52,19 +52,25 @@ static const packettype svr_packettypes[] = {
{SSH_MSG_KEXINIT, recv_msg_kexinit},
{SSH_MSG_KEXDH_INIT, recv_msg_kexdh_init}, /* server */
{SSH_MSG_NEWKEYS, recv_msg_newkeys},
+#ifdef ENABLE_SVR_REMOTETCPFWD
{SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_remotetcp},
+#endif
{SSH_MSG_CHANNEL_REQUEST, recv_msg_channel_request},
{SSH_MSG_CHANNEL_OPEN, recv_msg_channel_open},
{SSH_MSG_CHANNEL_EOF, recv_msg_channel_eof},
{SSH_MSG_CHANNEL_CLOSE, recv_msg_channel_close},
+#ifdef USING_LISTENERS
{SSH_MSG_CHANNEL_OPEN_CONFIRMATION, recv_msg_channel_open_confirmation},
{SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure},
+#endif
{0, 0} /* End */
};
static const struct ChanType *svr_chantypes[] = {
&svrchansess,
+#ifdef ENABLE_SVR_LOCALTCPFWD
&svr_chan_tcpdirect,
+#endif
NULL /* Null termination is mandatory. */
};
diff --git a/svr-tcpfwd.c b/svr-tcpfwd.c
index 7e2ee8b..68ceba5 100644
--- a/svr-tcpfwd.c
+++ b/svr-tcpfwd.c
@@ -33,7 +33,7 @@
#include "listener.h"
#include "runopts.h"
-#ifndef DISABLE_SVR_REMOTETCPFWD
+#ifdef ENABLE_SVR_REMOTETCPFWD
static void send_msg_request_success();
static void send_msg_request_failure();