summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2010-08-23 23:52:36 +0100
committerColin Watson <cjwatson@debian.org>2010-08-23 23:52:36 +0100
commit78799892cb1858927be02be9737c594052e3f910 (patch)
treeac3dc2e848ab9dc62fe4252e01e52c3d456f628f /scp.c
parent3875951bb76a9ec62634ae4026c9cc885d933477 (diff)
parent31e30b835fd9695d3b6647cab4867001b092e28f (diff)
* New upstream release (http://www.openssh.com/txt/release-5.6):
- Added a ControlPersist option to ssh_config(5) that automatically starts a background ssh(1) multiplex master when connecting. This connection can stay alive indefinitely, or can be set to automatically close after a user-specified duration of inactivity (closes: #335697, #350898, #454787, #500573, #550262). - Support AuthorizedKeysFile, AuthorizedPrincipalsFile, HostbasedUsesNameFromPacketOnly, and PermitTunnel in sshd_config(5) Match blocks (closes: #549858). - sftp(1): fix ls in working directories that contain globbing characters in their pathnames (LP: #530714).
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/scp.c b/scp.c
index 0b483df99..b28d75eba 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{
@@ -240,6 +254,10 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout)
240 close(reserved[0]); 254 close(reserved[0]);
241 close(reserved[1]); 255 close(reserved[1]);
242 256
257 signal(SIGTSTP, suspchild);
258 signal(SIGTTIN, suspchild);
259 signal(SIGTTOU, suspchild);
260
243 /* Fork a child to execute the command on the remote host using ssh. */ 261 /* Fork a child to execute the command on the remote host using ssh. */
244 do_cmd_pid = fork(); 262 do_cmd_pid = fork();
245 if (do_cmd_pid == 0) { 263 if (do_cmd_pid == 0) {