Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd/pam.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2013-01-01 14:09:05 +0100
committerArthur de Jong <arthur@arthurdejong.org>2013-01-01 14:09:05 +0100
commit2f6f6a20a8d9a21ee20a976d78f97e5f9949bb17 (patch)
tree45491a55192cb02f9d665646f0436091851e1f9a /nslcd/pam.c
parent864c5228c82d6a159558d0b1ea9d392e2a04d05a (diff)
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
Diffstat (limited to 'nslcd/pam.c')
-rw-r--r--nslcd/pam.c9
1 files changed, 6 insertions, 3 deletions
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",