1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

python samdb.newuser(): use user DN not samaccountname to set password

This is noticably faster in cases (e.g. tests) where the same user
is added and deleted many times.

The rreason is samaccountname is retained for deleted objects, so the
search finds multiple objects that need to be filtered out internally.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2018-02-02 10:35:25 +13:00 committed by Andrew Bartlett
parent a43dbb93ff
commit d8aa50b217

View File

@ -459,7 +459,9 @@ member: %s
# Sets the password for it
if setpassword:
self.setpassword("(samAccountName=%s)" % ldb.binary_encode(username), password,
self.setpassword(("(distinguishedName=%s)" %
ldb.binary_encode(user_dn)),
password,
force_password_change_at_next_login_req)
except:
self.transaction_cancel()