- 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
This commit is contained in:
Matt Johnston 2012-05-09 20:33:16 +08:00
parent e242b2820c
commit 2a02c4084a
3 changed files with 35 additions and 23 deletions

View File

@ -653,6 +653,8 @@ static void send_msg_channel_data(struct Channel *channel, int isextended) {
len, errno, fd)) len, errno, fd))
return; return;
} }
TRACE(("send_msg_channel_data: len %d fd %d", len, fd))
buf_incrwritepos(ses.writepayload, len); buf_incrwritepos(ses.writepayload, len);
/* ... real size here */ /* ... real size here */
buf_setpos(ses.writepayload, size_pos); buf_setpos(ses.writepayload, size_pos);

View File

@ -52,9 +52,7 @@ static const packettype svr_packettypes[] = {
{SSH_MSG_KEXINIT, recv_msg_kexinit}, {SSH_MSG_KEXINIT, recv_msg_kexinit},
{SSH_MSG_KEXDH_INIT, recv_msg_kexdh_init}, /* server */ {SSH_MSG_KEXDH_INIT, recv_msg_kexdh_init}, /* server */
{SSH_MSG_NEWKEYS, recv_msg_newkeys}, {SSH_MSG_NEWKEYS, recv_msg_newkeys},
#ifdef ENABLE_SVR_REMOTETCPFWD
{SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_remotetcp}, {SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_remotetcp},
#endif
{SSH_MSG_CHANNEL_REQUEST, recv_msg_channel_request}, {SSH_MSG_CHANNEL_REQUEST, recv_msg_channel_request},
{SSH_MSG_CHANNEL_OPEN, recv_msg_channel_open}, {SSH_MSG_CHANNEL_OPEN, recv_msg_channel_open},
{SSH_MSG_CHANNEL_EOF, recv_msg_channel_eof}, {SSH_MSG_CHANNEL_EOF, recv_msg_channel_eof},

View File

@ -34,24 +34,31 @@
#include "runopts.h" #include "runopts.h"
#include "auth.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_success();
static void send_msg_request_failure();
static int svr_cancelremotetcp(); static int svr_cancelremotetcp();
static int svr_remotetcpreq(); static int svr_remotetcpreq();
static int newtcpdirect(struct Channel * channel); static int newtcpdirect(struct Channel * channel);
#ifdef ENABLE_SVR_REMOTETCPFWD
const struct ChanType svr_chan_tcpdirect = {
1, /* sepfds */
"direct-tcpip",
newtcpdirect, /* init */
NULL, /* checkclose */
NULL, /* reqhandler */
NULL /* closehandler */
};
static const struct ChanType svr_chan_tcpremote = { static const struct ChanType svr_chan_tcpremote = {
1, /* sepfds */ 1, /* sepfds */
"forwarded-tcpip", "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) { static int matchtcp(void* typedata1, void* typedata2) {
const struct TCPListener *info1 = (struct TCPListener*)typedata1; const struct TCPListener *info1 = (struct TCPListener*)typedata1;
@ -230,6 +229,19 @@ out:
return ret; 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 /* Called upon creating a new direct tcp channel (ie we connect out to an
* address */ * address */
static int newtcpdirect(struct Channel * channel) { static int newtcpdirect(struct Channel * channel) {
@ -294,4 +306,4 @@ out:
return err; return err;
} }
#endif #endif /* ENABLE_SVR_LOCALTCPFWD */