s4: Let the "setpassword" script finally use the "samdb_set_password" routine
[ira/wip.git] / source4 / scripting / python / samba / samdb.py
index a58d6c5b12473ba32126a38fafda460d1ac22110..b78c8f37d93913cedd9faca6357562d873e001a1 100644 (file)
@@ -161,14 +161,14 @@ pwdLastSet: 0
             assert(len(res) == 1)
             user_dn = res[0].dn
 
             assert(len(res) == 1)
             user_dn = res[0].dn
 
-            setpw = """
-dn: %s
-changetype: modify
-replace: userPassword
-userPassword:: %s
-""" % (user_dn, base64.b64encode(password))
+            mod = ldb.Message()
+            mod.dn = user_dn
+
+            glue.samdb_set_password(samdb=self, user_dn=str(user_dn),
+                        dom_dn=self.domain_dn(), mod=mod, new_password=password,
+                        user_change=True)
 
 
-            self.modify_ldif(setpw)
+            self.modify(mod)
 
             if force_password_change_at_next_login:
                 self.force_password_change_at_next_login(user_dn)
 
             if force_password_change_at_next_login:
                 self.force_password_change_at_next_login(user_dn)