1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r21011: Another patch from Danilo Almeida @ Centeris (via me):

Details: Reset the "new password prompt required" state whenever
we do a new auth.  In more detail, in pam_sm_authenticate, if not
settting PAM_WINBIND_NEW_AUTHTOK_REQD, then clean any potentially
present PAM_WINBIND_NEW_AUTHTOK_REQD.
(This used to be commit 402e859475)
This commit is contained in:
Gerald Carter 2007-01-25 01:18:31 +00:00 committed by Gerald (Jerry) Carter
parent 6ff9007252
commit 76fd8f8e1d

View File

@ -1179,6 +1179,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
int retval = PAM_AUTH_ERR;
dictionary *d = NULL;
char *username_ret = NULL;
char *new_authtok_required = NULL;
/* parse arguments */
int ctrl = _pam_parse(pamh, flags, argc, argv, &d);
@ -1227,14 +1228,12 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
if (retval == PAM_NEW_AUTHTOK_REQD ||
retval == PAM_AUTHTOK_EXPIRED) {
char *buf;
if (!asprintf(&buf, "%d", retval)) {
if (!asprintf(&new_authtok_required, "%d", retval)) {
retval = PAM_BUF_ERR;
goto out;
}
pam_set_data( pamh, PAM_WINBIND_NEW_AUTHTOK_REQD, (void *)buf, _pam_winbind_cleanup_func);
pam_set_data(pamh, PAM_WINBIND_NEW_AUTHTOK_REQD, new_authtok_required, _pam_winbind_cleanup_func);
retval = PAM_SUCCESS;
goto out;
@ -1296,6 +1295,10 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
iniparser_freedict(d);
}
if (!new_authtok_required) {
pam_set_data(pamh, PAM_WINBIND_NEW_AUTHTOK_REQD, NULL, NULL);
}
return ret;
}