comparison cli-chansession.c @ 970:0bb16232e7c4

Make keepalive handling more robust, this should now match what OpenSSH does
author Matt Johnston <matt@ucc.asn.au>
date Tue, 19 Aug 2014 23:08:56 +0800
parents 5daedffd0769
children c45d65392c1a
comparison
equal deleted inserted replaced
969:939944f0fca9 970:0bb16232e7c4
90 if (ses.chancount > 1) { 90 if (ses.chancount > 1) {
91 dropbear_log(LOG_INFO, "Waiting for other channels to close..."); 91 dropbear_log(LOG_INFO, "Waiting for other channels to close...");
92 } 92 }
93 } 93 }
94 94
95 void cli_start_send_channel_request(struct Channel *channel,
96 unsigned char *type) {
97
98 CHECKCLEARTOWRITE();
99 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST);
100 buf_putint(ses.writepayload, channel->remotechan);
101
102 buf_putstring(ses.writepayload, type, strlen(type));
103
104 }
105
106 /* Taken from OpenSSH's sshtty.c: 95 /* Taken from OpenSSH's sshtty.c:
107 * RCSID("OpenBSD: sshtty.c,v 1.5 2003/09/19 17:43:35 markus Exp "); */ 96 * RCSID("OpenBSD: sshtty.c,v 1.5 2003/09/19 17:43:35 markus Exp "); */
108 static void cli_tty_setup() { 97 static void cli_tty_setup() {
109 98
110 struct termios tio; 99 struct termios tio;
285 274
286 unsigned char* term = NULL; 275 unsigned char* term = NULL;
287 276
288 TRACE(("enter send_chansess_pty_req")) 277 TRACE(("enter send_chansess_pty_req"))
289 278
290 cli_start_send_channel_request(channel, "pty-req"); 279 start_send_channel_request(channel, "pty-req");
291 280
292 /* Don't want replies */ 281 /* Don't want replies */
293 buf_putbyte(ses.writepayload, 0); 282 buf_putbyte(ses.writepayload, 0);
294 283
295 /* Get the terminal */ 284 /* Get the terminal */
328 } 317 }
329 } else { 318 } else {
330 reqtype = "shell"; 319 reqtype = "shell";
331 } 320 }
332 321
333 cli_start_send_channel_request(channel, reqtype); 322 start_send_channel_request(channel, reqtype);
334 323
335 /* XXX TODO */ 324 /* XXX TODO */
336 buf_putbyte(ses.writepayload, 0); /* Don't want replies */ 325 buf_putbyte(ses.writepayload, 0); /* Don't want replies */
337 if (cli_opts.cmd) { 326 if (cli_opts.cmd) {
338 buf_putstring(ses.writepayload, cli_opts.cmd, strlen(cli_opts.cmd)); 327 buf_putstring(ses.writepayload, cli_opts.cmd, strlen(cli_opts.cmd));