summaryrefslogtreecommitdiffhomepage
path: root/svr-tcpfwd.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2012-05-09 20:33:16 +0800
committerMatt Johnston <matt@ucc.asn.au>2012-05-09 20:33:16 +0800
commit2a02c4084afb7413c02c728d766fc0af8f4c7083 (patch)
treead3c8f204f846f4a5b4b4a06c4133f20b0a78df8 /svr-tcpfwd.c
parente242b2820c6d49aea9623c02bd574d2c7baef1de (diff)
- Don't sent SSH_MSG_UNIMPLEMENTED if we don't have ENABLE_SVR_REMOTETCPFWD
- Fix build if ENABLE_SVR_REMOTETCPFWD is disabled but ENABLE_SVR_LOCALTCPFWD is enabled
Diffstat (limited to 'svr-tcpfwd.c')
-rw-r--r--svr-tcpfwd.c54
1 files changed, 33 insertions, 21 deletions
diff --git a/svr-tcpfwd.c b/svr-tcpfwd.c
index 591a2fc..e1f3a31 100644
--- a/svr-tcpfwd.c
+++ b/svr-tcpfwd.c
@@ -34,24 +34,31 @@
#include "runopts.h"
#include "auth.h"
-#ifdef ENABLE_SVR_REMOTETCPFWD
+static void send_msg_request_failure();
+
+static void send_msg_request_failure() {
+ CHECKCLEARTOWRITE();
+ buf_putbyte(ses.writepayload, SSH_MSG_REQUEST_FAILURE);
+ encrypt_packet();
+}
+
+#ifndef ENABLE_SVR_REMOTETCPFWD
+
+/* This is better than SSH_MSG_UNIMPLEMENTED */
+void recv_msg_global_request_remotetcp() {
+ TRACE(("recv_msg_global_request_remotetcp: remote tcp forwarding not compiled in"))
+ send_msg_request_failure();
+}
+
+/* */
+#endif /* !ENABLE_SVR_REMOTETCPFWD */
static void send_msg_request_success();
-static void send_msg_request_failure();
static int svr_cancelremotetcp();
static int svr_remotetcpreq();
static int newtcpdirect(struct Channel * channel);
-
-const struct ChanType svr_chan_tcpdirect = {
- 1, /* sepfds */
- "direct-tcpip",
- newtcpdirect, /* init */
- NULL, /* checkclose */
- NULL, /* reqhandler */
- NULL /* closehandler */
-};
-
+#ifdef ENABLE_SVR_REMOTETCPFWD
static const struct ChanType svr_chan_tcpremote = {
1, /* sepfds */
"forwarded-tcpip",
@@ -117,14 +124,6 @@ static void send_msg_request_success() {
}
-static void send_msg_request_failure() {
-
- CHECKCLEARTOWRITE();
- buf_putbyte(ses.writepayload, SSH_MSG_REQUEST_FAILURE);
- encrypt_packet();
-
-}
-
static int matchtcp(void* typedata1, void* typedata2) {
const struct TCPListener *info1 = (struct TCPListener*)typedata1;
@@ -230,6 +229,19 @@ out:
return ret;
}
+#endif /* ENABLE_SVR_REMOTETCPFWD */
+
+#ifdef ENABLE_SVR_LOCALTCPFWD
+
+const struct ChanType svr_chan_tcpdirect = {
+ 1, /* sepfds */
+ "direct-tcpip",
+ newtcpdirect, /* init */
+ NULL, /* checkclose */
+ NULL, /* reqhandler */
+ NULL /* closehandler */
+};
+
/* Called upon creating a new direct tcp channel (ie we connect out to an
* address */
static int newtcpdirect(struct Channel * channel) {
@@ -294,4 +306,4 @@ out:
return err;
}
-#endif
+#endif /* ENABLE_SVR_LOCALTCPFWD */