summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--clientloop.c49
2 files changed, 30 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index b11fb7c9b..29671088f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,9 @@
11 - markus@cvs.openbsd.org 2001/10/24 08:51:35 11 - markus@cvs.openbsd.org 2001/10/24 08:51:35
12 [clientloop.c ssh.c] 12 [clientloop.c ssh.c]
13 ignore SIGPIPE early, makes ssh work if agent dies, netbsd-pr via itojun@ 13 ignore SIGPIPE early, makes ssh work if agent dies, netbsd-pr via itojun@
14 - markus@cvs.openbsd.org 2001/10/24 19:57:40
15 [clientloop.c]
16 make ~& (backgrounding) work again for proto v1; add support ~& for v2, too
14 17
1520011109 1820011109
16 - (stevesk) auth-pam.c: use do_pam_authenticate(PAM_DISALLOW_NULL_AUTHTOK) 19 - (stevesk) auth-pam.c: use do_pam_authenticate(PAM_DISALLOW_NULL_AUTHTOK)
@@ -6820,4 +6823,4 @@
6820 - Wrote replacements for strlcpy and mkdtemp 6823 - Wrote replacements for strlcpy and mkdtemp
6821 - Released 1.0pre1 6824 - Released 1.0pre1
6822 6825
6823$Id: ChangeLog,v 1.1637 2001/11/11 23:52:03 djm Exp $ 6826$Id: ChangeLog,v 1.1638 2001/11/11 23:52:25 djm Exp $
diff --git a/clientloop.c b/clientloop.c
index 7e6fe269a..e8cd49988 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.85 2001/10/24 08:51:35 markus Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.86 2001/10/24 19:57:40 markus Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -522,36 +522,19 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)
522 continue; 522 continue;
523 523
524 case '&': 524 case '&':
525 /* XXX does not work yet with proto 2 */
526 if (compat20)
527 continue;
528 /* 525 /*
529 * Detach the program (continue to serve connections, 526 * Detach the program (continue to serve connections,
530 * but put in background and no more new connections). 527 * but put in background and no more new connections).
531 */ 528 */
532 if (!stdin_eof) {
533 /*
534 * Sending SSH_CMSG_EOF alone does not always appear
535 * to be enough. So we try to send an EOF character
536 * first.
537 */
538 packet_start(SSH_CMSG_STDIN_DATA);
539 packet_put_string("\004", 1);
540 packet_send();
541 /* Close stdin. */
542 stdin_eof = 1;
543 if (buffer_len(bin) == 0) {
544 packet_start(SSH_CMSG_EOF);
545 packet_send();
546 }
547 }
548 /* Restore tty modes. */ 529 /* Restore tty modes. */
549 leave_raw_mode(); 530 leave_raw_mode();
550 531
551 /* Stop listening for new connections. */ 532 /* Stop listening for new connections. */
552 channel_close_all(); /* proto1 only XXXX */ 533 channel_stop_listening();
553 534
554 printf("%c& [backgrounded]\n", escape_char); 535 snprintf(string, sizeof string,
536 "%c& [backgrounded]\n", escape_char);
537 buffer_append(berr, string, strlen(string));
555 538
556 /* Fork into background. */ 539 /* Fork into background. */
557 pid = fork(); 540 pid = fork();
@@ -564,7 +547,27 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)
564 exit(0); 547 exit(0);
565 } 548 }
566 /* The child continues serving connections. */ 549 /* The child continues serving connections. */
567 continue; /*XXX ? */ 550 if (compat20) {
551 buffer_append(bin, "\004", 1);
552 /* fake EOF on stdin */
553 return -1;
554 } else if (!stdin_eof) {
555 /*
556 * Sending SSH_CMSG_EOF alone does not always appear
557 * to be enough. So we try to send an EOF character
558 * first.
559 */
560 packet_start(SSH_CMSG_STDIN_DATA);
561 packet_put_string("\004", 1);
562 packet_send();
563 /* Close stdin. */
564 stdin_eof = 1;
565 if (buffer_len(bin) == 0) {
566 packet_start(SSH_CMSG_EOF);
567 packet_send();
568 }
569 }
570 continue;
568 571
569 case '?': 572 case '?':
570 snprintf(string, sizeof string, 573 snprintf(string, sizeof string,