Author: vlendec
Date: 2006-06-20 20:05:39 +0000 (Tue, 20 Jun 2006)
New Revision: 16427

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16427

Log:
Fix bug # 3848. Thanks to Wilco Baan Hofman for testing the release candidate!

Volker


Modified:
   branches/SAMBA_3_0/source/passdb/pdb_ldap.c
   trunk/source/passdb/pdb_ldap.c


Changeset:
Modified: branches/SAMBA_3_0/source/passdb/pdb_ldap.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/pdb_ldap.c 2006-06-20 19:21:14 UTC (rev 
16426)
+++ branches/SAMBA_3_0/source/passdb/pdb_ldap.c 2006-06-20 20:05:39 UTC (rev 
16427)
@@ -1796,6 +1796,19 @@
        ldap_mods_free(mods,True);
        SAFE_FREE(dn);
 
+       /*
+        * We need to set the backend private data to NULL here. For example
+        * setuserinfo level 25 does a pdb_update_sam_account twice on the
+        * same one, and with the explicit delete / add logic for attribute
+        * values the second time we would use the wrong "old" value which
+        * does not exist in LDAP anymore. Thus the LDAP server would refuse
+        * the update.
+        * The existing LDAPMessage is still being auto-freed by the
+        * destructor.
+        */
+       pdb_set_backend_private_data(newpwd, NULL, NULL, my_methods,
+                                    PDB_CHANGED);
+
        if (!NT_STATUS_IS_OK(ret)) {
                return ret;
        }

Modified: trunk/source/passdb/pdb_ldap.c
===================================================================
--- trunk/source/passdb/pdb_ldap.c      2006-06-20 19:21:14 UTC (rev 16426)
+++ trunk/source/passdb/pdb_ldap.c      2006-06-20 20:05:39 UTC (rev 16427)
@@ -1797,6 +1797,19 @@
        ldap_mods_free(mods,True);
        SAFE_FREE(dn);
 
+       /*
+        * We need to set the backend private data to NULL here. For example
+        * setuserinfo level 25 does a pdb_update_sam_account twice on the
+        * same one, and with the explicit delete / add logic for attribute
+        * values the second time we would use the wrong "old" value which
+        * does not exist in LDAP anymore. Thus the LDAP server would refuse
+        * the update.
+        * The existing LDAPMessage is still being auto-freed by the
+        * destructor.
+        */
+       pdb_set_backend_private_data(newpwd, NULL, NULL, my_methods,
+                                    PDB_CHANGED);
+
        if (!NT_STATUS_IS_OK(ret)) {
                return ret;
        }

Reply via email to