The previous commit contained a stupid mistake: ctxt->pam_[cp]sock was

initialized after the call to pthread_create() instead of before.  It just
happened to work with threads enabled because ctxt is shared, but of
course it doesn't work when we use a child process instead of threads.
This commit is contained in:
des 2002-12-21 15:09:58 +00:00
parent c877a609a9
commit a9741e060a

View File

@ -294,6 +294,8 @@ pam_init_ctx(Authctxt *authctxt)
xfree(ctxt);
return (NULL);
}
ctxt->pam_psock = socks[0];
ctxt->pam_csock = socks[1];
if (pthread_create(&ctxt->pam_thread, NULL, pam_thread, ctxt) == -1) {
error("PAM: failed to start authentication thread: %s",
strerror(errno));
@ -302,8 +304,6 @@ pam_init_ctx(Authctxt *authctxt)
xfree(ctxt);
return (NULL);
}
ctxt->pam_psock = socks[0];
ctxt->pam_csock = socks[1];
fatal_add_cleanup(pam_thread_cleanup, ctxt);
return (ctxt);
}