* src/groupmems.c (check_perms): Simplify. Always call pam_end()
at the end of the authentication.
This commit is contained in:
parent
b2f5629de8
commit
aa035f9853
@ -1,3 +1,8 @@
|
|||||||
|
2008-07-27 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* src/groupmems.c (check_perms): Simplify. Always call pam_end()
|
||||||
|
at the end of the authentication.
|
||||||
|
|
||||||
2008-07-27 Nicolas François <nicolas.francois@centraliens.net>
|
2008-07-27 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/groupmems.c: Add fail_exit() to remove the group lock file
|
* src/groupmems.c: Add fail_exit() to remove the group lock file
|
||||||
|
@ -170,47 +170,32 @@ static void check_perms (void)
|
|||||||
{
|
{
|
||||||
#ifdef USE_PAM
|
#ifdef USE_PAM
|
||||||
pam_handle_t *pamh = NULL;
|
pam_handle_t *pamh = NULL;
|
||||||
int retval;
|
int retval = PAM_SUCCESS;
|
||||||
#endif
|
struct passwd *pampw;
|
||||||
|
|
||||||
#ifdef USE_PAM
|
pampw = getpwuid (getuid ()); /* local, no need for xgetpwuid */
|
||||||
retval = PAM_SUCCESS;
|
if (pampw == NULL) {
|
||||||
|
retval = PAM_USER_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
if (retval == PAM_SUCCESS) {
|
||||||
struct passwd *pampw;
|
retval = pam_start ("groupmod", pampw->pw_name,
|
||||||
pampw = getpwuid (getuid ()); /* local, no need for xgetpwuid */
|
&conv, &pamh);
|
||||||
if (pampw == NULL) {
|
|
||||||
retval = PAM_USER_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retval == PAM_SUCCESS) {
|
|
||||||
retval = pam_start ("groupmod", pampw->pw_name,
|
|
||||||
&conv, &pamh);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval == PAM_SUCCESS) {
|
if (retval == PAM_SUCCESS) {
|
||||||
retval = pam_authenticate (pamh, 0);
|
retval = pam_authenticate (pamh, 0);
|
||||||
if (retval != PAM_SUCCESS) {
|
|
||||||
(void) pam_end (pamh, retval);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval == PAM_SUCCESS) {
|
if (retval == PAM_SUCCESS) {
|
||||||
retval = pam_acct_mgmt (pamh, 0);
|
retval = pam_acct_mgmt (pamh, 0);
|
||||||
if (retval != PAM_SUCCESS) {
|
|
||||||
(void) pam_end (pamh, retval);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void) pam_end (pamh, retval);
|
||||||
if (retval != PAM_SUCCESS) {
|
if (retval != PAM_SUCCESS) {
|
||||||
fprintf (stderr, _("%s: PAM authentication failed\n"), Prog);
|
fprintf (stderr, _("%s: PAM authentication failed\n"), Prog);
|
||||||
fail_exit (1);
|
fail_exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval == PAM_SUCCESS) {
|
|
||||||
(void) pam_end (pamh, PAM_SUCCESS);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user