comparison cli-chansession.c @ 478:d4f32c3443ac dbclient-netcat-alike

propagate from branch 'au.asn.ucc.matt.dropbear' (head f21045c791002d81fc6b8dde6537ea481e513eb2) to branch 'au.asn.ucc.matt.dropbear.dbclient-netcat-alike' (head d1f69334581dc4c35f9ca16aa5355074c9dd315d)
author Matt Johnston <matt@ucc.asn.au>
date Sun, 14 Sep 2008 06:47:51 +0000
parents 6b41e2cbf071 3e6c536bc023
children 12d845ab7b5f
comparison
equal deleted inserted replaced
296:6b41e2cbf071 478:d4f32c3443ac
62 TRACE(("enter cli_chansessreq")) 62 TRACE(("enter cli_chansessreq"))
63 63
64 type = buf_getstring(ses.payload, NULL); 64 type = 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);
69 TRACE(("got exit-status of '%d'", cli_ses.retval))
70 } else if (strcmp(type, "exit-signal") == 0) {
71 TRACE(("got exit-signal, ignoring it"))
72 } else {
68 TRACE(("unknown request '%s'", type)) 73 TRACE(("unknown request '%s'", type))
69 send_msg_channel_failure(channel); 74 send_msg_channel_failure(channel);
70 goto out; 75 goto out;
71 } 76 }
72 77
73 /* We'll just trust what they tell us */
74 cli_ses.retval = buf_getint(ses.payload);
75 TRACE(("got exit-status of '%d'", cli_ses.retval))
76
77 out: 78 out:
78 m_free(type); 79 m_free(type);
79 } 80 }
80 81
81 82
160 TRACE(("leave cli_tty_cleanup")) 161 TRACE(("leave cli_tty_cleanup"))
161 } 162 }
162 163
163 static void put_termcodes() { 164 static void put_termcodes() {
164 165
165 TRACE(("enter put_termcodes"))
166
167 struct termios tio; 166 struct termios tio;
168 unsigned int sshcode; 167 unsigned int sshcode;
169 const struct TermCode *termcode; 168 const struct TermCode *termcode;
170 unsigned int value; 169 unsigned int value;
171 unsigned int mapcode; 170 unsigned int mapcode;
172 171
173 unsigned int bufpos1, bufpos2; 172 unsigned int bufpos1, bufpos2;
173
174 TRACE(("enter put_termcodes"))
174 175
175 if (tcgetattr(STDIN_FILENO, &tio) == -1) { 176 if (tcgetattr(STDIN_FILENO, &tio) == -1) {
176 dropbear_log(LOG_WARNING, "Failed reading termmodes"); 177 dropbear_log(LOG_WARNING, "Failed reading termmodes");
177 buf_putint(ses.writepayload, 1); /* Just the terminator */ 178 buf_putint(ses.writepayload, 1); /* Just the terminator */
178 buf_putbyte(ses.writepayload, 0); /* TTY_OP_END */ 179 buf_putbyte(ses.writepayload, 0); /* TTY_OP_END */
347 setnonblocking(STDIN_FILENO); 348 setnonblocking(STDIN_FILENO);
348 349
349 channel->errfd = STDERR_FILENO; 350 channel->errfd = STDERR_FILENO;
350 setnonblocking(STDERR_FILENO); 351 setnonblocking(STDERR_FILENO);
351 352
352 channel->extrabuf = cbuf_new(RECV_MAXWINDOW); 353 channel->extrabuf = cbuf_new(opts.recv_window);
353 354
354 if (cli_opts.wantpty) { 355 if (cli_opts.wantpty) {
355 send_chansess_pty_req(channel); 356 send_chansess_pty_req(channel);
356 } 357 }
357 358