[PATCH 06/10] s4: fix problems
Matthieu Patou
mat at matws.net
Thu Nov 26 16:52:25 MST 2009
* transaction were not always started
* object where string when expcted to be int or ldb_message
---
source4/scripting/bin/upgradeprovision | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index 369ba74..78ed04a 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -45,7 +45,9 @@ import ldb
import samba.getopt as options
from samba.samdb import SamDB
from samba import param
-from samba.provision import ProvisionNames,provision_paths_from_lp,find_setup_dir,FILL_FULL,provision, get_domain_descriptor, get_config_descriptor
+from samba import glue
+from samba.provision import ProvisionNames,provision_paths_from_lp,find_setup_dir,FILL_FULL,provision, get_domain_descriptor, get_config_descriptor, secretsdb_self_join
+from samba.provisionexceptions import ProvisioningError
from samba.schema import get_dnsyntax_attributes, get_linked_attributes, Schema, get_schema_descriptor
from samba.dcerpc import misc, security
from samba.ndr import ndr_pack, ndr_unpack
@@ -697,15 +699,14 @@ def update_machine_account_password(newpaths,paths,creds,session,names):
secrets_ldb.transaction_start()
secrets_msg = secrets_ldb.search(expression=("samAccountName=%s$" % names.netbiosname), attrs=["secureChannelType"])
sam_ldb = Ldb(paths.samdb, session_info=session, credentials=creds,lp=lp)
- if secrets_msg[0]["secureChannelType"][0] == SEC_CHAN_BDC:
- sam_ldb.transaction_start()
+ sam_ldb.transaction_start()
+ if int(secrets_msg[0]["secureChannelType"][0]) == SEC_CHAN_BDC:
res = sam_ldb.search(expression=("samAccountName=%s$" % names.netbiosname), attrs=[])
assert(len(res) == 1)
msg = ldb.Message(res[0].dn)
- machinepass = msg["userPassword"] = glue.generate_random_str(12)
- for el in msg:
- el.set_flags(ldb.FLAG_MOD_REPLACE)
+ machinepass = glue.generate_random_str(12)
+ msg["userPassword"] = ldb.MessageElement("userPassword", ldb.FLAG_MOD_REPLACE, "userPassword")
sam_ldb.modify(msg)
res = sam_ldb.search(expression=("samAccountName=%s$" % names.netbiosname),
--
1.6.3.3
--------------000902080109040405080503
Content-Type: text/x-patch;
name="0007-s4-add-possibleInferiors-to-the-list-of-not-updated-.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0007-s4-add-possibleInferiors-to-the-list-of-not-updated-.pa";
filename*1="tch"
More information about the samba-technical
mailing list