comparison cli-chansession.c @ 1121:bb3a03feb31f

Merge pull request #13 from gazoo74/fix-warnings Fix warnings
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jun 2015 22:25:28 +0800
parents 6b6ed65e99b1
children aaf576b27a10
comparison
equal deleted inserted replaced
1087:1e486f368ec3 1121:bb3a03feb31f
54 cli_closechansess, /* closehandler */ 54 cli_closechansess, /* closehandler */
55 }; 55 };
56 56
57 static void cli_chansessreq(struct Channel *channel) { 57 static void cli_chansessreq(struct Channel *channel) {
58 58
59 unsigned char* type = NULL; 59 char* type = NULL;
60 int wantreply; 60 int wantreply;
61 61
62 TRACE(("enter cli_chansessreq")) 62 TRACE(("enter cli_chansessreq"))
63 63
64 type = buf_getstring(ses.payload, NULL); 64 type = (char *) buf_getstring(ses.payload, NULL);
65 wantreply = buf_getbool(ses.payload); 65 wantreply = buf_getbool(ses.payload);
66 66
67 if (strcmp(type, "exit-status") == 0) { 67 if (strcmp(type, "exit-status") == 0) {
68 cli_ses.retval = buf_getint(ses.payload); 68 cli_ses.retval = buf_getint(ses.payload);
69 TRACE(("got exit-status of '%d'", cli_ses.retval)) 69 TRACE(("got exit-status of '%d'", cli_ses.retval))
259 channel = ses.channels[i]; 259 channel = ses.channels[i];
260 if (channel != NULL && channel->type == &clichansess) { 260 if (channel != NULL && channel->type == &clichansess) {
261 CHECKCLEARTOWRITE(); 261 CHECKCLEARTOWRITE();
262 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST); 262 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST);
263 buf_putint(ses.writepayload, channel->remotechan); 263 buf_putint(ses.writepayload, channel->remotechan);
264 buf_putstring(ses.writepayload, "window-change", 13); 264 buf_putstring(ses.writepayload, (const unsigned char *) "window-change", 13);
265 buf_putbyte(ses.writepayload, 0); /* FALSE says the spec */ 265 buf_putbyte(ses.writepayload, 0); /* FALSE says the spec */
266 put_winsize(); 266 put_winsize();
267 encrypt_packet(); 267 encrypt_packet();
268 } 268 }
269 } 269 }
270 cli_ses.winchange = 0; 270 cli_ses.winchange = 0;
271 } 271 }
272 272
273 static void send_chansess_pty_req(struct Channel *channel) { 273 static void send_chansess_pty_req(struct Channel *channel) {
274 274
275 unsigned char* term = NULL; 275 char* term = NULL;
276 276
277 TRACE(("enter send_chansess_pty_req")) 277 TRACE(("enter send_chansess_pty_req"))
278 278
279 start_send_channel_request(channel, "pty-req"); 279 start_send_channel_request(channel, "pty-req");
280 280
284 /* Get the terminal */ 284 /* Get the terminal */
285 term = getenv("TERM"); 285 term = getenv("TERM");
286 if (term == NULL) { 286 if (term == NULL) {
287 term = "vt100"; /* Seems a safe default */ 287 term = "vt100"; /* Seems a safe default */
288 } 288 }
289 buf_putstring(ses.writepayload, term, strlen(term)); 289 buf_putstring(ses.writepayload, (const unsigned char *)term, strlen(term));
290 290
291 /* Window size */ 291 /* Window size */
292 put_winsize(); 292 put_winsize();
293 293
294 /* Terminal mode encoding */ 294 /* Terminal mode encoding */
303 TRACE(("leave send_chansess_pty_req")) 303 TRACE(("leave send_chansess_pty_req"))
304 } 304 }
305 305
306 static void send_chansess_shell_req(struct Channel *channel) { 306 static void send_chansess_shell_req(struct Channel *channel) {
307 307
308 unsigned char* reqtype = NULL; 308 char* reqtype = NULL;
309 309
310 TRACE(("enter send_chansess_shell_req")) 310 TRACE(("enter send_chansess_shell_req"))
311 311
312 if (cli_opts.cmd) { 312 if (cli_opts.cmd) {
313 if (cli_opts.is_subsystem) { 313 if (cli_opts.is_subsystem) {
322 start_send_channel_request(channel, reqtype); 322 start_send_channel_request(channel, reqtype);
323 323
324 /* XXX TODO */ 324 /* XXX TODO */
325 buf_putbyte(ses.writepayload, 0); /* Don't want replies */ 325 buf_putbyte(ses.writepayload, 0); /* Don't want replies */
326 if (cli_opts.cmd) { 326 if (cli_opts.cmd) {
327 buf_putstring(ses.writepayload, cli_opts.cmd, strlen(cli_opts.cmd)); 327 buf_putstring(ses.writepayload, (const unsigned char *)cli_opts.cmd, strlen(cli_opts.cmd));
328 } 328 }
329 329
330 encrypt_packet(); 330 encrypt_packet();
331 TRACE(("leave send_chansess_shell_req")) 331 TRACE(("leave send_chansess_shell_req"))
332 } 332 }
390 cli_closechansess 390 cli_closechansess
391 }; 391 };
392 392
393 void cli_send_netcat_request() { 393 void cli_send_netcat_request() {
394 394
395 const unsigned char* source_host = "127.0.0.1"; 395 const char* source_host = "127.0.0.1";
396 const int source_port = 22; 396 const int source_port = 22;
397 397
398 TRACE(("enter cli_send_netcat_request")) 398 TRACE(("enter cli_send_netcat_request"))
399 cli_opts.wantpty = 0; 399 cli_opts.wantpty = 0;
400 400
401 if (send_msg_channel_open_init(STDIN_FILENO, &cli_chan_netcat) 401 if (send_msg_channel_open_init(STDIN_FILENO, &cli_chan_netcat)
402 == DROPBEAR_FAILURE) { 402 == DROPBEAR_FAILURE) {
403 dropbear_exit("Couldn't open initial channel"); 403 dropbear_exit("Couldn't open initial channel");
404 } 404 }
405 405
406 buf_putstring(ses.writepayload, cli_opts.netcat_host, 406 buf_putstring(ses.writepayload, (const unsigned char *)cli_opts.netcat_host,
407 strlen(cli_opts.netcat_host)); 407 strlen(cli_opts.netcat_host));
408 buf_putint(ses.writepayload, cli_opts.netcat_port); 408 buf_putint(ses.writepayload, cli_opts.netcat_port);
409 409
410 /* originator ip - localhost is accurate enough */ 410 /* originator ip - localhost is accurate enough */
411 buf_putstring(ses.writepayload, source_host, strlen(source_host)); 411 buf_putstring(ses.writepayload, (const unsigned char *)source_host, strlen(source_host));
412 buf_putint(ses.writepayload, source_port); 412 buf_putint(ses.writepayload, source_port);
413 413
414 encrypt_packet(); 414 encrypt_packet();
415 TRACE(("leave cli_send_netcat_request")) 415 TRACE(("leave cli_send_netcat_request"))
416 } 416 }