From 03f92508ef2ebb4e7790f612e3f833382c691051 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 28 Jul 2011 17:14:28 +1000 Subject: 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 Pair-Programmed-With: Amitay Isaacs --- source4/scripting/python/samba/join.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/scripting/python/samba/join.py') diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py index b586e2cd5b0..4495b527b93 100644 --- a/source4/scripting/python/samba/join.py +++ b/source4/scripting/python/samba/join.py @@ -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) -- cgit