diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-07-28 17:14:28 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-07-29 18:17:44 +1000 |
commit | 03f92508ef2ebb4e7790f612e3f833382c691051 (patch) | |
tree | 74c7d7cf500e7861547c620035c68f4c80128a72 /source4/scripting/python/samba/netcmd/delegation.py | |
parent | 8dda0ef57fa908c94c14d2521ded883ceb253b2f (diff) | |
download | samba-03f92508ef2ebb4e7790f612e3f833382c691051.tar.gz samba-03f92508ef2ebb4e7790f612e3f833382c691051.tar.xz samba-03f92508ef2ebb4e7790f612e3f833382c691051.zip |
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>
Diffstat (limited to 'source4/scripting/python/samba/netcmd/delegation.py')
-rw-r--r-- | source4/scripting/python/samba/netcmd/delegation.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source4/scripting/python/samba/netcmd/delegation.py b/source4/scripting/python/samba/netcmd/delegation.py index 1980203f9d8..9aa8287785c 100644 --- a/source4/scripting/python/samba/netcmd/delegation.py +++ b/source4/scripting/python/samba/netcmd/delegation.py @@ -72,7 +72,7 @@ class cmd_delegation_show(Command): # to the correct domain (cleanedaccount, realm, domain) = _get_user_realm_domain(accountname) print "Searching for: %s" % (cleanedaccount) - res = sam.search(expression="sAMAccountName=%s" % cleanedaccount, + res = sam.search(expression="sAMAccountName=%s" % ldb.binary_encode(cleanedaccount), scope=ldb.SCOPE_SUBTREE, attrs=["userAccountControl", "msDS-AllowedToDelegateTo"]) if len(res) != 1: @@ -122,7 +122,7 @@ class cmd_delegation_for_any_service(Command): # to the correct domain (cleanedaccount, realm, domain) = _get_user_realm_domain(accountname) - search_filter = "sAMAccountName=%s" % cleanedaccount + search_filter = "sAMAccountName=%s" % ldb.binary_encode(cleanedaccount) flag = dsdb.UF_TRUSTED_FOR_DELEGATION try: sam.toggle_userAccountFlags(search_filter, flag, on=on, strict=True) @@ -154,7 +154,7 @@ class cmd_delegation_for_any_protocol(Command): # to the correct domain (cleanedaccount, realm, domain) = _get_user_realm_domain(accountname) - search_filter = "sAMAccountName=%s" % cleanedaccount + search_filter = "sAMAccountName=%s" % ldb.binary_encode(cleanedaccount) flag = dsdb.UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION try: sam.toggle_userAccountFlags(search_filter, flag, on=on, strict=True) @@ -178,7 +178,7 @@ class cmd_delegation_add_service(Command): # to the correct domain (cleanedaccount, realm, domain) = _get_user_realm_domain(accountname) - res = sam.search(expression="sAMAccountName=%s" % cleanedaccount, + res = sam.search(expression="sAMAccountName=%s" % ldb.binary_encode(cleanedaccount), scope=ldb.SCOPE_SUBTREE, attrs=["msDS-AllowedToDelegateTo"]) if len(res) != 1: @@ -211,7 +211,7 @@ class cmd_delegation_del_service(Command): # to the correct domain (cleanedaccount, realm, domain) = _get_user_realm_domain(accountname) - res = sam.search(expression="sAMAccountName=%s" % cleanedaccount, + res = sam.search(expression="sAMAccountName=%s" % ldb.binary_encode(cleanedaccount), scope=ldb.SCOPE_SUBTREE, attrs=["msDS-AllowedToDelegateTo"]) if len(res) != 1: |