diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-11-10 14:01:58 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-11-11 09:12:25 +0100 |
commit | 2403aaa7591e1827d91644579dbf503d8e9a7df6 (patch) | |
tree | 01c2289bad34ebfd51a9c4345430b42512aefe1e | |
parent | 7c59ecec5078c0ab8587bb322a228419f5a8c978 (diff) | |
download | samba-2403aaa7591e1827d91644579dbf503d8e9a7df6.tar.gz samba-2403aaa7591e1827d91644579dbf503d8e9a7df6.tar.bz2 samba-2403aaa7591e1827d91644579dbf503d8e9a7df6.zip |
s4:upgradehelpers.py - use "clearTextPassword" rather than "userPassword"
It's the default internal s4 password change attribute
-rwxr-xr-x | source4/scripting/python/samba/upgradehelpers.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source4/scripting/python/samba/upgradehelpers.py b/source4/scripting/python/samba/upgradehelpers.py index d8474dea14..b1258d2a53 100755 --- a/source4/scripting/python/samba/upgradehelpers.py +++ b/source4/scripting/python/samba/upgradehelpers.py @@ -27,6 +27,7 @@ import string import re import shutil import samba +import base64 from samba import Ldb, version, ntacls from samba.dsdb import DS_DOMAIN_FUNCTION_2000 @@ -827,12 +828,14 @@ def update_machine_account_password(samdb, secrets_ldb, names): res = samdb.search(expression=expression, attrs=[]) assert(len(res) == 1) - msg = ldb.Message(res[0].dn) machinepass = samba.generate_random_password(128, 255) - msg["userPassword"] = ldb.MessageElement(machinepass, - ldb.FLAG_MOD_REPLACE, - "userPassword") - samdb.modify(msg) + + samdb.modify_ldif(""" +dn: """ + str(res[0].dn) + """ +changetype: modify +replace: clearTextPassword +clearTextPassword:: """ + base64.b64encode(machinepass.encode('utf-16-le')) + """ +""") res = samdb.search(expression=("samAccountName=%s$" % names.netbiosname), attrs=["msDs-keyVersionNumber"]) |