diff --git a/channel.h b/channel.h index 714669723df804b510f5a5e2a356a9b333dee0b3..5d174f2848c7729c5d2191940570e5f8450f136d 100644 --- a/channel.h +++ b/channel.h @@ -129,4 +129,7 @@ void recv_msg_channel_open_confirmation(); void recv_msg_channel_open_failure(); #endif +void send_msg_request_success(); +void send_msg_request_failure(); + #endif /* _CHANNEL_H_ */ diff --git a/cli-session.c b/cli-session.c index c71d859313cd61bb9c4d35ddae7c7ce7d1ec8de3..d5ff02d01f123f9122571f97d201685aa38dd948 100644 --- a/cli-session.c +++ b/cli-session.c @@ -44,6 +44,7 @@ static void cli_session_init(); static void cli_finished(); static void recv_msg_service_accept(void); static void cli_session_cleanup(void); +static void recv_msg_global_request_cli(void); struct clientsession cli_ses; /* GLOBAL */ @@ -68,6 +69,7 @@ static const packettype cli_packettypes[] = { {SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure}, {SSH_MSG_USERAUTH_BANNER, recv_msg_userauth_banner}, /* client */ {SSH_MSG_USERAUTH_SPECIFIC_60, recv_msg_userauth_specific_60}, /* client */ + {SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_cli}, #ifdef ENABLE_CLI_REMOTETCPFWD {SSH_MSG_REQUEST_SUCCESS, cli_recv_msg_request_success}, /* client */ {SSH_MSG_REQUEST_FAILURE, cli_recv_msg_request_failure}, /* client */ @@ -366,3 +368,9 @@ void cleantext(unsigned char* dirtytext) { /* Null terminate */ dirtytext[j] = '\0'; } + +static void recv_msg_global_request_cli(void) { + TRACE(("recv_msg_global_request_cli")) + /* Send a proper rejection */ + send_msg_request_failure(); +} diff --git a/common-channel.c b/common-channel.c index 62e4be1c8a0c266bb50a17719add2d79cb9a7f0f..634d823875b56664bdd2e23f799abc83bba94558 100644 --- a/common-channel.c +++ b/common-channel.c @@ -1099,3 +1099,16 @@ void recv_msg_channel_open_failure() { remove_channel(channel); } #endif /* USING_LISTENERS */ + +void send_msg_request_success() { + CHECKCLEARTOWRITE(); + buf_putbyte(ses.writepayload, SSH_MSG_REQUEST_SUCCESS); + encrypt_packet(); +} + +void send_msg_request_failure() { + CHECKCLEARTOWRITE(); + buf_putbyte(ses.writepayload, SSH_MSG_REQUEST_FAILURE); + encrypt_packet(); +} + diff --git a/svr-tcpfwd.c b/svr-tcpfwd.c index 179d5ffc8c8b038ab2322fa5549c34e2205fe547..7033a6553431218b692eb619cdb9ea831930d5d0 100644 --- a/svr-tcpfwd.c +++ b/svr-tcpfwd.c @@ -34,14 +34,6 @@ #include "runopts.h" #include "auth.h" -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 */ @@ -53,7 +45,6 @@ void recv_msg_global_request_remotetcp() { /* */ #endif /* !ENABLE_SVR_REMOTETCPFWD */ -static void send_msg_request_success(); static int svr_cancelremotetcp(); static int svr_remotetcpreq(); static int newtcpdirect(struct Channel * channel); @@ -115,15 +106,6 @@ out: TRACE(("leave recv_msg_global_request")) } - -static void send_msg_request_success() { - - CHECKCLEARTOWRITE(); - buf_putbyte(ses.writepayload, SSH_MSG_REQUEST_SUCCESS); - encrypt_packet(); - -} - static int matchtcp(void* typedata1, void* typedata2) { const struct TCPListener *info1 = (struct TCPListener*)typedata1;