*/
if (flags & PAM_PRELIM_CHECK) {
- time_t pwdlastset_prelim = 0;
+ time_t *pwdlastset_prelim = NULL;
+
+ pwdlastset_prelim = talloc_array(NULL, time_t, 1);
+ if (pwdlastset_prelim == NULL) {
+ _pam_log(ctx, LOG_CRIT,
+ "password - out of memory");
+ ret = PAM_BUF_ERR;
+ goto out;
+ }
/* instruct user what is happening */
ret = winbind_auth_request(ctx, user, pass_old,
NULL, NULL, 0,
&error, NULL,
- &pwdlastset_prelim, NULL);
+ pwdlastset_prelim, NULL);
if (ret != PAM_ACCT_EXPIRED &&
ret != PAM_AUTHTOK_EXPIRED &&
}
pam_set_data(pamh, PAM_WINBIND_PWD_LAST_SET,
- (void *)pwdlastset_prelim, NULL);
+ pwdlastset_prelim,
+ _pam_winbind_cleanup_func);
ret = pam_set_item(pamh, PAM_OLDAUTHTOK,
(const void *) pass_old);
}
} else if (flags & PAM_UPDATE_AUTHTOK) {
- time_t pwdlastset_update = 0;
+ time_t *pwdlastset_update = NULL;
/*
* obtain the proposed password
* By reaching here we have approved the passwords and must now
* rebuild the password database file.
*/
- pam_get_data(pamh, PAM_WINBIND_PWD_LAST_SET,
- (const void **) &pwdlastset_update);
+ pam_get_data(pamh,
+ PAM_WINBIND_PWD_LAST_SET,
+ (const void **)&pwdlastset_update);
/*
* if cached creds were enabled, make sure to set the
}
ret = winbind_chauthtok_request(ctx, user, pass_old,
- pass_new, pwdlastset_update);
+ pass_new, *pwdlastset_update);
if (ret != PAM_SUCCESS) {
pass_old = pass_new = NULL;
goto out;