summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/__init__.py2
-rw-r--r--source4/scripting/python/samba/dbchecker.py8
-rw-r--r--source4/scripting/python/samba/drs_utils.py2
-rw-r--r--source4/scripting/python/samba/kcc_utils.py46
-rw-r--r--source4/scripting/python/samba/ms_schema.py34
-rw-r--r--source4/scripting/python/samba/netcmd/__init__.py2
-rw-r--r--source4/scripting/python/samba/netcmd/delegation.py6
-rw-r--r--source4/scripting/python/samba/netcmd/domain.py20
-rw-r--r--source4/scripting/python/samba/netcmd/fsmo.py2
-rw-r--r--source4/scripting/python/samba/netcmd/gpo.py4
-rw-r--r--source4/scripting/python/samba/netcmd/ldapcmp.py7
-rw-r--r--source4/scripting/python/samba/netcmd/ntacl.py18
-rw-r--r--source4/scripting/python/samba/netcmd/spn.py14
-rw-r--r--source4/scripting/python/samba/ntacls.py18
-rw-r--r--source4/scripting/python/samba/provision/__init__.py4
-rw-r--r--source4/scripting/python/samba/provision/backend.py2
-rw-r--r--source4/scripting/python/samba/schema.py8
-rw-r--r--source4/scripting/python/samba/tests/auth.py4
-rw-r--r--source4/scripting/python/samba/tests/core.py4
-rw-r--r--source4/scripting/python/samba/tests/credentials.py6
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/bare.py12
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/registry.py2
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/unix.py2
-rw-r--r--source4/scripting/python/samba/tests/dns.py4
-rw-r--r--source4/scripting/python/samba/tests/gensec.py8
-rw-r--r--source4/scripting/python/samba/tests/provision.py2
-rw-r--r--source4/scripting/python/samba/tests/samba3.py4
-rw-r--r--source4/scripting/python/samba/tests/samba3sam.py132
-rw-r--r--source4/scripting/python/samba/tests/samba_tool/ntacl.py8
-rw-r--r--source4/scripting/python/samba/tests/samdb.py10
-rw-r--r--source4/scripting/python/samba/tests/upgradeprovision.py2
-rw-r--r--source4/scripting/python/samba/tests/xattr.py2
-rw-r--r--source4/scripting/python/samba/upgrade.py6
-rw-r--r--source4/scripting/python/samba/upgradehelpers.py12
34 files changed, 207 insertions, 210 deletions
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py
index 23c6ed77d74..cd2a309fc0a 100644
--- a/source4/scripting/python/samba/__init__.py
+++ b/source4/scripting/python/samba/__init__.py
@@ -105,7 +105,7 @@ class Ldb(_Ldb):
# Allow admins to force non-sync ldb for all databases
if lp is not None:
nosync_p = lp.get("nosync", "ldb")
- if nosync_p is not None and nosync_p == True:
+ if nosync_p is not None and nosync_p:
flags |= ldb.FLG_NOSYNC
self.set_create_perms(0600)
diff --git a/source4/scripting/python/samba/dbchecker.py b/source4/scripting/python/samba/dbchecker.py
index a6495fc8e11..e1be6c4faa4 100644
--- a/source4/scripting/python/samba/dbchecker.py
+++ b/source4/scripting/python/samba/dbchecker.py
@@ -380,8 +380,8 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
m = ldb.Message()
m.dn = obj.dn
m['lastKnownParent'] = ldb.MessageElement(str(obj.dn.parent()), ldb.FLAG_MOD_REPLACE, 'lastKnownParent')
-
- if self.do_modify(m, [],
+
+ if self.do_modify(m, [],
"Failed to set lastKnownParent on lostAndFound object at %s" % (new_dn + lost_and_found)):
self.report("Set lastKnownParent on lostAndFound object at %s" % (new_dn + lost_and_found))
keep_transaction = True
@@ -473,7 +473,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
if is_deleted and not target_is_deleted and reverse_link_name is not None:
revealed_dn = self.find_revealed_link(obj.dn, attrname, guid)
rmd_flags = revealed_dn.dn.get_extended_component("RMD_FLAGS")
- if rmd_flags != None and (int(rmd_flags) & 1) == 0:
+ if rmd_flags is not None and (int(rmd_flags) & 1) == 0:
# the RMD_FLAGS for this link should be 1, as the target is deleted
self.err_incorrect_rmd_flags(obj, attrname, revealed_dn)
continue
@@ -551,7 +551,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
return True
if dn == self.rid_dn:
return True
-
+
return False
def calculate_instancetype(self, dn):
diff --git a/source4/scripting/python/samba/drs_utils.py b/source4/scripting/python/samba/drs_utils.py
index 09f30541c77..481eec29202 100644
--- a/source4/scripting/python/samba/drs_utils.py
+++ b/source4/scripting/python/samba/drs_utils.py
@@ -246,7 +246,7 @@ class drs_Replicate(object):
while True:
(level, ctr) = self.drs.DsGetNCChanges(self.drs_handle, req_level, req)
- if ctr.first_object == None and ctr.object_count != 0:
+ if ctr.first_object is None and ctr.object_count != 0:
raise RuntimeError("DsGetNCChanges: NULL first_object with object_count=%u" % (ctr.object_count))
self.net.replicate_chunk(self.replication_state, level, ctr,
schema=schema, req_level=req_level, req=req)
diff --git a/source4/scripting/python/samba/kcc_utils.py b/source4/scripting/python/samba/kcc_utils.py
index 281479bd6b5..57c31876a69 100644
--- a/source4/scripting/python/samba/kcc_utils.py
+++ b/source4/scripting/python/samba/kcc_utils.py
@@ -73,7 +73,7 @@ class NamingContext(object):
scope=ldb.SCOPE_BASE, attrs=attrs)
except ldb.LdbError, (enum, estr):
- raise Exception("Unable to find naming context (%s)" % \
+ raise Exception("Unable to find naming context (%s)" %
(self.nc_dnstr, estr))
msg = res[0]
if "objectGUID" in msg:
@@ -213,7 +213,7 @@ class NCReplica(NamingContext):
def set_instantiated_flags(self, flags=None):
'''Set or clear NC replica instantiated flags'''
- if (flags == None):
+ if flags is None:
self.rep_instantiated_flags = 0
else:
self.rep_instantiated_flags = flags
@@ -337,7 +337,7 @@ class NCReplica(NamingContext):
# replacement list. Build a list
# of to be deleted reps which we will
# remove from rep_repsFrom list below
- if repsFrom.to_be_deleted == True:
+ if repsFrom.to_be_deleted:
delreps.append(repsFrom)
modify = True
continue
@@ -361,7 +361,7 @@ class NCReplica(NamingContext):
# need to be deleted or input option has informed
# us to be "readonly" (ro). Leave database
# record "as is"
- if modify == False or ro == True:
+ if not modify or ro:
return
m = ldb.Message()
@@ -380,7 +380,7 @@ class NCReplica(NamingContext):
def dumpstr_to_be_deleted(self):
text=""
for repsFrom in self.rep_repsFrom:
- if repsFrom.to_be_deleted == True:
+ if repsFrom.to_be_deleted:
if text:
text = text + "\n%s" % repsFrom
else:
@@ -390,7 +390,7 @@ class NCReplica(NamingContext):
def dumpstr_to_be_modified(self):
text=""
for repsFrom in self.rep_repsFrom:
- if repsFrom.is_modified() == True:
+ if repsFrom.is_modified():
if text:
text = text + "\n%s" % repsFrom
else:
@@ -948,13 +948,13 @@ class NTDSConnection(object):
self.to_be_deleted = False
# No database modification requested
- if ro == True:
+ if ro:
return
try:
samdb.delete(self.dnstr)
except ldb.LdbError, (enum, estr):
- raise Exception("Could not delete nTDSConnection for (%s) - (%s)" % \
+ raise Exception("Could not delete nTDSConnection for (%s) - (%s)" %
(self.dnstr, estr))
def commit_added(self, samdb, ro=False):
@@ -966,7 +966,7 @@ class NTDSConnection(object):
self.to_be_added = False
# No database modification requested
- if ro == True:
+ if ro:
return
# First verify we don't have this entry to ensure nothing
@@ -979,10 +979,10 @@ class NTDSConnection(object):
except ldb.LdbError, (enum, estr):
if enum != ldb.ERR_NO_SUCH_OBJECT:
- raise Exception("Unable to search for (%s) - (%s)" % \
+ raise Exception("Unable to search for (%s) - (%s)" %
(self.dnstr, estr))
if found:
- raise Exception("nTDSConnection for (%s) already exists!" % \
+ raise Exception("nTDSConnection for (%s) already exists!" %
self.dnstr)
if self.enabled:
@@ -995,10 +995,10 @@ class NTDSConnection(object):
m.dn = ldb.Dn(samdb, self.dnstr)
m["objectClass"] = \
- ldb.MessageElement("nTDSConnection", ldb.FLAG_MOD_ADD, \
+ ldb.MessageElement("nTDSConnection", ldb.FLAG_MOD_ADD,
"objectClass")
m["showInAdvancedViewOnly"] = \
- ldb.MessageElement("TRUE", ldb.FLAG_MOD_ADD, \
+ ldb.MessageElement("TRUE", ldb.FLAG_MOD_ADD,
"showInAdvancedViewOnly")
m["enabledConnection"] = \
ldb.MessageElement(enablestr, ldb.FLAG_MOD_ADD, "enabledConnection")
@@ -1007,12 +1007,12 @@ class NTDSConnection(object):
m["options"] = \
ldb.MessageElement(str(self.options), ldb.FLAG_MOD_ADD, "options")
m["systemFlags"] = \
- ldb.MessageElement(str(self.system_flags), ldb.FLAG_MOD_ADD, \
+ ldb.MessageElement(str(self.system_flags), ldb.FLAG_MOD_ADD,
"systemFlags")
if self.transport_dnstr is not None:
m["transportType"] = \
- ldb.MessageElement(str(self.transport_dnstr), ldb.FLAG_MOD_ADD, \
+ ldb.MessageElement(str(self.transport_dnstr), ldb.FLAG_MOD_ADD,
"transportType")
if self.schedule is not None:
@@ -1022,7 +1022,7 @@ class NTDSConnection(object):
try:
samdb.add(m)
except ldb.LdbError, (enum, estr):
- raise Exception("Could not add nTDSConnection for (%s) - (%s)" % \
+ raise Exception("Could not add nTDSConnection for (%s) - (%s)" %
(self.dnstr, estr))
def commit_modified(self, samdb, ro=False):
@@ -1034,7 +1034,7 @@ class NTDSConnection(object):
self.to_be_modified = False
# No database modification requested
- if ro == True:
+ if ro:
return
# First verify we have this entry to ensure nothing
@@ -1047,9 +1047,9 @@ class NTDSConnection(object):
if enum == ldb.ERR_NO_SUCH_OBJECT:
found = False
else:
- raise Exception("Unable to search for (%s) - (%s)" % \
+ raise Exception("Unable to search for (%s) - (%s)" %
(self.dnstr, estr))
- if found == False:
+ if not found:
raise Exception("nTDSConnection for (%s) doesn't exist!" %
self.dnstr)
@@ -1143,7 +1143,7 @@ class NTDSConnection(object):
sched.headerArray[i].offset:
return False
- for a, b in zip(self.schedule.dataArray[i].slots, \
+ for a, b in zip(self.schedule.dataArray[i].slots,
sched.dataArray[i].slots):
if a != b:
return False
@@ -1617,7 +1617,7 @@ class Site(object):
# If readonly database then do not perform a
# persistent update
- if ro == True:
+ if ro:
return True
# Perform update to the samdb
@@ -1767,7 +1767,7 @@ class GraphNode(object):
# the DC on which ri "is present".
#
# c.options does not contain NTDSCONN_OPT_RODC_TOPOLOGY
- if connect and connect.is_rodc_topology() == False:
+ if connect and not connect.is_rodc_topology():
exists = True
else:
exists = False
@@ -2157,7 +2157,7 @@ class Vertex(object):
# We have a full replica which is the largest
# value so exit
- if rep.is_partial() == False:
+ if not rep.is_partial():
self.color = VertexColor.red
break
else:
diff --git a/source4/scripting/python/samba/ms_schema.py b/source4/scripting/python/samba/ms_schema.py
index 6f7cc67b127..c16693c9b5a 100644
--- a/source4/scripting/python/samba/ms_schema.py
+++ b/source4/scripting/python/samba/ms_schema.py
@@ -28,7 +28,7 @@ bitFields = {}
bitFields["searchflags"] = {
'fATTINDEX': 31, # IX
'fPDNTATTINDEX': 30, # PI
- 'fANR': 29, #AR
+ 'fANR': 29, # AR
'fPRESERVEONDELETE': 28, # PR
'fCOPY': 27, # CP
'fTUPLEINDEX': 26, # TP
@@ -85,7 +85,7 @@ multivalued_attrs = set(["auxiliaryclass","maycontain","mustcontain","posssuperi
def __read_folded_line(f, buffer):
""" reads a line from an LDIF file, unfolding it"""
line = buffer
-
+
while True:
l = f.readline()
@@ -98,7 +98,7 @@ def __read_folded_line(f, buffer):
# preserves '\n '
line = line + l
else:
- # non-continued line
+ # non-continued line
if line == "":
line = l
@@ -111,7 +111,7 @@ def __read_folded_line(f, buffer):
# buffer contains the start of the next possibly folded line
buffer = l
break
-
+
return (line, buffer)
@@ -122,13 +122,13 @@ def __read_raw_entries(f):
attr_type_re = re.compile("^([A-Za-z]+[A-Za-z0-9-]*):")
buffer = ""
-
+
while True:
entry = []
-
+
while True:
(l, buffer) = __read_folded_line(f, buffer)
-
+
if l[:1] == "#":
continue
@@ -140,7 +140,7 @@ def __read_raw_entries(f):
if m:
if l[-1:] == "\n":
l = l[:-1]
-
+
entry.append(l)
else:
print >>sys.stderr, "Invalid line: %s" % l,
@@ -170,7 +170,7 @@ def __convert_bitfield(key, value):
value = value.replace("\n ", "")
value = value.replace(" ", "")
-
+
try:
# some attributes already have numeric values
o = int(value)
@@ -186,7 +186,7 @@ def __convert_bitfield(key, value):
def __write_ldif_one(entry):
"""Write out entry as LDIF"""
out = []
-
+
for l in entry:
if isinstance(l[1], str):
vl = [l[1]]
@@ -196,21 +196,21 @@ def __write_ldif_one(entry):
if l[0].lower() == 'omobjectclass':
out.append("%s:: %s" % (l[0], l[1]))
continue
-
+
for v in vl:
out.append("%s: %s" % (l[0], v))
return "\n".join(out)
-
+
def __transform_entry(entry, objectClass):
"""Perform transformations required to convert the LDIF-like schema
file entries to LDIF, including Samba-specific stuff."""
-
+
entry = [l.split(":", 1) for l in entry]
cn = ""
-
+
for l in entry:
key = l[0].lower()
l[1] = l[1].lstrip()
@@ -243,7 +243,7 @@ def __transform_entry(entry, objectClass):
entry.insert(2, ["objectGUID", str(uuid.uuid4())])
entry.insert(2, ["adminDescription", cn])
entry.insert(2, ["adminDisplayName", cn])
-
+
for l in entry:
key = l[0].lower()
@@ -256,7 +256,7 @@ def __parse_schema_file(filename, objectClass):
"""Load and transform a schema file."""
out = []
-
+
f = open(filename, "rU")
for entry in __read_raw_entries(f):
out.append(__write_ldif_one(__transform_entry(entry, objectClass)))
@@ -269,7 +269,7 @@ def read_ms_schema(attr_file, classes_file, dump_attributes = True, dump_classes
attr_ldif = ""
classes_ldif = ""
-
+
if dump_attributes:
attr_ldif = __parse_schema_file(attr_file, "attributeSchema")
if dump_classes:
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py
index 358167806a8..c542dc61f58 100644
--- a/source4/scripting/python/samba/netcmd/__init__.py
+++ b/source4/scripting/python/samba/netcmd/__init__.py
@@ -158,7 +158,7 @@ class Command(object):
undetermined_max_args = True
else:
max_args += 1
- if (len(args) < min_args) or (undetermined_max_args == False and len(args) > max_args):
+ if (len(args) < min_args) or (not undetermined_max_args and len(args) > max_args):
parser.print_usage()
return -1
diff --git a/source4/scripting/python/samba/netcmd/delegation.py b/source4/scripting/python/samba/netcmd/delegation.py
index 25ae2028c4a..8b2a1bcceff 100644
--- a/source4/scripting/python/samba/netcmd/delegation.py
+++ b/source4/scripting/python/samba/netcmd/delegation.py
@@ -56,7 +56,7 @@ class cmd_delegation_show(Command):
# to the correct domain
(cleanedaccount, realm, domain) = _get_user_realm_domain(accountname)
- res = sam.search(expression="sAMAccountName=%s" %
+ res = sam.search(expression="sAMAccountName=%s" %
ldb.binary_encode(cleanedaccount),
scope=ldb.SCOPE_SUBTREE,
attrs=["userAccountControl", "msDS-AllowedToDelegateTo"])
@@ -189,7 +189,7 @@ class cmd_delegation_add_service(Command):
# to the correct domain
(cleanedaccount, realm, domain) = _get_user_realm_domain(accountname)
- res = sam.search(expression="sAMAccountName=%s" %
+ res = sam.search(expression="sAMAccountName=%s" %
ldb.binary_encode(cleanedaccount),
scope=ldb.SCOPE_SUBTREE,
attrs=["msDS-AllowedToDelegateTo"])
@@ -233,7 +233,7 @@ class cmd_delegation_del_service(Command):
# to the correct domain
(cleanedaccount, realm, domain) = _get_user_realm_domain(accountname)
- res = sam.search(expression="sAMAccountName=%s" %
+ res = sam.search(expression="sAMAccountName=%s" %
ldb.binary_encode(cleanedaccount),
scope=ldb.SCOPE_SUBTREE,
attrs=["msDS-AllowedToDelegateTo"])
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py
index ba4165ac066..be591ea2571 100644
--- a/source4/scripting/python/samba/netcmd/domain.py
+++ b/source4/scripting/python/samba/netcmd/domain.py
@@ -173,9 +173,9 @@ class cmd_domain_provision(Command):
help="choose machine password (otherwise random)"),
Option("--dns-backend", type="choice", metavar="NAMESERVER-BACKEND",
choices=["SAMBA_INTERNAL", "BIND9_FLATFILE", "BIND9_DLZ", "NONE"],
- help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), " \
- "BIND9_FLATFILE uses bind9 text database to store zone information, " \
- "BIND9_DLZ uses samba4 AD to store zone information, " \
+ help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), "
+ "BIND9_FLATFILE uses bind9 text database to store zone information, "
+ "BIND9_DLZ uses samba4 AD to store zone information, "
"NONE skips the DNS setup entirely (not recommended)",
default="SAMBA_INTERNAL"),
Option("--dnspass", type="string", metavar="PASSWORD",
@@ -452,8 +452,8 @@ class cmd_domain_dcpromo(Command):
action="store_true"),
Option("--dns-backend", type="choice", metavar="NAMESERVER-BACKEND",
choices=["SAMBA_INTERNAL", "BIND9_DLZ", "NONE"],
- help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), " \
- "BIND9_DLZ uses samba4 AD to store zone information, " \
+ help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), "
+ "BIND9_DLZ uses samba4 AD to store zone information, "
"NONE skips the DNS setup entirely (this DC will not be a DNS server)",
default="SAMBA_INTERNAL")
]
@@ -518,8 +518,8 @@ class cmd_domain_join(Command):
action="store_true"),
Option("--dns-backend", type="choice", metavar="NAMESERVER-BACKEND",
choices=["SAMBA_INTERNAL", "BIND9_DLZ", "NONE"],
- help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), " \
- "BIND9_DLZ uses samba4 AD to store zone information, " \
+ help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), "
+ "BIND9_DLZ uses samba4 AD to store zone information, "
"NONE skips the DNS setup entirely (this DC will not be a DNS server)",
default="SAMBA_INTERNAL")
]
@@ -1223,9 +1223,9 @@ class cmd_domain_classicupgrade(Command):
action="store_true"),
Option("--dns-backend", type="choice", metavar="NAMESERVER-BACKEND",
choices=["SAMBA_INTERNAL", "BIND9_FLATFILE", "BIND9_DLZ", "NONE"],
- help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), " \
- "BIND9_FLATFILE uses bind9 text database to store zone information, " \
- "BIND9_DLZ uses samba4 AD to store zone information, " \
+ help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), "
+ "BIND9_FLATFILE uses bind9 text database to store zone information, "
+ "BIND9_DLZ uses samba4 AD to store zone information, "
"NONE skips the DNS setup entirely (this DC will not be a DNS server)",
default="SAMBA_INTERNAL")
]
diff --git a/source4/scripting/python/samba/netcmd/fsmo.py b/source4/scripting/python/samba/netcmd/fsmo.py
index 86c69492b4c..a6105882bb5 100644
--- a/source4/scripting/python/samba/netcmd/fsmo.py
+++ b/source4/scripting/python/samba/netcmd/fsmo.py
@@ -256,7 +256,7 @@ all=all of the above"""),
creds = credopts.get_credentials(lp, fallback_machine=True)
samdb = SamDB(url=H, session_info=system_session(),
- credentials=creds, lp=lp)
+ credentials=creds, lp=lp)
if role == "all":
transfer_role(self.outf, "rid", samdb)
diff --git a/source4/scripting/python/samba/netcmd/gpo.py b/source4/scripting/python/samba/netcmd/gpo.py
index d2d19e2b039..ee0de982b96 100644
--- a/source4/scripting/python/samba/netcmd/gpo.py
+++ b/source4/scripting/python/samba/netcmd/gpo.py
@@ -879,7 +879,7 @@ class cmd_create(Command):
Option("--tmpdir", help="Temporary directory for copying policy files", type=str)
]
- def run(self, displayname, H=None, tmpdir=None, sambaopts=None, credopts=None,
+ def run(self, displayname, H=None, tmpdir=None, sambaopts=None, credopts=None,
versionopts=None):
self.lp = sambaopts.get_loadparm()
@@ -926,7 +926,7 @@ class cmd_create(Command):
gpt_contents = "[General]\r\nVersion=0\r\n"
file(os.path.join(gpodir, "GPT.INI"), "w").write(gpt_contents)
except Exception, e:
- raise CommandError("Error Creating GPO files", e)
+ raise CommandError("Error Creating GPO files", e)
# Connect to DC over SMB
[dom_name, service, sharepath] = parse_unc(unc_path)
diff --git a/source4/scripting/python/samba/netcmd/ldapcmp.py b/source4/scripting/python/samba/netcmd/ldapcmp.py
index ea4f930eaff..d4a2dde53ed 100644
--- a/source4/scripting/python/samba/netcmd/ldapcmp.py
+++ b/source4/scripting/python/samba/netcmd/ldapcmp.py
@@ -28,14 +28,13 @@ import sys
import samba
import samba.getopt as options
from samba import Ldb
-from samba.ndr import ndr_pack, ndr_unpack
+from samba.ndr import ndr_unpack
from samba.dcerpc import security
from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, ERR_NO_SUCH_OBJECT, LdbError
from samba.netcmd import (
Command,
CommandError,
Option,
- SuperCommand,
)
global summary
@@ -103,7 +102,7 @@ class LDAPBase(object):
def find_servers(self):
"""
"""
- res = self.ldb.search(base="OU=Domain Controllers,%s" % self.base_dn, \
+ res = self.ldb.search(base="OU=Domain Controllers,%s" % self.base_dn,
scope=SCOPE_SUBTREE, expression="(objectClass=computer)", attrs=["cn"])
assert len(res) > 0
srv = []
@@ -112,7 +111,7 @@ class LDAPBase(object):
return srv
def find_netbios(self):
- res = self.ldb.search(base="CN=Partitions,%s" % self.config_dn, \
+ res = self.ldb.search(base="CN=Partitions,%s" % self.config_dn,
scope=SCOPE_SUBTREE, attrs=["nETBIOSName"])
assert len(res) > 0
for x in res:
diff --git a/source4/scripting/python/samba/netcmd/ntacl.py b/source4/scripting/python/samba/netcmd/ntacl.py
index e596ce9d700..edbcd7edc88 100644
--- a/source4/scripting/python/samba/netcmd/ntacl.py
+++ b/source4/scripting/python/samba/netcmd/ntacl.py
@@ -172,7 +172,7 @@ class cmd_ntacl_sysvolreset(Command):
netlogon = lp.get("path", "netlogon")
sysvol = lp.get("path", "sysvol")
try:
- samdb = SamDB(session_info=system_session(),
+ samdb = SamDB(session_info=system_session(),
lp=lp)
except Exception, e:
raise CommandError("Unable to open samdb:", e)
@@ -207,10 +207,10 @@ class cmd_ntacl_sysvolreset(Command):
if use_ntvfs:
logger.warning("Please note that POSIX permissions have NOT been changed, only the stored NT ACL")
-
+
provision.setsysvolacl(samdb, netlogon, sysvol,
- LA_uid, BA_gid, domain_sid,
- lp.get("realm").lower(), samdb.domain_dn(),
+ LA_uid, BA_gid, domain_sid,
+ lp.get("realm").lower(), samdb.domain_dn(),
lp, use_ntvfs=use_ntvfs)
class cmd_ntacl_sysvolcheck(Command):
@@ -223,8 +223,7 @@ class cmd_ntacl_sysvolcheck(Command):
"versionopts": options.VersionOptions,
}
- def run(self,
- credopts=None, sambaopts=None, versionopts=None):
+ def run(self, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
path = lp.private_path("secrets.ldb")
creds = credopts.get_credentials(lp)
@@ -234,16 +233,15 @@ class cmd_ntacl_sysvolcheck(Command):
netlogon = lp.get("path", "netlogon")
sysvol = lp.get("path", "sysvol")
try:
- samdb = SamDB(session_info=system_session(),
- lp=lp)
+ samdb = SamDB(session_info=system_session(), lp=lp)
except Exception, e:
raise CommandError("Unable to open samdb:", e)
domain_sid = security.dom_sid(samdb.domain_sid)
provision.checksysvolacl(samdb, netlogon, sysvol,
- domain_sid,
- lp.get("realm").lower(), samdb.domain_dn(),
+ domain_sid,
+ lp.get("realm").lower(), samdb.domain_dn(),
lp)
diff --git a/source4/scripting/python/samba/netcmd/spn.py b/source4/scripting/python/samba/netcmd/spn.py
index 79fa69912ef..564fd5920c6 100644
--- a/