[PATCH 2/2] upgradeprovision: code cleanup

Matthieu Patou mat at matws.net
Sun Jan 31 12:08:17 MST 2010


---
 source4/scripting/bin/upgradeprovision |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index 2c06007..7b7c339 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -39,7 +39,7 @@ sys.path.insert(0, "bin/python")
 import samba
 from samba.credentials import DONT_USE_KERBEROS
 from samba.auth import system_session, admin_session
-from samba import Ldb 
+from samba import Ldb
 from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError
 import ldb
 import samba.getopt as options
@@ -165,7 +165,8 @@ def populate_backlink(newpaths,creds,session,schemadn):
 # Create an array of  attributes with a dn synthax (2.5.5.1)
 def populate_dnsyntax(newpaths,creds,session,schemadn):
 	newsam_ldb = Ldb(newpaths.samdb, session_info=session, credentials=creds,lp=lp)
-	res = newsam_ldb.search(expression="(attributeSyntax=2.5.5.1)",base=ldb.Dn(newsam_ldb,str(schemadn)), scope=SCOPE_SUBTREE, attrs=["lDAPDisplayName"])
+	res = newsam_ldb.search(expression="(attributeSyntax=2.5.5.1)",base=ldb.Dn(newsam_ldb,str(schemadn)),
+							scope=SCOPE_SUBTREE, attrs=["lDAPDisplayName"])
 	for elem in res:
 		dn_syntax_att.append(elem["lDAPDisplayName"])
 
@@ -175,7 +176,8 @@ def sanitychecks(credentials,session_info,names,paths):
 	sam_ldb = Ldb(paths.samdb, session_info=session, credentials=creds,lp=lp,options=["modules:samba_dsdb"])
 	# First update the SD for the rootdn
 	sam_ldb.set_session_info(session)
-	res = sam_ldb.search(expression="objectClass=ntdsdsa",base=str(names.configdn), scope=SCOPE_SUBTREE,attrs=["dn"],controls=["search_options:1:2"])
+	res = sam_ldb.search(expression="objectClass=ntdsdsa",base=str(names.configdn),
+						 scope=SCOPE_SUBTREE,attrs=["dn"],controls=["search_options:1:2"])
 	if len(res) == 0:
 		print "No DC found, your provision is most probalby hardly broken !"
 		return 0
@@ -231,7 +233,8 @@ def handle_security_desc(ischema,att,msgElt,hashallSD,old,new):
 # It can be also if we want to do a merge of value instead of a simple replace
 def handle_special_case(att,delta,new,old,ischema):
 	flag = delta.get(att).flags()
-	if (att == "gPLink" or att == "gPCFileSysPath") and flag ==  ldb.FLAG_MOD_REPLACE and str(new[0].dn).lower() == str(old[0].dn).lower():
+	if (att == "gPLink" or att == "gPCFileSysPath") and \
+		flag ==  ldb.FLAG_MOD_REPLACE and str(new[0].dn).lower() == str(old[0].dn).lower():
 		delta.remove(att)
 		return 1
 	if att == "forceLogoff":
@@ -242,10 +245,9 @@ def handle_special_case(att,delta,new,old,ischema):
 		return 1
 	if (att == "adminDisplayName" or att == "adminDescription") and ischema:
 		return 1
-	if (str(old[0].dn) == "CN=Samba4-Local-Domain,%s"%(str(names.schemadn)) and att == "defaultObjectCategory" and flag  == ldb.FLAG_MOD_REPLACE):
+	if (str(old[0].dn) == "CN=Samba4-Local-Domain,%s"%(str(names.schemadn))\
+		and att == "defaultObjectCategory" and flag  == ldb.FLAG_MOD_REPLACE):
 		return 1
-#	if (str(old[0].dn) == "CN=S-1-5-11,CN=ForeignSecurityPrincipals,%s"%(str(names.rootdn)) and att == "description" and flag  == ldb.FLAG_MOD_DELETE):
-#		return 1
 	if (str(old[0].dn) == "CN=Title,%s"%(str(names.schemadn)) and att == "rangeUpper" and flag  == ldb.FLAG_MOD_REPLACE):
 		return 1
 	if ( (att == "member" or att == "servicePrincipalName") and flag  == ldb.FLAG_MOD_REPLACE):
-- 
1.6.3.3


--------------050003050502050904000904--


More information about the samba-technical mailing list