diff options
author | Darren Tucker <dtucker@zip.com.au> | 2010-01-15 11:46:03 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2010-01-15 11:46:03 +1100 |
commit | b8b17e984acab330b13c66460e6570e72c55ded9 (patch) | |
tree | a485c1b08482761a264f1f60397d453b4106b1bf | |
parent | a788de206647e1ffa51b0a95bac1951a02880f76 (diff) |
- guenther@cvs.openbsd.org 2010/01/15 00:05:22
[sftp.c]
Reset SIGTERM to SIG_DFL before executing ssh, so that even if sftp
inherited SIGTERM as ignored it will still be able to kill the ssh it
starts.
ok dtucker@
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sftp.c | 6 |
2 files changed, 10 insertions, 2 deletions
@@ -15,6 +15,12 @@ | |||
15 | [sftp-common.c] | 15 | [sftp-common.c] |
16 | use user_from{uid,gid} to lookup up ids since it keeps a small cache. | 16 | use user_from{uid,gid} to lookup up ids since it keeps a small cache. |
17 | ok djm | 17 | ok djm |
18 | - guenther@cvs.openbsd.org 2010/01/15 00:05:22 | ||
19 | [sftp.c] | ||
20 | Reset SIGTERM to SIG_DFL before executing ssh, so that even if sftp | ||
21 | inherited SIGTERM as ignored it will still be able to kill the ssh it | ||
22 | starts. | ||
23 | ok dtucker@ | ||
18 | 24 | ||
19 | 20100114 | 25 | 20100114 |
20 | - (djm) [platform.h] Add missing prototype for | 26 | - (djm) [platform.h] Add missing prototype for |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp.c,v 1.121 2010/01/13 12:48:34 jmc Exp $ */ | 1 | /* $OpenBSD: sftp.c,v 1.122 2010/01/15 00:05:22 guenther Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> |
4 | * | 4 | * |
@@ -2027,9 +2027,11 @@ connect_to_server(char *path, char **args, int *in, int *out) | |||
2027 | * The underlying ssh is in the same process group, so we must | 2027 | * The underlying ssh is in the same process group, so we must |
2028 | * ignore SIGINT if we want to gracefully abort commands, | 2028 | * ignore SIGINT if we want to gracefully abort commands, |
2029 | * otherwise the signal will make it to the ssh process and | 2029 | * otherwise the signal will make it to the ssh process and |
2030 | * kill it too | 2030 | * kill it too. Contrawise, since sftp sends SIGTERMs to the |
2031 | * underlying ssh, it must *not* ignore that signal. | ||
2031 | */ | 2032 | */ |
2032 | signal(SIGINT, SIG_IGN); | 2033 | signal(SIGINT, SIG_IGN); |
2034 | signal(SIGTERM, SIG_DFL); | ||
2033 | execvp(path, args); | 2035 | execvp(path, args); |
2034 | fprintf(stderr, "exec: %s: %s\n", path, strerror(errno)); | 2036 | fprintf(stderr, "exec: %s: %s\n", path, strerror(errno)); |
2035 | _exit(1); | 2037 | _exit(1); |