comparison svr-tcpfwd.c @ 937:4ad38e223ccd

Send a failure response if a client receives a global request
author Matt Johnston <matt@ucc.asn.au>
date Tue, 08 Jul 2014 21:59:36 +0800
parents c19acba28590
children 5daedffd0769
comparison
equal deleted inserted replaced
936:d93a6bcf616f 937:4ad38e223ccd
32 #include "packet.h" 32 #include "packet.h"
33 #include "listener.h" 33 #include "listener.h"
34 #include "runopts.h" 34 #include "runopts.h"
35 #include "auth.h" 35 #include "auth.h"
36 36
37 static void send_msg_request_failure();
38
39 static void send_msg_request_failure() {
40 CHECKCLEARTOWRITE();
41 buf_putbyte(ses.writepayload, SSH_MSG_REQUEST_FAILURE);
42 encrypt_packet();
43 }
44
45 #ifndef ENABLE_SVR_REMOTETCPFWD 37 #ifndef ENABLE_SVR_REMOTETCPFWD
46 38
47 /* This is better than SSH_MSG_UNIMPLEMENTED */ 39 /* This is better than SSH_MSG_UNIMPLEMENTED */
48 void recv_msg_global_request_remotetcp() { 40 void recv_msg_global_request_remotetcp() {
49 TRACE(("recv_msg_global_request_remotetcp: remote tcp forwarding not compiled in")) 41 TRACE(("recv_msg_global_request_remotetcp: remote tcp forwarding not compiled in"))
51 } 43 }
52 44
53 /* */ 45 /* */
54 #endif /* !ENABLE_SVR_REMOTETCPFWD */ 46 #endif /* !ENABLE_SVR_REMOTETCPFWD */
55 47
56 static void send_msg_request_success();
57 static int svr_cancelremotetcp(); 48 static int svr_cancelremotetcp();
58 static int svr_remotetcpreq(); 49 static int svr_remotetcpreq();
59 static int newtcpdirect(struct Channel * channel); 50 static int newtcpdirect(struct Channel * channel);
60 51
61 #ifdef ENABLE_SVR_REMOTETCPFWD 52 #ifdef ENABLE_SVR_REMOTETCPFWD
113 m_free(reqname); 104 m_free(reqname);
114 105
115 TRACE(("leave recv_msg_global_request")) 106 TRACE(("leave recv_msg_global_request"))
116 } 107 }
117 108
118
119 static void send_msg_request_success() {
120
121 CHECKCLEARTOWRITE();
122 buf_putbyte(ses.writepayload, SSH_MSG_REQUEST_SUCCESS);
123 encrypt_packet();
124
125 }
126
127 static int matchtcp(void* typedata1, void* typedata2) { 109 static int matchtcp(void* typedata1, void* typedata2) {
128 110
129 const struct TCPListener *info1 = (struct TCPListener*)typedata1; 111 const struct TCPListener *info1 = (struct TCPListener*)typedata1;
130 const struct TCPListener *info2 = (struct TCPListener*)typedata2; 112 const struct TCPListener *info2 = (struct TCPListener*)typedata2;
131 113