summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 96a198a523..e92276b093 100644
--- a/source4/scripting/python/samba/netcmd/user.py
+++ b/source4/scripting/python/samba/netcmd/user.py
@@ -21,7 +21,7 @@
#
import samba.getopt as options
-import sys
+import sys, ldb
from getpass import getpass
from samba.auth import system_session
from samba.samdb import SamDB
@@ -258,7 +258,7 @@ class cmd_user_setpassword(Command):
password = getpass("New Password: ")
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)