mirror of
https://github.com/samba-team/samba.git
synced 2025-07-31 20:22:15 +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:
@ -52,7 +52,7 @@ class cmd_rodc_preload(Command):
|
||||
expression="objectclass=user",
|
||||
scope=ldb.SCOPE_BASE, attrs=[])
|
||||
else:
|
||||
res = samdb.search(expression="(&(samAccountName=%s)(objectclass=user))" % account,
|
||||
res = samdb.search(expression="(&(samAccountName=%s)(objectclass=user))" % ldb.binary_encode(account),
|
||||
scope=ldb.SCOPE_SUBTREE, attrs=[])
|
||||
if len(res) != 1:
|
||||
raise Exception("Failed to find account '%s'" % account)
|
||||
|
Reference in New Issue
Block a user