summaryrefslogtreecommitdiff
path: root/source4/scripting/python/samba/netcmd/user.py
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-07-28 17:14:28 +1000
committerAndrew Tridgell <tridge@samba.org>2011-07-29 18:17:44 +1000
commit03f92508ef2ebb4e7790f612e3f833382c691051 (patch)
tree74c7d7cf500e7861547c620035c68f4c80128a72 /source4/scripting/python/samba/netcmd/user.py
parent8dda0ef57fa908c94c14d2521ded883ceb253b2f (diff)
downloadsamba-03f92508ef2ebb4e7790f612e3f833382c691051.tar.gz
samba-03f92508ef2ebb4e7790f612e3f833382c691051.tar.bz2
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/user.py')
-rw-r--r--source4/scripting/python/samba/netcmd/user.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py
index e92276b093b..88d93e3bea1 100644
--- a/source4/scripting/python/samba/netcmd/user.py
+++ b/source4/scripting/python/samba/netcmd/user.py
@@ -142,7 +142,7 @@ class cmd_user_enable(Command):
raise CommandError("Either the username or '--filter' must be specified!")
if filter is None:
- filter = "(&(objectClass=user)(sAMAccountName=%s))" % (username)
+ filter = "(&(objectClass=user)(sAMAccountName=%s))" % (ldb.binary_encode(username))
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp, fallback_machine=True)
@@ -178,7 +178,7 @@ class cmd_user_setexpiry(Command):
raise CommandError("Either the username or '--filter' must be specified!")
if filter is None:
- filter = "(&(objectClass=user)(sAMAccountName=%s))" % (username)
+ filter = "(&(objectClass=user)(sAMAccountName=%s))" % (ldb.binary_encode(username))
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)