diff options
Diffstat (limited to 'auth-pam.c')
-rw-r--r-- | auth-pam.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/auth-pam.c b/auth-pam.c index faa0b904f..833c850e7 100644 --- a/auth-pam.c +++ b/auth-pam.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | /* Based on $FreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */ | 32 | /* Based on $FreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */ |
33 | #include "includes.h" | 33 | #include "includes.h" |
34 | RCSID("$Id: auth-pam.c,v 1.101 2004/05/13 07:29:35 dtucker Exp $"); | 34 | RCSID("$Id: auth-pam.c,v 1.102 2004/05/24 01:55:36 dtucker Exp $"); |
35 | 35 | ||
36 | #ifdef USE_PAM | 36 | #ifdef USE_PAM |
37 | #if defined(HAVE_SECURITY_PAM_APPL_H) | 37 | #if defined(HAVE_SECURITY_PAM_APPL_H) |
@@ -93,10 +93,17 @@ static mysig_t sshpam_oldsig; | |||
93 | static void | 93 | static void |
94 | sshpam_sigchld_handler(int sig) | 94 | sshpam_sigchld_handler(int sig) |
95 | { | 95 | { |
96 | signal(SIGCHLD, SIG_DFL); | ||
96 | if (cleanup_ctxt == NULL) | 97 | if (cleanup_ctxt == NULL) |
97 | return; /* handler called after PAM cleanup, shouldn't happen */ | 98 | return; /* handler called after PAM cleanup, shouldn't happen */ |
98 | if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, 0) == -1) | 99 | if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, WNOHANG) |
99 | return; /* couldn't wait for process */ | 100 | == -1) { |
101 | /* PAM thread has not exitted, privsep slave must have */ | ||
102 | kill(cleanup_ctxt->pam_thread, SIGTERM); | ||
103 | if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, 0) | ||
104 | == -1) | ||
105 | return; /* could not wait */ | ||
106 | } | ||
100 | if (WIFSIGNALED(sshpam_thread_status) && | 107 | if (WIFSIGNALED(sshpam_thread_status) && |
101 | WTERMSIG(sshpam_thread_status) == SIGTERM) | 108 | WTERMSIG(sshpam_thread_status) == SIGTERM) |
102 | return; /* terminated by pthread_cancel */ | 109 | return; /* terminated by pthread_cancel */ |