diff options
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/clientloop.c b/clientloop.c index d445230e5..9549dadd4 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -59,7 +59,7 @@ | |||
59 | */ | 59 | */ |
60 | 60 | ||
61 | #include "includes.h" | 61 | #include "includes.h" |
62 | RCSID("$OpenBSD: clientloop.c,v 1.112 2003/06/28 16:23:06 deraadt Exp $"); | 62 | RCSID("$OpenBSD: clientloop.c,v 1.107 2003/04/01 10:22:21 markus Exp $"); |
63 | 63 | ||
64 | #include "ssh.h" | 64 | #include "ssh.h" |
65 | #include "ssh1.h" | 65 | #include "ssh1.h" |
@@ -414,9 +414,9 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) | |||
414 | 414 | ||
415 | /* Flush stdout and stderr buffers. */ | 415 | /* Flush stdout and stderr buffers. */ |
416 | if (buffer_len(bout) > 0) | 416 | if (buffer_len(bout) > 0) |
417 | atomicio(vwrite, fileno(stdout), buffer_ptr(bout), buffer_len(bout)); | 417 | atomicio(write, fileno(stdout), buffer_ptr(bout), buffer_len(bout)); |
418 | if (buffer_len(berr) > 0) | 418 | if (buffer_len(berr) > 0) |
419 | atomicio(vwrite, fileno(stderr), buffer_ptr(berr), buffer_len(berr)); | 419 | atomicio(write, fileno(stderr), buffer_ptr(berr), buffer_len(berr)); |
420 | 420 | ||
421 | leave_raw_mode(); | 421 | leave_raw_mode(); |
422 | 422 | ||
@@ -509,13 +509,13 @@ process_cmdline(void) | |||
509 | if (*s == 0) | 509 | if (*s == 0) |
510 | goto out; | 510 | goto out; |
511 | if (strlen(s) < 2 || s[0] != '-' || !(s[1] == 'L' || s[1] == 'R')) { | 511 | if (strlen(s) < 2 || s[0] != '-' || !(s[1] == 'L' || s[1] == 'R')) { |
512 | logit("Invalid command."); | 512 | log("Invalid command."); |
513 | goto out; | 513 | goto out; |
514 | } | 514 | } |
515 | if (s[1] == 'L') | 515 | if (s[1] == 'L') |
516 | local = 1; | 516 | local = 1; |
517 | if (!local && !compat20) { | 517 | if (!local && !compat20) { |
518 | logit("Not supported for SSH protocol version 1."); | 518 | log("Not supported for SSH protocol version 1."); |
519 | goto out; | 519 | goto out; |
520 | } | 520 | } |
521 | s += 2; | 521 | s += 2; |
@@ -526,24 +526,24 @@ process_cmdline(void) | |||
526 | sfwd_port, buf, sfwd_host_port) != 3 && | 526 | sfwd_port, buf, sfwd_host_port) != 3 && |
527 | sscanf(s, "%5[0-9]/%255[^/]/%5[0-9]", | 527 | sscanf(s, "%5[0-9]/%255[^/]/%5[0-9]", |
528 | sfwd_port, buf, sfwd_host_port) != 3) { | 528 | sfwd_port, buf, sfwd_host_port) != 3) { |
529 | logit("Bad forwarding specification."); | 529 | log("Bad forwarding specification."); |
530 | goto out; | 530 | goto out; |
531 | } | 531 | } |
532 | if ((fwd_port = a2port(sfwd_port)) == 0 || | 532 | if ((fwd_port = a2port(sfwd_port)) == 0 || |
533 | (fwd_host_port = a2port(sfwd_host_port)) == 0) { | 533 | (fwd_host_port = a2port(sfwd_host_port)) == 0) { |
534 | logit("Bad forwarding port(s)."); | 534 | log("Bad forwarding port(s)."); |
535 | goto out; | 535 | goto out; |
536 | } | 536 | } |
537 | if (local) { | 537 | if (local) { |
538 | if (channel_setup_local_fwd_listener(fwd_port, buf, | 538 | if (channel_setup_local_fwd_listener(fwd_port, buf, |
539 | fwd_host_port, options.gateway_ports) < 0) { | 539 | fwd_host_port, options.gateway_ports) < 0) { |
540 | logit("Port forwarding failed."); | 540 | log("Port forwarding failed."); |
541 | goto out; | 541 | goto out; |
542 | } | 542 | } |
543 | } else | 543 | } else |
544 | channel_request_remote_forwarding(fwd_port, buf, | 544 | channel_request_remote_forwarding(fwd_port, buf, |
545 | fwd_host_port); | 545 | fwd_host_port); |
546 | logit("Forwarding port."); | 546 | log("Forwarding port."); |
547 | out: | 547 | out: |
548 | signal(SIGINT, handler); | 548 | signal(SIGINT, handler); |
549 | enter_raw_mode(); | 549 | enter_raw_mode(); |
@@ -593,23 +593,10 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len) | |||
593 | /* We have been continued. */ | 593 | /* We have been continued. */ |
594 | continue; | 594 | continue; |
595 | 595 | ||
596 | case 'B': | ||
597 | if (compat20) { | ||
598 | snprintf(string, sizeof string, | ||
599 | "%cB\r\n", escape_char); | ||
600 | buffer_append(berr, string, | ||
601 | strlen(string)); | ||
602 | channel_request_start(session_ident, | ||
603 | "break", 0); | ||
604 | packet_put_int(1000); | ||
605 | packet_send(); | ||
606 | } | ||
607 | continue; | ||
608 | |||
609 | case 'R': | 596 | case 'R': |
610 | if (compat20) { | 597 | if (compat20) { |
611 | if (datafellows & SSH_BUG_NOREKEY) | 598 | if (datafellows & SSH_BUG_NOREKEY) |
612 | logit("Server does not support re-keying"); | 599 | log("Server does not support re-keying"); |
613 | else | 600 | else |
614 | need_rekeying = 1; | 601 | need_rekeying = 1; |
615 | } | 602 | } |
@@ -668,7 +655,6 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len) | |||
668 | "%c?\r\n\ | 655 | "%c?\r\n\ |
669 | Supported escape sequences:\r\n\ | 656 | Supported escape sequences:\r\n\ |
670 | %c. - terminate connection\r\n\ | 657 | %c. - terminate connection\r\n\ |
671 | %cB - send a BREAK to the remote system\r\n\ | ||
672 | %cC - open a command line\r\n\ | 658 | %cC - open a command line\r\n\ |
673 | %cR - Request rekey (SSH protocol 2 only)\r\n\ | 659 | %cR - Request rekey (SSH protocol 2 only)\r\n\ |
674 | %c^Z - suspend ssh\r\n\ | 660 | %c^Z - suspend ssh\r\n\ |
@@ -679,7 +665,7 @@ Supported escape sequences:\r\n\ | |||
679 | (Note that escapes are only recognized immediately after newline.)\r\n", | 665 | (Note that escapes are only recognized immediately after newline.)\r\n", |
680 | escape_char, escape_char, escape_char, escape_char, | 666 | escape_char, escape_char, escape_char, escape_char, |
681 | escape_char, escape_char, escape_char, escape_char, | 667 | escape_char, escape_char, escape_char, escape_char, |
682 | escape_char, escape_char, escape_char); | 668 | escape_char, escape_char); |
683 | buffer_append(berr, string, strlen(string)); | 669 | buffer_append(berr, string, strlen(string)); |
684 | continue; | 670 | continue; |
685 | 671 | ||
@@ -1002,8 +988,9 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
1002 | /* Do channel operations unless rekeying in progress. */ | 988 | /* Do channel operations unless rekeying in progress. */ |
1003 | if (!rekeying) { | 989 | if (!rekeying) { |
1004 | channel_after_select(readset, writeset); | 990 | channel_after_select(readset, writeset); |
1005 | if (need_rekeying || packet_need_rekeying()) { | 991 | |
1006 | debug("need rekeying"); | 992 | if (need_rekeying) { |
993 | debug("user requests rekeying"); | ||
1007 | xxx_kex->done = 0; | 994 | xxx_kex->done = 0; |
1008 | kex_send_kexinit(xxx_kex); | 995 | kex_send_kexinit(xxx_kex); |
1009 | need_rekeying = 0; | 996 | need_rekeying = 0; |
@@ -1194,7 +1181,7 @@ client_request_forwarded_tcpip(const char *request_type, int rchan) | |||
1194 | c = channel_new("forwarded-tcpip", | 1181 | c = channel_new("forwarded-tcpip", |
1195 | SSH_CHANNEL_CONNECTING, sock, sock, -1, | 1182 | SSH_CHANNEL_CONNECTING, sock, sock, -1, |
1196 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, | 1183 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, |
1197 | originator_address, 1); | 1184 | xstrdup(originator_address), 1); |
1198 | xfree(originator_address); | 1185 | xfree(originator_address); |
1199 | xfree(listen_address); | 1186 | xfree(listen_address); |
1200 | return c; | 1187 | return c; |
@@ -1230,7 +1217,8 @@ client_request_x11(const char *request_type, int rchan) | |||
1230 | return NULL; | 1217 | return NULL; |
1231 | c = channel_new("x11", | 1218 | c = channel_new("x11", |
1232 | SSH_CHANNEL_X11_OPEN, sock, sock, -1, | 1219 | SSH_CHANNEL_X11_OPEN, sock, sock, -1, |
1233 | CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, "x11", 1); | 1220 | CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, |
1221 | xstrdup("x11"), 1); | ||
1234 | c->force_drain = 1; | 1222 | c->force_drain = 1; |
1235 | return c; | 1223 | return c; |
1236 | } | 1224 | } |
@@ -1252,7 +1240,7 @@ client_request_agent(const char *request_type, int rchan) | |||
1252 | c = channel_new("authentication agent connection", | 1240 | c = channel_new("authentication agent connection", |
1253 | SSH_CHANNEL_OPEN, sock, sock, -1, | 1241 | SSH_CHANNEL_OPEN, sock, sock, -1, |
1254 | CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, | 1242 | CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, |
1255 | "authentication agent connection", 1); | 1243 | xstrdup("authentication agent connection"), 1); |
1256 | c->force_drain = 1; | 1244 | c->force_drain = 1; |
1257 | return c; | 1245 | return c; |
1258 | } | 1246 | } |