lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1894 - nss-pam-ldapd/nslcd

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1894 - nss-pam-ldapd/nslcd



Author: arthur
Date: Tue Jan  1 14:09:05 2013
New Revision: 1894
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1894&view=revision

Log:
retry updating the lastChange attribute with the normal nslcd LDAP connection 
if the update with the user's connection failed

Modified:
   nss-pam-ldapd/nslcd/pam.c

Modified: nss-pam-ldapd/nslcd/pam.c
==============================================================================
--- nss-pam-ldapd/nslcd/pam.c   Tue Jan  1 13:55:06 2013        (r1893)
+++ nss-pam-ldapd/nslcd/pam.c   Tue Jan  1 14:09:05 2013        (r1894)
@@ -578,7 +578,8 @@
 }
 
 /* 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 @@
     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 @@
     }
   }
   /* 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",
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/