From 4291e28a938695593dd90a30d3c2e49defba3e8b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 25 Jan 2010 15:17:56 +0100 Subject: s4-python: Fix formatting. --- source4/scripting/python/samba/provision.py | 41 ++++++++++------------ source4/scripting/python/samba/provisionbackend.py | 13 ++++--- source4/scripting/python/samba/upgrade.py | 6 ++-- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 036890d45d..58c172fc0f 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -27,36 +27,31 @@ from base64 import b64encode import os -import sys import pwd import grp import time -import uuid, glue +import uuid import socket import param import registry -import samba -import subprocess -import ldb +import urllib +import ldb -from auth import system_session, admin_session -from samba import version, Ldb, substitute_var, valid_netbios_name, setup_file -from samba import check_all_substituted, read_and_sub_file -from samba import DS_DOMAIN_FUNCTION_2003, DS_DOMAIN_FUNCTION_2008, DS_DC_FUNCTION_2008 -from samba.samdb import SamDB -from samba.idmap import IDmapDB +from samba.auth import system_session, admin_session +from samba import glue, version, Ldb, substitute_var, valid_netbios_name +from samba import check_all_substituted, read_and_sub_file, setup_file +from samba import DS_DOMAIN_FUNCTION_2003, DS_DC_FUNCTION_2008 from samba.dcerpc import security -from samba.ntacls import setntacl,dsacl2fsacl +from samba.dcerpc.misc import SEC_CHAN_BDC, SEC_CHAN_WKSTA +from samba.idmap import IDmapDB +from samba.ntacls import setntacl, dsacl2fsacl from samba.ndr import ndr_pack,ndr_unpack -import urllib -from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError +from samba.schema import Schema from ms_display_specifiers import read_ms_ldif -from schema import Schema -from provisionbackend import LDBBackend, ExistingBackend, FDSBackend, OpenLDAPBackend +from samba.provisionbackend import LDBBackend, ExistingBackend, FDSBackend, OpenLDAPBackend from provisionexceptions import ProvisioningError, InvalidNetbiosName -from signal import SIGTERM -from dcerpc.misc import SEC_CHAN_BDC, SEC_CHAN_WKSTA + __docformat__ = "restructuredText" def find_setup_dir(): @@ -626,13 +621,13 @@ def secretsdb_self_join(secretsdb, domain, res = secretsdb.search(base="cn=Primary Domains", attrs=attrs, expression=("(&(|(flatname=%s)(realm=%s)(objectSid=%s))(objectclass=primaryDomain))" % (domain, realm, str(domainsid))), - scope=SCOPE_ONELEVEL) + scope=ldb.SCOPE_ONELEVEL) for del_msg in res: if del_msg.dn is not msg.dn: secretsdb.delete(del_msg.dn) - res = secretsdb.search(base=msg.dn, attrs=attrs, scope=SCOPE_BASE) + res = secretsdb.search(base=msg.dn, attrs=attrs, scope=ldb.SCOPE_BASE) if len(res) == 1: msg["priorSecret"] = res[0]["secret"] @@ -816,7 +811,7 @@ def setup_self_join(samdb, names, # add the NTDSGUID based SPNs ntds_dn = "CN=NTDS Settings,CN=%s,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,%s" % (names.hostname, names.domaindn) names.ntdsguid = samdb.searchone(basedn=ntds_dn, attribute="objectGUID", - expression="", scope=SCOPE_BASE) + expression="", scope=ldb.SCOPE_BASE) assert isinstance(names.ntdsguid, str) # Setup fSMORoleOwner entries to point at the newly created DC entry @@ -1044,7 +1039,7 @@ def setup_samdb(path, setup_path, session_info, provision_backend, lp, ntds_dn = "CN=NTDS Settings,CN=%s,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,%s" % (names.hostname, names.domaindn) names.ntdsguid = samdb.searchone(basedn=ntds_dn, - attribute="objectGUID", expression="", scope=SCOPE_BASE) + attribute="objectGUID", expression="", scope=ldb.SCOPE_BASE) assert isinstance(names.ntdsguid, str) except: @@ -1094,7 +1089,7 @@ def setsysvolacl(samdb,names,netlogon,sysvol,gid,domainsid,lp): set_gpo_acl(policy_path,dsacl2fsacl(acl,str(domainsid)),lp,str(domainsid)) res = samdb.search(base="CN=Policies,CN=System,%s"%(names.domaindn), attrs=["cn","nTSecurityDescriptor"], - expression="", scope=SCOPE_ONELEVEL) + expression="", scope=ldb.SCOPE_ONELEVEL) for policy in res: acl = ndr_unpack(security.descriptor,str(policy["nTSecurityDescriptor"])).as_sddl() policy_path = os.path.join(sysvol, names.dnsdomain, "Policies", diff --git a/source4/scripting/python/samba/provisionbackend.py b/source4/scripting/python/samba/provisionbackend.py index 8241ed69ff..3dff6eded4 100644 --- a/source4/scripting/python/samba/provisionbackend.py +++ b/source4/scripting/python/samba/provisionbackend.py @@ -33,15 +33,14 @@ import uuid import time import shutil import subprocess - -from samba import read_and_sub_file -from samba import Ldb import urllib + from ldb import SCOPE_BASE, SCOPE_ONELEVEL, LdbError, timestring -from credentials import Credentials, DONT_USE_KERBEROS -from samba import setup_file -from schema import Schema -from provisionexceptions import ProvisioningError + +from samba import Ldb, read_and_sub_file, setup_file +from samba.credentials import Credentials, DONT_USE_KERBEROS +from samba.schema import Schema +from samba.provisionexceptions import ProvisioningError def setup_db_config(setup_path, dbdir): """Setup a Berkeley database. diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py index 29f2f7cc9d..a2c78de4cf 100644 --- a/source4/scripting/python/samba/upgrade.py +++ b/source4/scripting/python/samba/upgrade.py @@ -9,14 +9,14 @@ __docformat__ = "restructuredText" -from provision import provision import grp import ldb import time import pwd -import registry -from samba import Ldb + +from samba import Ldb, registry from samba.param import LoadParm +from samba.provision import provision def import_sam_policy(samldb, policy, dn): """Import a Samba 3 policy database.""" -- cgit