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/spn.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/spn.py')
-rw-r--r-- | source4/scripting/python/samba/netcmd/spn.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source4/scripting/python/samba/netcmd/spn.py b/source4/scripting/python/samba/netcmd/spn.py index e81cdce4f30..672f1401e9b 100644 --- a/source4/scripting/python/samba/netcmd/spn.py +++ b/source4/scripting/python/samba/netcmd/spn.py @@ -69,7 +69,7 @@ class cmd_spn_list(Command): # to the correct domain (cleaneduser, realm, domain) = _get_user_realm_domain(user) print cleaneduser - res = sam.search(expression="samaccountname=%s" % cleaneduser, + res = sam.search(expression="samaccountname=%s" % ldb.binary_encode(cleaneduser), scope=ldb.SCOPE_SUBTREE, attrs=["servicePrincipalName"]) if len(res) >0: @@ -102,7 +102,7 @@ class cmd_spn_add(Command): paths = provision.provision_paths_from_lp(lp, lp.get("realm")) sam = SamDB(paths.samdb, session_info=system_session(), credentials=creds, lp=lp) - res = sam.search(expression="servicePrincipalName=%s" % name, + res = sam.search(expression="servicePrincipalName=%s" % ldb.binary_encode(name), scope=ldb.SCOPE_SUBTREE, ) if len(res) != 0 and not force: @@ -110,7 +110,7 @@ class cmd_spn_add(Command): " affected to another user" % name) (cleaneduser, realm, domain) = _get_user_realm_domain(user) - res = sam.search(expression="samaccountname=%s" % cleaneduser, + res = sam.search(expression="samaccountname=%s" % ldb.binary_encode(cleaneduser), scope=ldb.SCOPE_SUBTREE, attrs=["servicePrincipalName"]) if len(res) >0: @@ -151,7 +151,7 @@ class cmd_spn_delete(Command): paths = provision.provision_paths_from_lp(lp, lp.get("realm")) sam = SamDB(paths.samdb, session_info=system_session(), credentials=creds, lp=lp) - res = sam.search(expression="servicePrincipalName=%s" % name, + res = sam.search(expression="servicePrincipalName=%s" % ldb.binary_encode(name), scope=ldb.SCOPE_SUBTREE, attrs=["servicePrincipalName", "samAccountName"]) if len(res) >0: |