comparison svr-tcpfwd.c @ 1114:db7963049308

Turn many local variables into char * reqname, bindaddr, request_addr, desthost and orighost to be exhaustive.
author Gaël PORTAY <gael.portay@gmail.com>
date Sat, 02 May 2015 23:40:30 +0200
parents c45d65392c1a
children aaf576b27a10
comparison
equal deleted inserted replaced
1113:367d3800555b 1114:db7963049308
63 /* At the moment this is completely used for tcp code (with the name reflecting 63 /* At the moment this is completely used for tcp code (with the name reflecting
64 * that). If new request types are added, this should be replaced with code 64 * that). If new request types are added, this should be replaced with code
65 * similar to the request-switching in chansession.c */ 65 * similar to the request-switching in chansession.c */
66 void recv_msg_global_request_remotetcp() { 66 void recv_msg_global_request_remotetcp() {
67 67
68 unsigned char* reqname = NULL; 68 char* reqname = NULL;
69 unsigned int namelen; 69 unsigned int namelen;
70 unsigned int wantreply = 0; 70 unsigned int wantreply = 0;
71 int ret = DROPBEAR_FAILURE; 71 int ret = DROPBEAR_FAILURE;
72 72
73 TRACE(("enter recv_msg_global_request_remotetcp")) 73 TRACE(("enter recv_msg_global_request_remotetcp"))
75 if (svr_opts.noremotetcp || !svr_pubkey_allows_tcpfwd()) { 75 if (svr_opts.noremotetcp || !svr_pubkey_allows_tcpfwd()) {
76 TRACE(("leave recv_msg_global_request_remotetcp: remote tcp forwarding disabled")) 76 TRACE(("leave recv_msg_global_request_remotetcp: remote tcp forwarding disabled"))
77 goto out; 77 goto out;
78 } 78 }
79 79
80 reqname = buf_getstring(ses.payload, &namelen); 80 reqname = (char *)buf_getstring(ses.payload, &namelen);
81 wantreply = buf_getbool(ses.payload); 81 wantreply = buf_getbool(ses.payload);
82 82
83 if (namelen > MAX_NAME_LEN) { 83 if (namelen > MAX_NAME_LEN) {
84 TRACE(("name len is wrong: %d", namelen)) 84 TRACE(("name len is wrong: %d", namelen))
85 goto out; 85 goto out;
118 } 118 }
119 119
120 static int svr_cancelremotetcp() { 120 static int svr_cancelremotetcp() {
121 121
122 int ret = DROPBEAR_FAILURE; 122 int ret = DROPBEAR_FAILURE;
123 unsigned char * bindaddr = NULL; 123 char * bindaddr = NULL;
124 unsigned int addrlen; 124 unsigned int addrlen;
125 unsigned int port; 125 unsigned int port;
126 struct Listener * listener = NULL; 126 struct Listener * listener = NULL;
127 struct TCPListener tcpinfo; 127 struct TCPListener tcpinfo;
128 128
129 TRACE(("enter cancelremotetcp")) 129 TRACE(("enter cancelremotetcp"))
130 130
131 bindaddr = buf_getstring(ses.payload, &addrlen); 131 bindaddr = (char *)buf_getstring(ses.payload, &addrlen);
132 if (addrlen > MAX_IP_LEN) { 132 if (addrlen > MAX_IP_LEN) {
133 TRACE(("addr len too long: %d", addrlen)) 133 TRACE(("addr len too long: %d", addrlen))
134 goto out; 134 goto out;
135 } 135 }
136 136
153 } 153 }
154 154
155 static int svr_remotetcpreq() { 155 static int svr_remotetcpreq() {
156 156
157 int ret = DROPBEAR_FAILURE; 157 int ret = DROPBEAR_FAILURE;
158 unsigned char * request_addr = NULL; 158 char * request_addr = NULL;
159 unsigned int addrlen; 159 unsigned int addrlen;
160 struct TCPListener *tcpinfo = NULL; 160 struct TCPListener *tcpinfo = NULL;
161 unsigned int port; 161 unsigned int port;
162 162
163 TRACE(("enter remotetcpreq")) 163 TRACE(("enter remotetcpreq"))
164 164
165 request_addr = buf_getstring(ses.payload, &addrlen); 165 request_addr = (char *)buf_getstring(ses.payload, &addrlen);
166 if (addrlen > MAX_IP_LEN) { 166 if (addrlen > MAX_IP_LEN) {
167 TRACE(("addr len too long: %d", addrlen)) 167 TRACE(("addr len too long: %d", addrlen))
168 goto out; 168 goto out;
169 } 169 }
170 170
230 230
231 /* Called upon creating a new direct tcp channel (ie we connect out to an 231 /* Called upon creating a new direct tcp channel (ie we connect out to an
232 * address */ 232 * address */
233 static int newtcpdirect(struct Channel * channel) { 233 static int newtcpdirect(struct Channel * channel) {
234 234
235 unsigned char* desthost = NULL; 235 char* desthost = NULL;
236 unsigned int destport; 236 unsigned int destport;
237 unsigned char* orighost = NULL; 237 char* orighost = NULL;
238 unsigned int origport; 238 unsigned int origport;
239 char portstring[NI_MAXSERV]; 239 char portstring[NI_MAXSERV];
240 unsigned int len; 240 unsigned int len;
241 int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED; 241 int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED;
242 242
245 if (svr_opts.nolocaltcp || !svr_pubkey_allows_tcpfwd()) { 245 if (svr_opts.nolocaltcp || !svr_pubkey_allows_tcpfwd()) {
246 TRACE(("leave newtcpdirect: local tcp forwarding disabled")) 246 TRACE(("leave newtcpdirect: local tcp forwarding disabled"))
247 goto out; 247 goto out;
248 } 248 }
249 249
250 desthost = buf_getstring(ses.payload, &len); 250 desthost = (char *)buf_getstring(ses.payload, &len);
251 if (len > MAX_HOST_LEN) { 251 if (len > MAX_HOST_LEN) {
252 TRACE(("leave newtcpdirect: desthost too long")) 252 TRACE(("leave newtcpdirect: desthost too long"))
253 goto out; 253 goto out;
254 } 254 }
255 255
256 destport = buf_getint(ses.payload); 256 destport = buf_getint(ses.payload);
257 257
258 orighost = buf_getstring(ses.payload, &len); 258 orighost = (char *)buf_getstring(ses.payload, &len);
259 if (len > MAX_HOST_LEN) { 259 if (len > MAX_HOST_LEN) {
260 TRACE(("leave newtcpdirect: orighost too long")) 260 TRACE(("leave newtcpdirect: orighost too long"))
261 goto out; 261 goto out;
262 } 262 }
263 263