samba-tool: fixed binary encoding of usernames in setpassword
authorAndrew Tridgell <tridge@samba.org>
Thu, 28 Jul 2011 07:03:57 +0000 (17:03 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 29 Jul 2011 08:17:44 +0000 (18:17 +1000)
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/scripting/python/samba/netcmd/user.py

index 96a198a5235c77d468b41b582fce7b91226a5894..e92276b093b30f79c0311c2cca52e8c035f8bce1 100644 (file)
@@ -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)