summaryrefslogtreecommitdiff
path: root/auth-pam.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2005-07-16 11:33:06 +1000
committerDarren Tucker <dtucker@zip.com.au>2005-07-16 11:33:06 +1000
commit4f1adad4f65d63645689d2d947876848b0813390 (patch)
tree2d928ab277c10e7107aa0dd27bd2aa80e60bf630 /auth-pam.c
parent4a42257b06fed3f2ec60ca27175d7db76761aebc (diff)
- (dtucker) [auth-pam.c] Ensure that only one side of the authentication
socketpair stays open on in both the monitor and PAM process. Patch from Joerg Sonnenberger.
Diffstat (limited to 'auth-pam.c')
-rw-r--r--auth-pam.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/auth-pam.c b/auth-pam.c
index db80017ef..fecba5de0 100644
--- a/auth-pam.c
+++ b/auth-pam.c
@@ -47,7 +47,7 @@
47 47
48/* Based on $FreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */ 48/* Based on $FreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */
49#include "includes.h" 49#include "includes.h"
50RCSID("$Id: auth-pam.c,v 1.123 2005/05/26 09:59:48 dtucker Exp $"); 50RCSID("$Id: auth-pam.c,v 1.124 2005/07/16 01:33:06 dtucker Exp $");
51 51
52#ifdef USE_PAM 52#ifdef USE_PAM
53#if defined(HAVE_SECURITY_PAM_APPL_H) 53#if defined(HAVE_SECURITY_PAM_APPL_H)
@@ -157,6 +157,7 @@ pthread_create(sp_pthread_t *thread, const void *attr __unused,
157 void *(*thread_start)(void *), void *arg) 157 void *(*thread_start)(void *), void *arg)
158{ 158{
159 pid_t pid; 159 pid_t pid;
160 struct pam_ctxt *ctx = arg;
160 161
161 sshpam_thread_status = -1; 162 sshpam_thread_status = -1;
162 switch ((pid = fork())) { 163 switch ((pid = fork())) {
@@ -164,10 +165,14 @@ pthread_create(sp_pthread_t *thread, const void *attr __unused,
164 error("fork(): %s", strerror(errno)); 165 error("fork(): %s", strerror(errno));
165 return (-1); 166 return (-1);
166 case 0: 167 case 0:
168 close(ctx->pam_psock);
169 ctx->pam_psock = -1;
167 thread_start(arg); 170 thread_start(arg);
168 _exit(1); 171 _exit(1);
169 default: 172 default:
170 *thread = pid; 173 *thread = pid;
174 close(ctx->pam_csock);
175 ctx->pam_csock = -1;
171 sshpam_oldsig = signal(SIGCHLD, sshpam_sigchld_handler); 176 sshpam_oldsig = signal(SIGCHLD, sshpam_sigchld_handler);
172 return (0); 177 return (0);
173 } 178 }