mirror of
https://github.com/samba-team/samba.git
synced 2025-07-27 07:42:04 +03:00
samba-tool: use ldb.binary_encode() on search expression elements
this allows us to deal with search elements containing characters that must be escaped in LDAP Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
@ -147,7 +147,7 @@ class dc_join(object):
|
||||
# find the krbtgt link
|
||||
print("checking samaccountname")
|
||||
res = ctx.samdb.search(base=ctx.samdb.get_default_basedn(),
|
||||
expression='samAccountName=%s' % ctx.samname,
|
||||
expression='samAccountName=%s' % ldb.binary_encode(ctx.samname),
|
||||
attrs=["msDS-krbTgtLink"])
|
||||
if res:
|
||||
ctx.del_noerror(res[0].dn, recursive=True)
|
||||
@ -408,7 +408,7 @@ class dc_join(object):
|
||||
ctx.samdb.modify(m)
|
||||
|
||||
print "Setting account password for %s" % ctx.samname
|
||||
ctx.samdb.setpassword("(&(objectClass=user)(sAMAccountName=%s))" % ctx.samname,
|
||||
ctx.samdb.setpassword("(&(objectClass=user)(sAMAccountName=%s))" % ldb.binary_encode(ctx.samname),
|
||||
ctx.acct_pass,
|
||||
force_change_at_next_login=False,
|
||||
username=ctx.samname)
|
||||
|
Reference in New Issue
Block a user