summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--scp.c20
2 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9b214e864..cf93dc9fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,11 @@
23 - jmc@cvs.openbsd.org 2010/06/30 07:28:34 23 - jmc@cvs.openbsd.org 2010/06/30 07:28:34
24 [sshd_config.5] 24 [sshd_config.5]
25 tweak previous; 25 tweak previous;
26 - millert@cvs.openbsd.org 2010/07/01 13:06:59
27 [scp.c]
28 Fix a longstanding problem where if you suspend scp at the
29 password/passphrase prompt the terminal mode is not restored.
30 OK djm@
26 31
2720100627 3220100627
28 - (tim) [openbsd-compat/port-uw.c] Reorder includes. auth-options.h now needs 33 - (tim) [openbsd-compat/port-uw.c] Reorder includes. auth-options.h now needs
diff --git a/scp.c b/scp.c
index 09efb82ac..e07de42f7 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: scp.c,v 1.165 2009/12/20 07:28:36 guenther Exp $ */ 1/* $OpenBSD: scp.c,v 1.166 2010/07/01 13:06:59 millert Exp $ */
2/* 2/*
3 * scp - secure remote copy. This is basically patched BSD rcp which 3 * scp - secure remote copy. This is basically patched BSD rcp which
4 * uses ssh to do the data transfer (instead of using rcmd). 4 * uses ssh to do the data transfer (instead of using rcmd).
@@ -156,6 +156,20 @@ killchild(int signo)
156 exit(1); 156 exit(1);
157} 157}
158 158
159static void
160suspchild(int signo)
161{
162 int status;
163
164 if (do_cmd_pid > 1) {
165 kill(do_cmd_pid, signo);
166 while (waitpid(do_cmd_pid, &status, WUNTRACED) == -1 &&
167 errno == EINTR)
168 ;
169 kill(getpid(), SIGSTOP);
170 }
171}
172
159static int 173static int
160do_local_cmd(arglist *a) 174do_local_cmd(arglist *a)
161{ 175{
@@ -232,6 +246,10 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout)
232 close(reserved[0]); 246 close(reserved[0]);
233 close(reserved[1]); 247 close(reserved[1]);
234 248
249 signal(SIGTSTP, suspchild);
250 signal(SIGTTIN, suspchild);
251 signal(SIGTTOU, suspchild);
252
235 /* Fork a child to execute the command on the remote host using ssh. */ 253 /* Fork a child to execute the command on the remote host using ssh. */
236 do_cmd_pid = fork(); 254 do_cmd_pid = fork();
237 if (do_cmd_pid == 0) { 255 if (do_cmd_pid == 0) {