diff options
author | Damien Miller <djm@mindrot.org> | 2014-07-03 21:22:40 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2014-07-03 21:22:40 +1000 |
commit | b1e967c8d7c7578dd0c172d85b3046cf54ea42ba (patch) | |
tree | 8f895c2e7399de136573dd2098540c8406cb9f7f | |
parent | 61e28e55c3438d796b02ef878bcd28620d452670 (diff) |
- djm@cvs.openbsd.org 2014/07/03 03:11:03
[ssh-agent.c]
Only cleanup agent socket in the main agent process and not in any
subprocesses it may have started (e.g. forked askpass). Fixes
agent sockets being zapped when askpass processes fatal();
bz#2236 patch from Dmitry V. Levin
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ssh-agent.c | 10 |
2 files changed, 15 insertions, 1 deletions
@@ -8,6 +8,12 @@ | |||
8 | [sshkey.c] | 8 | [sshkey.c] |
9 | make Ed25519 keys' title fit properly in the randomart border; bz#2247 | 9 | make Ed25519 keys' title fit properly in the randomart border; bz#2247 |
10 | based on patch from Christian Hesse | 10 | based on patch from Christian Hesse |
11 | - djm@cvs.openbsd.org 2014/07/03 03:11:03 | ||
12 | [ssh-agent.c] | ||
13 | Only cleanup agent socket in the main agent process and not in any | ||
14 | subprocesses it may have started (e.g. forked askpass). Fixes | ||
15 | agent sockets being zapped when askpass processes fatal(); | ||
16 | bz#2236 patch from Dmitry V. Levin | ||
11 | 17 | ||
12 | 20140702 | 18 | 20140702 |
13 | - OpenBSD CVS Sync | 19 | - OpenBSD CVS Sync |
diff --git a/ssh-agent.c b/ssh-agent.c index 693d763e2..f7a021364 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.186 2014/06/24 01:13:21 djm Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.187 2014/07/03 03:11:03 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -126,6 +126,9 @@ int max_fd = 0; | |||
126 | pid_t parent_pid = -1; | 126 | pid_t parent_pid = -1; |
127 | time_t parent_alive_interval = 0; | 127 | time_t parent_alive_interval = 0; |
128 | 128 | ||
129 | /* pid of process for which cleanup_socket is applicable */ | ||
130 | pid_t cleanup_pid = 0; | ||
131 | |||
129 | /* pathname and directory for AUTH_SOCKET */ | 132 | /* pathname and directory for AUTH_SOCKET */ |
130 | char socket_name[MAXPATHLEN]; | 133 | char socket_name[MAXPATHLEN]; |
131 | char socket_dir[MAXPATHLEN]; | 134 | char socket_dir[MAXPATHLEN]; |
@@ -976,6 +979,9 @@ after_select(fd_set *readset, fd_set *writeset) | |||
976 | static void | 979 | static void |
977 | cleanup_socket(void) | 980 | cleanup_socket(void) |
978 | { | 981 | { |
982 | if (cleanup_pid != 0 && getpid() != cleanup_pid) | ||
983 | return; | ||
984 | debug("%s: cleanup", __func__); | ||
979 | if (socket_name[0]) | 985 | if (socket_name[0]) |
980 | unlink(socket_name); | 986 | unlink(socket_name); |
981 | if (socket_dir[0]) | 987 | if (socket_dir[0]) |
@@ -1244,6 +1250,8 @@ main(int ac, char **av) | |||
1244 | 1250 | ||
1245 | skip: | 1251 | skip: |
1246 | 1252 | ||
1253 | cleanup_pid = getpid(); | ||
1254 | |||
1247 | #ifdef ENABLE_PKCS11 | 1255 | #ifdef ENABLE_PKCS11 |
1248 | pkcs11_init(0); | 1256 | pkcs11_init(0); |
1249 | #endif | 1257 | #endif |