changeset 156:8c2b3506f112

Rearrange preprocessor parts so that compilation with various options disabled works OK.
author Matt Johnston <matt@ucc.asn.au>
date Wed, 22 Dec 2004 15:37:50 +0000
parents 6ba95762ec4e
children 364a75cfebab
files channel.h cli-tcpfwd.c common-channel.c session.h svr-main.c svr-session.c svr-tcpfwd.c
diffstat 7 files changed, 26 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/channel.h	Mon Dec 20 14:46:12 2004 +0000
+++ b/channel.h	Wed Dec 22 15:37:50 2004 +0000
@@ -122,7 +122,7 @@
 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();
--- a/cli-tcpfwd.c	Mon Dec 20 14:46:12 2004 +0000
+++ b/cli-tcpfwd.c	Wed Dec 22 15:37:50 2004 +0000
@@ -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 @@
 	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 @@
 	NULL,
 	NULL
 };
+#endif
 
+#ifdef ENABLE_CLI_LOCALTCPFWD
 void setup_localtcp() {
 
 	int ret;
@@ -102,7 +108,9 @@
 	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 @@
 	TRACE(("leave newtcpdirect: err %d", err));
 	return err;
 }
+#endif /* ENABLE_CLI_REMOTETCPFWD */
--- a/common-channel.c	Mon Dec 20 14:46:12 2004 +0000
+++ b/common-channel.c	Wed Dec 22 15:37:50 2004 +0000
@@ -921,7 +921,7 @@
 	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 @@
 
 	removechannel(channel);
 }
+#endif /* USING_LISTENERS */
 
 /* close a stdout/stderr fd */
 static void closeoutfd(struct Channel * channel, int fd) {
@@ -1057,5 +1058,3 @@
 		channel->errfd = FD_CLOSED;
 	}
 }
-
-#endif /* USING_LISTENERS */
--- a/session.h	Mon Dec 20 14:46:12 2004 +0000
+++ b/session.h	Wed Dec 22 15:37:50 2004 +0000
@@ -158,12 +158,11 @@
 
 	
 	/* 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;
 
 };
--- a/svr-main.c	Mon Dec 20 14:46:12 2004 +0000
+++ b/svr-main.c	Wed Dec 22 15:37:50 2004 +0000
@@ -33,8 +33,12 @@
 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];
--- a/svr-session.c	Mon Dec 20 14:46:12 2004 +0000
+++ b/svr-session.c	Wed Dec 22 15:37:50 2004 +0000
@@ -52,19 +52,25 @@
 	{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. */
 };
 
--- a/svr-tcpfwd.c	Mon Dec 20 14:46:12 2004 +0000
+++ b/svr-tcpfwd.c	Wed Dec 22 15:37:50 2004 +0000
@@ -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();