r16427: Fix bug # 3848. Thanks to Wilco Baan Hofman for testing the release candidate!
authorVolker Lendecke <vlendec@samba.org>
Tue, 20 Jun 2006 20:05:39 +0000 (20:05 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:18:53 +0000 (11:18 -0500)
Volker
(This used to be commit adf2dcce09ae29a8c1677b25e1cd5f022b804d01)

source3/passdb/pdb_ldap.c

index 2a824c137f9bc6cc878032e2117cc682a451f708..4a9794e18615fe9677cb9fdacb76fcba42162e63 100644 (file)
@@ -1796,6 +1796,19 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, struc
        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;
        }