use a base64 encoded password when changing passwords
authorAndrew Tridgell <tridge@samba.org>
Thu, 12 Mar 2009 04:20:25 +0000 (15:20 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 12 Mar 2009 04:20:25 +0000 (15:20 +1100)
This avoids problems with embedded control characters in password
changes

source4/scripting/python/samba/samdb.py

index 1c5a8dfcde7592d12db77da8b7698d2721bc5de6..b92a91e2ef562a8cffa0004581a2331254bc3d6f 100644 (file)
@@ -28,6 +28,7 @@ import ldb
 from samba.idmap import IDmapDB
 import pwd
 import time
+import base64
 
 __docformat__ = "restructuredText"
 
@@ -178,8 +179,8 @@ userAccountControl: %u
 dn: %s
 changetype: modify
 replace: userPassword
-userPassword: %s
-""" % (user_dn, password)
+userPassword:: %s
+""" % (user_dn, base64.b64encode(password))
 
             self.modify_ldif(setpw)