lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1938 - nss-pam-ldapd-0.8/nslcd

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

nss-pam-ldapd commit: r1938 - nss-pam-ldapd-0.8/nslcd



Author: arthur
Date: Sun Apr 28 13:08:53 2013
New Revision: 1938
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1938&view=revision

Log:
retry updating the lastChange attribute with the normal nslcd LDAP connection 
if the update with the user's connection failed (2f6f6a2 from 0.9)

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

Modified: nss-pam-ldapd-0.8/nslcd/pam.c
==============================================================================
--- nss-pam-ldapd-0.8/nslcd/pam.c       Sat Mar  9 16:07:54 2013        (r1937)
+++ nss-pam-ldapd-0.8/nslcd/pam.c       Sun Apr 28 13:08:53 2013        (r1938)
@@ -574,7 +574,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;
@@ -597,7 +598,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 */
@@ -691,7 +694,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",ldap_err2string(rc));
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/