summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-06-04 22:51:24 +1000
committerDamien Miller <djm@mindrot.org>2003-06-04 22:51:24 +1000
commitb69aaa8db7b6d079a2efad6d57796daedd449886 (patch)
treee5aef9890da527463a5e0bee3cc4bcff09668884
parent65d1f5765ff9b6b50a0ea97a2cc47fe4115f8972 (diff)
- djm@cvs.openbsd.org 2003/06/04 12:40:39
[scp.c] kill ssh process upon receipt of signal, bz #241. based on patch from esb AT hawaii.edu; ok markus@
-rw-r--r--ChangeLog6
-rw-r--r--scp.c16
2 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 7c4ba4754..db161a460 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,10 @@
20 - djm@cvs.openbsd.org 2003/06/04 12:18:49 20 - djm@cvs.openbsd.org 2003/06/04 12:18:49
21 [scp.c] 21 [scp.c]
22 ansify; ok markus@ 22 ansify; ok markus@
23 - djm@cvs.openbsd.org 2003/06/04 12:40:39
24 [scp.c]
25 kill ssh process upon receipt of signal, bz #241.
26 based on patch from esb AT hawaii.edu; ok markus@
23 - (djm) Update to fix of bug #584: lock card before return. 27 - (djm) Update to fix of bug #584: lock card before return.
24 From larsch@trustcenter.de 28 From larsch@trustcenter.de
25 29
@@ -450,4 +454,4 @@
450 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 454 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
451 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 455 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
452 456
453$Id: ChangeLog,v 1.2778 2003/06/04 12:51:08 djm Exp $ 457$Id: ChangeLog,v 1.2779 2003/06/04 12:51:24 djm Exp $
diff --git a/scp.c b/scp.c
index 6d2692e16..16734875b 100644
--- a/scp.c
+++ b/scp.c
@@ -71,7 +71,7 @@
71 */ 71 */
72 72
73#include "includes.h" 73#include "includes.h"
74RCSID("$OpenBSD: scp.c,v 1.104 2003/06/04 12:18:49 djm Exp $"); 74RCSID("$OpenBSD: scp.c,v 1.105 2003/06/04 12:40:39 djm Exp $");
75 75
76#include "xmalloc.h" 76#include "xmalloc.h"
77#include "atomicio.h" 77#include "atomicio.h"
@@ -107,7 +107,16 @@ int showprogress = 1;
107char *ssh_program = _PATH_SSH_PROGRAM; 107char *ssh_program = _PATH_SSH_PROGRAM;
108 108
109/* This is used to store the pid of ssh_program */ 109/* This is used to store the pid of ssh_program */
110pid_t do_cmd_pid; 110pid_t do_cmd_pid = -1;
111
112static void
113killchild(int signo)
114{
115 if (do_cmd_pid > 1)
116 kill(do_cmd_pid, signo);
117
118 _exit(1);
119}
111 120
112/* 121/*
113 * This function executes the given command as the specified user on the 122 * This function executes the given command as the specified user on the
@@ -170,6 +179,9 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout, int argc)
170 *fdout = pin[1]; 179 *fdout = pin[1];
171 close(pout[1]); 180 close(pout[1]);
172 *fdin = pout[0]; 181 *fdin = pout[0];
182 signal(SIGTERM, killchild);
183 signal(SIGINT, killchild);
184 signal(SIGHUP, killchild);
173 return 0; 185 return 0;
174} 186}
175 187