From 2f6f6a20a8d9a21ee20a976d78f97e5f9949bb17 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Tue, 1 Jan 2013 13:09:05 +0000 Subject: retry updating the lastChange attribute with the normal nslcd LDAP connection if the update with the user's connection failed git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1894 ef36b2f9-881f-0410-afb5-c4e39611909c --- nslcd/pam.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'nslcd/pam.c') diff --git a/nslcd/pam.c b/nslcd/pam.c index c6f7fc6..1f611fb 100644 --- a/nslcd/pam.c +++ b/nslcd/pam.c @@ -578,7 +578,8 @@ int nslcd_pam_sess_c(TFILE *fp, MYLDAP_SESSION *session) } /* perform an LDAP password modification, returns an LDAP status code */ -static int try_pwmod(const char *binddn, const char *userdn, +static int try_pwmod(MYLDAP_SESSION *oldsession, + const char *binddn, const char *userdn, const char *oldpassword, const char *newpassword) { MYLDAP_SESSION *session; @@ -603,7 +604,9 @@ static int try_pwmod(const char *binddn, const char *userdn, if (rc == LDAP_SUCCESS) { /* try to update the shadowLastChange attribute */ - (void)update_lastchange(session, userdn); + if (update_lastchange(session, userdn) != LDAP_SUCCESS) + /* retry with the normal session */ + (void)update_lastchange(oldsession, userdn); } } /* close the session */ @@ -693,7 +696,7 @@ int nslcd_pam_pwmod(TFILE *fp, MYLDAP_SESSION *session, uid_t calleruid) } } /* perform password modification */ - rc = try_pwmod(binddn, myldap_get_dn(entry), oldpassword, newpassword); + rc = try_pwmod(session, binddn, myldap_get_dn(entry), oldpassword, newpassword); if (rc != LDAP_SUCCESS) { mysnprintf(authzmsg, sizeof(authzmsg) - 1, "password change failed: %s", -- cgit v1.2.3