PEP8: fix E128: continuation line under-indented for visual indent
authorJoe Guo <joeg@catalyst.net.nz>
Mon, 30 Jul 2018 06:16:12 +0000 (18:16 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Fri, 24 Aug 2018 05:49:27 +0000 (07:49 +0200)
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
117 files changed:
auth/credentials/tests/bind.py
lib/ldb-samba/tests/match_rules.py
lib/ldb/tests/python/api.py
lib/ldb/tests/python/index.py
python/examples/winreg.py
python/samba/__init__.py
python/samba/dbchecker.py
python/samba/dnsserver.py
python/samba/drs_utils.py
python/samba/getopt.py
python/samba/gp_sec_ext.py
python/samba/gpclass.py
python/samba/graph.py
python/samba/idmap.py
python/samba/join.py
python/samba/netcmd/__init__.py
python/samba/netcmd/common.py
python/samba/netcmd/computer.py
python/samba/netcmd/dbcheck.py
python/samba/netcmd/delegation.py
python/samba/netcmd/dns.py
python/samba/netcmd/domain.py
python/samba/netcmd/dsacl.py
python/samba/netcmd/forest.py
python/samba/netcmd/fsmo.py
python/samba/netcmd/gpo.py
python/samba/netcmd/group.py
python/samba/netcmd/ldapcmp.py
python/samba/netcmd/pso.py
python/samba/netcmd/schema.py
python/samba/netcmd/spn.py
python/samba/netcmd/testparm.py
python/samba/netcmd/user.py
python/samba/provision/__init__.py
python/samba/provision/backend.py
python/samba/provision/sambadns.py
python/samba/remove_dc.py
python/samba/samdb.py
python/samba/schema.py
python/samba/sites.py
python/samba/subunit/__init__.py
python/samba/tests/auth_log.py
python/samba/tests/core.py
python/samba/tests/dcerpc/bare.py
python/samba/tests/dcerpc/raw_protocol.py
python/samba/tests/dcerpc/raw_testcase.py
python/samba/tests/dcerpc/registry.py
python/samba/tests/dcerpc/srvsvc.py
python/samba/tests/dns.py
python/samba/tests/docs.py
python/samba/tests/dsdb.py
python/samba/tests/get_opt.py
python/samba/tests/gpo.py
python/samba/tests/kcc/ldif_import_export.py
python/samba/tests/netcmd.py
python/samba/tests/policy.py
python/samba/tests/posixacl.py
python/samba/tests/provision.py
python/samba/tests/s3idmapdb.py
python/samba/tests/samba3sam.py
python/samba/tests/samba_tool/computer.py
python/samba/tests/samba_tool/forest.py
python/samba/tests/samba_tool/fsmo.py
python/samba/tests/samba_tool/group.py
python/samba/tests/samba_tool/ou.py
python/samba/tests/samba_tool/rodc.py
python/samba/tests/samba_tool/schema.py
python/samba/tests/samba_tool/user.py
python/samba/tests/samba_tool/user_check_password_script.py
python/samba/tests/samba_tool/user_virtualCryptSHA.py
python/samba/tests/samba_tool/user_wdigest.py
python/samba/tests/security.py
python/samba/tests/smb.py
python/samba/tests/source.py
python/samba/tests/subunitrun.py
python/samba/tests/upgrade.py
python/samba/tests/upgradeprovision.py
python/samba/tests/upgradeprovisionneeddc.py
python/samba/tests/xattr.py
python/samba/upgrade.py
python/samba/upgradehelpers.py
python/samba/web_server/__init__.py
python/samba/xattr.py
script/autobuild.py
script/bisect-test.py
script/generate_param.py
selftest/subunithelper.py
selftest/tests.py
source3/selftest/tests.py
source3/torture/test_ntlm_auth.py
source4/dsdb/tests/python/acl.py
source4/dsdb/tests/python/ad_dc_multi_bind.py
source4/dsdb/tests/python/deletetest.py
source4/dsdb/tests/python/dirsync.py
source4/dsdb/tests/python/ldap.py
source4/dsdb/tests/python/ldap_schema.py
source4/dsdb/tests/python/ldap_syntaxes.py
source4/dsdb/tests/python/password_lockout_base.py
source4/dsdb/tests/python/passwords.py
source4/dsdb/tests/python/sam.py
source4/dsdb/tests/python/sec_descriptor.py
source4/dsdb/tests/python/token_group.py
source4/dsdb/tests/python/urgent_replication.py
source4/dsdb/tests/python/vlv.py
source4/selftest/tests.py
source4/torture/drs/python/drs_base.py
source4/torture/drs/python/getnc_exop.py
source4/torture/drs/python/link_conflicts.py
source4/torture/drs/python/linked_attributes_drs.py
source4/torture/drs/python/repl_rodc.py
source4/torture/drs/python/repl_schema.py
source4/torture/drs/python/replica_sync.py
source4/torture/drs/python/ridalloc_exop.py
source4/torture/drs/python/samba_tool_drs.py
wintest/test-s3.py
wintest/test-s4-howto.py
wintest/wintest.py

index 623506eac5d46534b4f3418f1e7d68a6922fae56..c397501844d165d2180cf57b666dfbbb2a1d3bff 100755 (executable)
@@ -158,7 +158,7 @@ unicodePwd:: """ + base64.b64encode(u"\"P@ssw0rd\"".encode('utf-16-le')).decode(
         print("BindTest (no domain) with: " + self.username)
         try:
             ldb_user4 = samba.tests.connect_samdb(host, credentials=creds_user4,
-                                              lp=lp, ldap_only=True)
+                                                  lp=lp, ldap_only=True)
         except:
             self.fail("Failed to connect without the domain set")
 
index f32d2a47c25c849e24a6b25a04a9a49cd5cb6eec..63dfddb20107fda121cf03a22afab88b6a5df4f1 100755 (executable)
@@ -62,25 +62,25 @@ class MatchRulesTests(samba.tests.TestCase):
         m = Message()
         m.dn = Dn(self.ldb, self.ou)
         m["otherWellKnownObjects"] = MessageElement("B:32:00000000000000000000000000000001:OU=o1,%s" % self.ou,
-                                     FLAG_MOD_ADD, "otherWellKnownObjects")
+                                                    FLAG_MOD_ADD, "otherWellKnownObjects")
         self.ldb.modify(m)
 
         m = Message()
         m.dn = Dn(self.ldb, "OU=o1,%s" % self.ou)
         m["otherWellKnownObjects"] = MessageElement("B:32:00000000000000000000000000000002:OU=o2,OU=o1,%s" % self.ou,
-                                     FLAG_MOD_ADD, "otherWellKnownObjects")
+                                                    FLAG_MOD_ADD, "otherWellKnownObjects")
         self.ldb.modify(m)
 
         m = Message()
         m.dn = Dn(self.ldb, "OU=o2,OU=o1,%s" % self.ou)
         m["otherWellKnownObjects"] = MessageElement("B:32:00000000000000000000000000000003:OU=o3,OU=o2,OU=o1,%s" % self.ou,
-                                     FLAG_MOD_ADD, "otherWellKnownObjects")
+                                                    FLAG_MOD_ADD, "otherWellKnownObjects")
         self.ldb.modify(m)
 
         m = Message()
         m.dn = Dn(self.ldb, "OU=o3,OU=o2,OU=o1,%s" % self.ou)
         m["otherWellKnownObjects"] = MessageElement("B:32:00000000000000000000000000000004:OU=o4,OU=o3,OU=o2,OU=o1,%s" % self.ou,
-                                     FLAG_MOD_ADD, "otherWellKnownObjects")
+                                                    FLAG_MOD_ADD, "otherWellKnownObjects")
         self.ldb.modify(m)
 
         # Create OU for users and groups
@@ -276,68 +276,68 @@ class MatchRulesTests(samba.tests.TestCase):
     def test_u1_member_of_g4(self):
         # Search without transitive match must return 0 results
         res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                        scope=SCOPE_BASE,
-                        expression="member=cn=u1,%s" % self.ou_users)
+                               scope=SCOPE_BASE,
+                               expression="member=cn=u1,%s" % self.ou_users)
         self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search("cn=u1,%s" % self.ou_users,
-                        scope=SCOPE_BASE,
-                        expression="memberOf=cn=g4,%s" % self.ou_groups)
+                               scope=SCOPE_BASE,
+                               expression="memberOf=cn=g4,%s" % self.ou_groups)
         self.assertEqual(len(res1), 0)
 
         # Search with transitive match must return 1 results
         res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                        scope=SCOPE_BASE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
+                               scope=SCOPE_BASE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g4,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search("cn=u1,%s" % self.ou_users,
-                        scope=SCOPE_BASE,
-                        expression="memberOf:1.2.840.113556.1.4.1941:=cn=g4,%s" % self.ou_groups)
+                               scope=SCOPE_BASE,
+                               expression="memberOf:1.2.840.113556.1.4.1941:=cn=g4,%s" % self.ou_groups)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=u1,%s" % self.ou_users).lower())
 
     def test_g1_member_of_g4(self):
         # Search without transitive match must return 0 results
         res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                        scope=SCOPE_BASE,
-                        expression="member=cn=g1,%s" % self.ou_groups)
+                               scope=SCOPE_BASE,
+                               expression="member=cn=g1,%s" % self.ou_groups)
         self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search("cn=g1,%s" % self.ou_groups,
-                        scope=SCOPE_BASE,
-                        expression="memberOf=cn=g4,%s" % self.ou_groups)
+                               scope=SCOPE_BASE,
+                               expression="memberOf=cn=g4,%s" % self.ou_groups)
         self.assertEqual(len(res1), 0)
 
         # Search with transitive match must return 1 results
         res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                        scope=SCOPE_BASE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=g1,%s" % self.ou_groups)
+                               scope=SCOPE_BASE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=g1,%s" % self.ou_groups)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g4,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search("cn=g1,%s" % self.ou_groups,
-                        scope=SCOPE_BASE,
-                        expression="memberOf:1.2.840.113556.1.4.1941:=cn=g4,%s" % self.ou_groups)
+                               scope=SCOPE_BASE,
+                               expression="memberOf:1.2.840.113556.1.4.1941:=cn=g4,%s" % self.ou_groups)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g1,%s" % self.ou_groups).lower())
 
     def test_u1_groups(self):
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=cn=u1,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=cn=u1,%s" % self.ou_users)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g1,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_users,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=cn=u1,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=cn=u1,%s" % self.ou_users)
         self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
         self.assertEqual(len(res1), 4)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g1,%s" % self.ou_groups).lower() in dn_list)
@@ -346,25 +346,25 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_users,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
         self.assertEqual(len(res1), 0)
 
     def test_u2_groups(self):
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=cn=u2,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=cn=u2,%s" % self.ou_users)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g2,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_users,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=cn=u2,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=cn=u2,%s" % self.ou_users)
         self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u2,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=u2,%s" % self.ou_users)
         self.assertEqual(len(res1), 3)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g2,%s" % self.ou_groups).lower() in dn_list)
@@ -372,63 +372,63 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_users,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u2,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=u2,%s" % self.ou_users)
         self.assertEqual(len(res1), 0)
 
     def test_u3_groups(self):
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=cn=u3,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=cn=u3,%s" % self.ou_users)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g3,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_users,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=cn=u3,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=cn=u3,%s" % self.ou_users)
         self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u3,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=u3,%s" % self.ou_users)
         self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g3,%s" % self.ou_groups).lower() in dn_list)
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_users,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u3,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=u3,%s" % self.ou_users)
         self.assertEqual(len(res1), 0)
 
     def test_u4_groups(self):
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=cn=u4,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=cn=u4,%s" % self.ou_users)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g4,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_users,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=cn=u4,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=cn=u4,%s" % self.ou_users)
         self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u4,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=u4,%s" % self.ou_users)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g4,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_users,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u4,%s" % self.ou_users)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=cn=u4,%s" % self.ou_users)
         self.assertEqual(len(res1), 0)
 
     def test_extended_dn_u1(self):
         res1 = self.ldb.search("cn=u1,%s" % self.ou_users,
-                        scope=SCOPE_BASE,
-                        expression="objectClass=*",
-                        attrs=['objectSid', 'objectGUID'])
+                               scope=SCOPE_BASE,
+                               expression="objectClass=*",
+                               attrs=['objectSid', 'objectGUID'])
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("cn=u1,%s" % self.ou_users).lower())
 
@@ -436,20 +436,20 @@ class MatchRulesTests(samba.tests.TestCase):
         guid = self.ldb.schema_format_value("objectGUID", res1[0]['objectGUID'][0])
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=<SID=%s>" % sid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=<SID=%s>" % sid)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g1,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=<GUID=%s>" % guid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=<GUID=%s>" % guid)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g1,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
         self.assertEqual(len(res1), 4)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g1,%s" % self.ou_groups).lower() in dn_list)
@@ -458,8 +458,8 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_ONELEVEL,
-                        expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
+                               scope=SCOPE_ONELEVEL,
+                               expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
         self.assertEqual(len(res1), 4)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g1,%s" % self.ou_groups).lower() in dn_list)
@@ -468,8 +468,8 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
         self.assertEqual(len(res1), 4)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g1,%s" % self.ou_groups).lower() in dn_list)
@@ -478,8 +478,8 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_ONELEVEL,
-                        expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
+                               scope=SCOPE_ONELEVEL,
+                               expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
         self.assertEqual(len(res1), 4)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g1,%s" % self.ou_groups).lower() in dn_list)
@@ -489,9 +489,9 @@ class MatchRulesTests(samba.tests.TestCase):
 
     def test_extended_dn_u2(self):
         res1 = self.ldb.search("cn=u2,%s" % self.ou_users,
-                        scope=SCOPE_BASE,
-                        expression="objectClass=*",
-                        attrs=['objectSid', 'objectGUID'])
+                               scope=SCOPE_BASE,
+                               expression="objectClass=*",
+                               attrs=['objectSid', 'objectGUID'])
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("cn=u2,%s" % self.ou_users).lower())
 
@@ -499,20 +499,20 @@ class MatchRulesTests(samba.tests.TestCase):
         guid = self.ldb.schema_format_value("objectGUID", res1[0]['objectGUID'][0])
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=<SID=%s>" % sid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=<SID=%s>" % sid)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g2,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=<GUID=%s>" % guid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=<GUID=%s>" % guid)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g2,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
         self.assertEqual(len(res1), 3)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g2,%s" % self.ou_groups).lower() in dn_list)
@@ -520,8 +520,8 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_ONELEVEL,
-                        expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
+                               scope=SCOPE_ONELEVEL,
+                               expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
         self.assertEqual(len(res1), 3)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g2,%s" % self.ou_groups).lower() in dn_list)
@@ -529,8 +529,8 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
         self.assertEqual(len(res1), 3)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g2,%s" % self.ou_groups).lower() in dn_list)
@@ -538,8 +538,8 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_ONELEVEL,
-                        expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
+                               scope=SCOPE_ONELEVEL,
+                               expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
         self.assertEqual(len(res1), 3)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g2,%s" % self.ou_groups).lower() in dn_list)
@@ -548,9 +548,9 @@ class MatchRulesTests(samba.tests.TestCase):
 
     def test_extended_dn_u3(self):
         res1 = self.ldb.search("cn=u3,%s" % self.ou_users,
-                        scope=SCOPE_BASE,
-                        expression="objectClass=*",
-                        attrs=['objectSid', 'objectGUID'])
+                               scope=SCOPE_BASE,
+                               expression="objectClass=*",
+                               attrs=['objectSid', 'objectGUID'])
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("cn=u3,%s" % self.ou_users).lower())
 
@@ -558,14 +558,14 @@ class MatchRulesTests(samba.tests.TestCase):
         guid = self.ldb.schema_format_value("objectGUID", res1[0]['objectGUID'][0])
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=<SID=%s>" % sid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=<SID=%s>" % sid)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g3,%s" % self.ou_groups).lower())
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member=<GUID=%s>" % guid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member=<GUID=%s>" % guid)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=g3,%s" % self.ou_groups).lower())
 
@@ -586,16 +586,16 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
+                               scope=SCOPE_SUBTREE,
+                               expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
         self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g3,%s" % self.ou_groups).lower() in dn_list)
         self.assertTrue(("CN=g4,%s" % self.ou_groups).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_ONELEVEL,
-                        expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
+                               scope=SCOPE_ONELEVEL,
+                               expression="member:1.2.840.113556.1.4.1941:=<GUID=%s>" % guid)
         self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=g3,%s" % self.ou_groups).lower() in dn_list)
@@ -656,28 +656,28 @@ class MatchRulesTests(samba.tests.TestCase):
 
     def test_object_dn_binary(self):
         res1 = self.ldb.search(self.ou_computers,
-                        scope=SCOPE_SUBTREE,
-                        expression="msDS-RevealedUsers=B:8:01010101:cn=c3,%s" % self.ou_computers)
+                               scope=SCOPE_SUBTREE,
+                               expression="msDS-RevealedUsers=B:8:01010101:cn=c3,%s" % self.ou_computers)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=c2,%s" % self.ou_computers).lower())
 
         res1 = self.ldb.search(self.ou_computers,
-                        scope=SCOPE_ONELEVEL,
-                        expression="msDS-RevealedUsers=B:8:01010101:cn=c3,%s" % self.ou_computers)
+                               scope=SCOPE_ONELEVEL,
+                               expression="msDS-RevealedUsers=B:8:01010101:cn=c3,%s" % self.ou_computers)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=c2,%s" % self.ou_computers).lower())
 
         res1 = self.ldb.search(self.ou_computers,
-                        scope=SCOPE_SUBTREE,
-                        expression="msDS-RevealedUsers:1.2.840.113556.1.4.1941:=B:8:01010101:cn=c3,%s" % self.ou_computers)
+                               scope=SCOPE_SUBTREE,
+                               expression="msDS-RevealedUsers:1.2.840.113556.1.4.1941:=B:8:01010101:cn=c3,%s" % self.ou_computers)
         self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=c1,%s" % self.ou_computers).lower() in dn_list)
         self.assertTrue(("CN=c2,%s" % self.ou_computers).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou_computers,
-                        scope=SCOPE_ONELEVEL,
-                        expression="msDS-RevealedUsers:1.2.840.113556.1.4.1941:=B:8:01010101:cn=c3,%s" % self.ou_computers)
+                               scope=SCOPE_ONELEVEL,
+                               expression="msDS-RevealedUsers:1.2.840.113556.1.4.1941:=B:8:01010101:cn=c3,%s" % self.ou_computers)
         self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=c1,%s" % self.ou_computers).lower() in dn_list)
@@ -685,28 +685,28 @@ class MatchRulesTests(samba.tests.TestCase):
 
     def test_one_way_links(self):
         res1 = self.ldb.search(self.ou,
-                        scope=SCOPE_SUBTREE,
-                        expression="addressBookRoots2=cn=c1,%s" % self.ou_computers)
+                               scope=SCOPE_SUBTREE,
+                               expression="addressBookRoots2=cn=c1,%s" % self.ou_computers)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=e2,%s" % self.ou).lower())
 
         res1 = self.ldb.search(self.ou,
-                        scope=SCOPE_ONELEVEL,
-                        expression="addressBookRoots2=cn=c1,%s" % self.ou_computers)
+                               scope=SCOPE_ONELEVEL,
+                               expression="addressBookRoots2=cn=c1,%s" % self.ou_computers)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("CN=e2,%s" % self.ou).lower())
 
         res1 = self.ldb.search(self.ou,
-                        scope=SCOPE_SUBTREE,
-                        expression="addressBookRoots2:1.2.840.113556.1.4.1941:=cn=c1,%s" % self.ou_computers)
+                               scope=SCOPE_SUBTREE,
+                               expression="addressBookRoots2:1.2.840.113556.1.4.1941:=cn=c1,%s" % self.ou_computers)
         self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=e1,%s" % self.ou).lower() in dn_list)
         self.assertTrue(("CN=e2,%s" % self.ou).lower() in dn_list)
 
         res1 = self.ldb.search(self.ou,
-                        scope=SCOPE_ONELEVEL,
-                        expression="addressBookRoots2:1.2.840.113556.1.4.1941:=cn=c1,%s" % self.ou_computers)
+                               scope=SCOPE_ONELEVEL,
+                               expression="addressBookRoots2:1.2.840.113556.1.4.1941:=cn=c1,%s" % self.ou_computers)
         self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn).lower() for res in res1]
         self.assertTrue(("CN=e1,%s" % self.ou).lower() in dn_list)
@@ -714,8 +714,8 @@ class MatchRulesTests(samba.tests.TestCase):
 
     def test_not_linked_attrs(self):
         res1 = self.ldb.search(self.base_dn,
-                        scope=SCOPE_BASE,
-                        expression="wellKnownObjects=B:32:aa312825768811d1aded00c04fd8d5cd:CN=computers,%s" % self.base_dn)
+                               scope=SCOPE_BASE,
+                               expression="wellKnownObjects=B:32:aa312825768811d1aded00c04fd8d5cd:CN=computers,%s" % self.base_dn)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), self.base_dn.lower())
 
@@ -732,24 +732,24 @@ class MatchRulesTests(samba.tests.TestCase):
 
     def test_subtree(self):
         res1 = self.ldb.search(self.ou,
-                        scope=SCOPE_SUBTREE,
-                        expression="otherWellKnownObjects=B:32:00000000000000000000000000000004:OU=o4,OU=o3,OU=o2,OU=o1,%s" % self.ou)
+                               scope=SCOPE_SUBTREE,
+                               expression="otherWellKnownObjects=B:32:00000000000000000000000000000004:OU=o4,OU=o3,OU=o2,OU=o1,%s" % self.ou)
         self.assertEqual(len(res1), 1)
         self.assertEqual(str(res1[0].dn).lower(), ("OU=o3,OU=o2,OU=o1,%s" % self.ou).lower())
 
         res1 = self.ldb.search(self.ou,
-                        scope=SCOPE_ONELEVEL,
-                        expression="otherWellKnownObjects=B:32:00000000000000000000000000000004:OU=o4,OU=o3,OU=o2,OU=o1,%s" % self.ou)
+                               scope=SCOPE_ONELEVEL,
+                               expression="otherWellKnownObjects=B:32:00000000000000000000000000000004:OU=o4,OU=o3,OU=o2,OU=o1,%s" % self.ou)
         self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search(self.ou,
-                        scope=SCOPE_SUBTREE,
-                        expression="otherWellKnownObjects:1.2.840.113556.1.4.1941:=B:32:00000000000000000000000000000004:OU=o4,OU=o3,OU=o2,OU=o1,%s" % self.ou)
+                               scope=SCOPE_SUBTREE,
+                               expression="otherWellKnownObjects:1.2.840.113556.1.4.1941:=B:32:00000000000000000000000000000004:OU=o4,OU=o3,OU=o2,OU=o1,%s" % self.ou)
         self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search(self.ou,
-                        scope=SCOPE_ONELEVEL,
-                        expression="otherWellKnownObjects:1.2.840.113556.1.4.1941:=B:32:00000000000000000000000000000004:OU=o4,OU=o3,OU=o2,OU=o1,%s" % self.ou)
+                               scope=SCOPE_ONELEVEL,
+                               expression="otherWellKnownObjects:1.2.840.113556.1.4.1941:=B:32:00000000000000000000000000000004:OU=o4,OU=o3,OU=o2,OU=o1,%s" % self.ou)
         self.assertEqual(len(res1), 0)
 
     def test_unknown_oid(self):
@@ -769,49 +769,58 @@ class MatchRulesTests(samba.tests.TestCase):
         self.assertEqual(len(res1), 0)
 
     def test_nul_text(self):
-        self.assertRaises(TypeError, lambda: self.ldb.search("cn=g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="\00member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users))
-        self.assertRaises(TypeError, lambda: self.ldb.search("cn=g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member:1.2.840\00.113556.1.4.1941:=cn=u1,%s" % self.ou_users))
-        self.assertRaises(TypeError, lambda: self.ldb.search("cn=g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member:1.2.840.113556.1.4.1941:=cn=u1\00,%s" % self.ou_users))
-        self.assertRaises(LdbError, lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users))
-        self.assertRaises(LdbError, lambda: self.ldb.search("cn=g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member:1.2.840.113556.1.4.1941:"))
+        self.assertRaises(TypeError,
+                          lambda: self.ldb.search("cn=g4,%s" % self.ou_groups,
+                                                  scope=SCOPE_BASE,
+                                                  expression="\00member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users))
+        self.assertRaises(TypeError,
+                          lambda: self.ldb.search("cn=g4,%s" % self.ou_groups,
+                                                  scope=SCOPE_BASE,
+                                                  expression="member:1.2.840\00.113556.1.4.1941:=cn=u1,%s" % self.ou_users))
+        self.assertRaises(TypeError,
+                          lambda: self.ldb.search("cn=g4,%s" % self.ou_groups,
+                                                  scope=SCOPE_BASE,
+                                                  expression="member:1.2.840.113556.1.4.1941:=cn=u1\00,%s" % self.ou_users))
+        self.assertRaises(LdbError,
+                          lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
+                                                  scope=SCOPE_BASE,
+                                                  expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users))
+        self.assertRaises(LdbError,
+                          lambda: self.ldb.search("cn=g4,%s" % self.ou_groups,
+                                                  scope=SCOPE_BASE,
+                                                  expression="member:1.2.840.113556.1.4.1941:"))
         res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member:1.2.840.113556.1.4.1941:=")
+                               scope=SCOPE_BASE,
+                               expression="member:1.2.840.113556.1.4.1941:=")
         self.assertEqual(len(res1), 0)
         res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member=")
+                               scope=SCOPE_BASE,
+                               expression="member=")
         self.assertEqual(len(res1), 0)
         res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member:1.2.840.113556.1.4.1941:=nonexistent")
+                               scope=SCOPE_BASE,
+                               expression="member:1.2.840.113556.1.4.1941:=nonexistent")
         self.assertEqual(len(res1), 0)
         res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member=nonexistent")
+                               scope=SCOPE_BASE,
+                               expression="member=nonexistent")
         self.assertEqual(len(res1), 0)
-        self.assertRaises(LdbError, lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member:1.2.840.113556.1.4.1941:cn=u1,%s" % self.ou_users))
-        self.assertRaises(LdbError, lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member:1.2.840.113556.1.4.1941:=cn=u1"))
-        self.assertRaises(LdbError, lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member:1.2.840.113556.1.4.1941:=cn="))
-        self.assertRaises(LdbError, lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
-                            scope=SCOPE_BASE,
-                            expression="member::=cn=u1,%s" % self.ou_users))
+        self.assertRaises(LdbError,
+                          lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
+                                                  scope=SCOPE_BASE,
+                                                  expression="member:1.2.840.113556.1.4.1941:cn=u1,%s" % self.ou_users))
+        self.assertRaises(LdbError,
+                          lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
+                                                  scope=SCOPE_BASE,
+                                                  expression="member:1.2.840.113556.1.4.1941:=cn=u1"))
+        self.assertRaises(LdbError,
+                          lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
+                                                  scope=SCOPE_BASE,
+                                                  expression="member:1.2.840.113556.1.4.1941:=cn="))
+        self.assertRaises(LdbError,
+                          lambda: self.ldb.search("cn=\00g4,%s" % self.ou_groups,
+                                                  scope=SCOPE_BASE,
+                                                  expression="member::=cn=u1,%s" % self.ou_users))
 
     def test_misc_matches(self):
         res1 = self.ldb.search(self.ou_groups,
index 24f8cba565541208fc41ee7ba9658ec8783ca66b..1f78c87cc7326ac60c27d95c165fc15e00e6f7f4 100755 (executable)
@@ -159,12 +159,12 @@ class SimpleLdb(LdbBaseTest):
     def test_search_scope_base_empty_db(self):
         l = ldb.Ldb(self.url(), flags=self.flags())
         self.assertEqual(len(l.search(ldb.Dn(l, "dc=foo1"),
-                          ldb.SCOPE_BASE)), 0)
+                                      ldb.SCOPE_BASE)), 0)
 
     def test_search_scope_onelevel_empty_db(self):
         l = ldb.Ldb(self.url(), flags=self.flags())
         self.assertEqual(len(l.search(ldb.Dn(l, "dc=foo1"),
-                          ldb.SCOPE_ONELEVEL)), 0)
+                                      ldb.SCOPE_ONELEVEL)), 0)
 
     def test_delete(self):
         l = ldb.Ldb(self.url(), flags=self.flags())
@@ -1873,7 +1873,7 @@ class BadIndexTests(LdbBaseTest):
         # Now set this to unique index, but forget to check the result
         try:
             self.ldb.add({"dn": "@ATTRIBUTES",
-                        "y": "UNIQUE_INDEX"})
+                          "y": "UNIQUE_INDEX"})
             self.fail()
         except ldb.LdbError:
             pass
@@ -1903,7 +1903,7 @@ class BadIndexTests(LdbBaseTest):
         # Now set this to unique index, but forget to check the result
         try:
             self.ldb.add({"dn": "@ATTRIBUTES",
-                        "y": "UNIQUE_INDEX"})
+                          "y": "UNIQUE_INDEX"})
         except ldb.LdbError:
             pass
 
@@ -2767,7 +2767,7 @@ class LdbResultTests(LdbBaseTest):
 
         # This should not turn up until the transaction is concluded
         res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
-                            scope=ldb.SCOPE_BASE)
+                              scope=ldb.SCOPE_BASE)
         self.assertEqual(len(res11), 0)
 
         os.write(w2, b"search")
@@ -2779,7 +2779,7 @@ class LdbResultTests(LdbBaseTest):
 
         # This should now turn up, as the transaction is over
         res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
-                            scope=ldb.SCOPE_BASE)
+                              scope=ldb.SCOPE_BASE)
         self.assertEqual(len(res11), 1)
 
         self.assertFalse(found11)
@@ -2839,7 +2839,7 @@ class LdbResultTests(LdbBaseTest):
 
         # This should not turn up until the transaction is concluded
         res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
-                            scope=ldb.SCOPE_BASE)
+                              scope=ldb.SCOPE_BASE)
         self.assertEqual(len(res11), 0)
 
         os.write(w2, b"search")
@@ -2851,7 +2851,7 @@ class LdbResultTests(LdbBaseTest):
         # removed the read lock, but for ldb_tdb that happened as soon
         # as we called the first res.next()
         res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
-                            scope=ldb.SCOPE_BASE)
+                              scope=ldb.SCOPE_BASE)
         self.assertEqual(len(res11), 0)
 
         # These results are all collected at the first next(res) call
@@ -2867,7 +2867,7 @@ class LdbResultTests(LdbBaseTest):
         # This should now turn up, as the transaction is over and all
         # read locks are gone
         res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
-                            scope=ldb.SCOPE_BASE)
+                              scope=ldb.SCOPE_BASE)
         self.assertEqual(len(res11), 1)
 
         self.assertTrue(found)
index 4837d256f2d519c23b412b61d76b40713143c30f..ecd61451f4683f43440f34a38582f0ad0773397d 100755 (executable)
@@ -1311,11 +1311,11 @@ class RejectSubDBIndex(LdbBaseTest):
     def test_try_subdb_index(self):
         try:
             self.l.add({"dn": "@INDEXLIST",
-                    "@IDX_LMDB_SUBDB": [b"1"],
-                    "@IDXONE": [b"1"],
-                    "@IDXONE": [b"1"],
-                    "@IDXGUID": [b"objectUUID"],
-                    "@IDX_DN_GUID": [b"GUID"],
+                        "@IDX_LMDB_SUBDB": [b"1"],
+                        "@IDXONE": [b"1"],
+                        "@IDXONE": [b"1"],
+                        "@IDXGUID": [b"objectUUID"],
+                        "@IDX_DN_GUID": [b"GUID"],
                         })
         except ldb.LdbError as e:
             code = e.args[0]
index 442ee5435f9931503b22554147cf119025a2bd1f..e8029bac8bba6da470deeb8cd3e226f97262949d 100755 (executable)
@@ -19,7 +19,7 @@ parser = optparse.OptionParser("%s <BINDING> [path]" % sys.argv[0])
 sambaopts = options.SambaOptions(parser)
 parser.add_option_group(sambaopts)
 parser.add_option("--createkey", type="string", metavar="KEYNAME", 
-        help="create a key")
+                  help="create a key")
 
 opts, args = parser.parse_args()
 
index 4bf9d71f107c1d5b4d1da3f0bf4319ed2750f728..b5d8d1a4cf6d6c73dedf4d6f3f6fed9bc6edb707 100644 (file)
@@ -140,7 +140,7 @@ class Ldb(_Ldb):
 
         try:
             res = self.search(base=dn, scope=ldb.SCOPE_SUBTREE, attrs=[],
-                      expression="(|(objectclass=user)(objectclass=computer))")
+                              expression="(|(objectclass=user)(objectclass=computer))")
         except ldb.LdbError as error:
             (errno, estr) = error.args
             if errno == ldb.ERR_NO_SUCH_OBJECT:
@@ -173,8 +173,8 @@ class Ldb(_Ldb):
         # Delete the 'visible' records, and the invisble 'deleted' records (if
         # this DB supports it)
         for msg in self.search(basedn, ldb.SCOPE_SUBTREE,
-                       "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
-                       [], controls=["show_deleted:0", "show_recycled:0"]):
+                               "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
+                               [], controls=["show_deleted:0", "show_recycled:0"]):
             try:
                 self.delete(msg.dn, ["relax:0"])
             except ldb.LdbError as error:
@@ -184,8 +184,8 @@ class Ldb(_Ldb):
                     raise
 
         res = self.search(basedn, ldb.SCOPE_SUBTREE,
-            "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
-            [], controls=["show_deleted:0", "show_recycled:0"])
+                          "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
+                          [], controls=["show_deleted:0", "show_recycled:0"])
         assert len(res) == 0
 
         # delete the specials
@@ -271,7 +271,7 @@ def check_all_substituted(text):
     var_end = text.find("}", var_start)
 
     raise Exception("Not all variables substituted: %s" %
-        text[var_start:var_end+1])
+                    text[var_start:var_end+1])
 
 
 def read_and_sub_file(file_name, subst_vars):
@@ -336,7 +336,7 @@ def import_bundled_package(modulename, location, source_tree_container,
     """
     if in_source_tree():
         extra_path = os.path.join(source_tree_topdir(), source_tree_container,
-            location)
+                                  location)
         if not extra_path in sys.path:
             sys.path.insert(0, extra_path)
         sys.modules[modulename] = __import__(modulename)
@@ -356,8 +356,8 @@ def ensure_third_party_module(modulename, location):
         __import__(modulename)
     except ImportError:
         import_bundled_package(modulename, location,
-            source_tree_container="third_party",
-            namespace="samba.third_party")
+                               source_tree_container="third_party",
+                               namespace="samba.third_party")
 
 
 def dn_from_dns_name(dnsdomain):
index d239fe7a8e3de7b2b6a500eca721c497f118f4f9..73bcb254bfac6937fa194fc3be8bcb7d00e1688d 100644 (file)
@@ -106,7 +106,7 @@ class dbcheck(object):
         self.name_map = {}
         try:
             res = samdb.search(base="CN=DnsAdmins,CN=Users,%s" % samdb.domain_dn(), scope=ldb.SCOPE_BASE,
-                           attrs=["objectSid"])
+                               attrs=["objectSid"])
             dnsadmins_sid = ndr_unpack(security.dom_sid, res[0]["objectSid"][0])
             self.name_map['DnsAdmins'] = str(dnsadmins_sid)
         except ldb.LdbError as e5:
@@ -195,7 +195,7 @@ class dbcheck(object):
             res = self.samdb.search(scope=ldb.SCOPE_BASE,
                                     base="@SAMBA_DSDB",
                                     attrs=["compatibleFeatures",
-                                    "requiredFeatures"])
+                                           "requiredFeatures"])
             if "compatibleFeatures" in res[0]:
                 self.compatibleFeatures = res[0]["compatibleFeatures"]
             if "requiredFeatures" in res[0]:
@@ -463,7 +463,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             m['value_%u' % i] = ldb.MessageElement(val, ldb.FLAG_MOD_DELETE, attrname)
             if nval != '':
                 m['normv_%u' % i] = ldb.MessageElement(nval, ldb.FLAG_MOD_ADD,
-                    attrname)
+                                                       attrname)
 
         if self.do_modify(m, ["relax:0", "show_recycled:1"],
                           "Failed to normalise attribute %s" % attrname,
@@ -767,7 +767,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         m.dn = obj.dn
         m['value'] = ldb.MessageElement(forward_vals, ldb.FLAG_MOD_REPLACE, forward_attr)
         if self.do_modify(m, ["local_oid:%s:1" % dsdb.DSDB_CONTROL_DBCHECK_FIX_DUPLICATE_LINKS],
-                "Failed to fix duplicate links in attribute '%s'" % forward_attr):
+                          "Failed to fix duplicate links in attribute '%s'" % forward_attr):
             self.report("Fixed duplicate links in attribute '%s'" % (forward_attr))
             duplicate_cache_key = "%s:%s" % (str(obj.dn), forward_attr)
             assert duplicate_cache_key in self.duplicate_link_cache
@@ -1142,9 +1142,9 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
 
             missing_forward_links, missing_error_count = \
                 self.find_missing_forward_links_from_backlinks(obj,
-                                                         attrname, syntax_oid,
-                                                         reverse_link_name,
-                                                         unique_dict)
+                                                               attrname, syntax_oid,
+                                                               reverse_link_name,
+                                                               unique_dict)
             error_count += missing_error_count
 
             forward_links = [dn for dn in unique_dict.values()]
@@ -1186,7 +1186,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             if guid is None:
                 error_count += 1
                 self.err_missing_dn_GUID_component(obj.dn, attrname, val, dsdb_dn,
-                    "missing GUID")
+                                                   "missing GUID")
                 continue
 
             guidstr = str(misc.GUID(guid))
@@ -1839,9 +1839,9 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         nmsg.dn = dn
         nmsg[attr] = ldb.MessageElement(replBlob, ldb.FLAG_MOD_REPLACE, attr)
         if self.do_modify(nmsg, ["local_oid:%s:0" % dsdb.DSDB_CONTROL_DBCHECK_MODIFY_RO_REPLICA,
-                             "local_oid:1.3.6.1.4.1.7165.4.3.14:0",
-                             "local_oid:1.3.6.1.4.1.7165.4.3.25:0"],
-                      "Failed to fix attribute %s" % attr):
+                                 "local_oid:1.3.6.1.4.1.7165.4.3.14:0",
+                                 "local_oid:1.3.6.1.4.1.7165.4.3.25:0"],
+                          "Failed to fix attribute %s" % attr):
             self.report("Fixed attribute '%s' of '%s'\n" % (attr, dn))
 
 
index b521ec98e69b038a9af9c011c3986767a0deebf6..2b01eaf41faca51c9b7c699ef993525cbd2c1783 100644 (file)
@@ -141,7 +141,7 @@ class SOARecord(dnsserver.DNS_RPC_RECORD):
 class SRVRecord(dnsserver.DNS_RPC_RECORD):
 
     def __init__(self, target, port, priority=0, weight=100, serial=1, ttl=900,
-                rank=dnsp.DNS_RANK_ZONE, node_flag=0):
+                 rank=dnsp.DNS_RANK_ZONE, node_flag=0):
         super(SRVRecord, self).__init__()
         self.wType = dnsp.DNS_TYPE_SRV
         self.dwFlags = rank | node_flag
@@ -160,7 +160,7 @@ class SRVRecord(dnsserver.DNS_RPC_RECORD):
 class TXTRecord(dnsserver.DNS_RPC_RECORD):
 
     def __init__(self, slist, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
-                node_flag=0):
+                 node_flag=0):
         super(TXTRecord, self).__init__()
         self.wType = dnsp.DNS_TYPE_TXT
         self.dwFlags = rank | node_flag
index 66f47503ca8a850f5f36e445b0bbf16b37d594e2..0bc6af577472115817dde49104d3676bf59995d6 100644 (file)
@@ -62,7 +62,7 @@ def drsuapi_connect(server, lp, creds):
 
 
 def sendDsReplicaSync(drsuapiBind, drsuapi_handle, source_dsa_guid,
-        naming_context, req_option):
+                      naming_context, req_option):
     """Send DS replica sync request.
 
     :param drsuapiBind: a drsuapi Bind object
index f670f3916be2b4e65078089bd84573ebe85496df..db1c1756e4baf90120fdb2fa9ae436d28fd420dd 100644 (file)
@@ -100,8 +100,8 @@ class VersionOptions(optparse.OptionGroup):
     def __init__(self, parser):
         optparse.OptionGroup.__init__(self, parser, "Version Options")
         self.add_option("-V", "--version", action="callback",
-                callback=self._display_version,
-                help="Display version number")
+                        callback=self._display_version,
+                        help="Display version number")
 
     def _display_version(self, option, opt_str, arg, parser):
         import samba
@@ -136,30 +136,30 @@ class CredentialsOptions(optparse.OptionGroup):
         self.machine_pass = False
         optparse.OptionGroup.__init__(self, parser, self.section)
         self._add_option("--simple-bind-dn", metavar="DN", action="callback",
-                        callback=self._set_simple_bind_dn, type=str,
-                        help="DN to use for a simple bind")
+                         callback=self._set_simple_bind_dn, type=str,
+                         help="DN to use for a simple bind")
         self._add_option("--password", metavar="PASSWORD", action="callback",
-                        help="Password", type=str, callback=self._set_password)
+                         help="Password", type=str, callback=self._set_password)
         self._add_option("-U", "--username", metavar="USERNAME",
-                        action="callback", type=str,
-                        help="Username", callback=self._parse_username)
+                         action="callback", type=str,
+                         help="Username", callback=self._parse_username)
         self._add_option("-W", "--workgroup", metavar="WORKGROUP",
-                        action="callback", type=str,
-                        help="Workgroup", callback=self._parse_workgroup)
+                         action="callback", type=str,
+                         help="Workgroup", callback=self._parse_workgroup)
         self._add_option("-N", "--no-pass", action="callback",
-                        help="Don't ask for a password",
-                        callback=self._set_no_password)
+                         help="Don't ask for a password",
+                         callback=self._set_no_password)
         self._add_option("-k", "--kerberos", metavar="KERBEROS",
-                        action="callback", type=str,
-                        help="Use Kerberos", callback=self._set_kerberos)
+                         action="callback", type=str,
+                         help="Use Kerberos", callback=self._set_kerberos)
         self._add_option("", "--ipaddress", metavar="IPADDRESS",
-                        action="callback", type=str,
-                        help="IP address of server",
-                        callback=self._set_ipaddress)
+                         action="callback", type=str,
+                         help="IP address of server",
+                         callback=self._set_ipaddress)
         self._add_option("-P", "--machine-pass",
-                        action="callback",
-                        help="Use stored machine account password",
-                        callback=self._set_machine_pass)
+                         action="callback",
+                         help="Use stored machine account password",
+                         callback=self._set_machine_pass)
         self._add_option("--krb5-ccache", metavar="KRB5CCNAME",
                          action="callback", type=str,
                          help="Kerberos Credentials cache",
index e06fb557c7ed9c2f5e53cd44167b1125ae678c64..db15c0986dd6e3a6f7e870e2ffddd5021cbf1c53 100644 (file)
@@ -118,7 +118,7 @@ class gp_sec_ext(gp_inf_ext):
 
     def list(self, rootpath):
         return os.path.join(rootpath,
-            "MACHINE/Microsoft/Windows NT/SecEdit/GptTmpl.inf")
+                            "MACHINE/Microsoft/Windows NT/SecEdit/GptTmpl.inf")
 
     def listmachpol(self, rootpath):
         return os.path.join(rootpath, "Machine/Registry.pol")
index 70ab2612f275e3fac499f2a3070b16c5b5bc8f56..008599bd53fc92f5f42ecd5a2a8fa4d658df33a4 100644 (file)
@@ -402,7 +402,7 @@ class gp_inf_ext(gp_ext):
 def get_dc_hostname(creds, lp):
     net = Net(creds=creds, lp=lp)
     cldap_ret = net.finddc(domain=lp.get('realm'), flags=(nbt.NBT_SERVER_LDAP |
-        nbt.NBT_SERVER_DS))
+                                                          nbt.NBT_SERVER_DS))
     return cldap_ret.pdc_dns_name
 
 ''' Fetch a list of GUIDs for applicable GPOs '''
@@ -464,7 +464,7 @@ def apply_gp(lp, creds, test_ldb, logger, store, gp_extensions):
         check_refresh_gpo_list(dc_hostname, lp, creds, gpos)
     except:
         logger.error('Failed downloading gpt cache from \'%s\' using SMB' \
-            % dc_hostname)
+                     % dc_hostname)
         return
 
     for gpo_obj in gpos:
@@ -485,7 +485,7 @@ def apply_gp(lp, creds, test_ldb, logger, store, gp_extensions):
                 ext.parse(ext.list(path), test_ldb, gp_db, lp)
             except Exception as e:
                 logger.error('Failed to parse gpo %s for extension %s' % \
-                    (guid, str(ext)))
+                             (guid, str(ext)))
                 logger.error('Message was: ' + str(e))
                 store.cancel()
                 continue
index 06d19960f648510a0ee964b7eba274b17999df32..7ca86bf82e517bd5d7a7f9b23b87a95789f5e5eb 100644 (file)
@@ -121,7 +121,7 @@ def shorten_vertex_names(vertices, suffix=',...', aggressive=False):
                 break
         else:
             vmap = dict((k, v.replace(',CN=Servers,', ',**,', 1))
-                       for k, v in vmap.items())
+                        for k, v in vmap.items())
             replacements.append(('**', 'CN=Servers'))
 
         for v in vmap.values():
@@ -129,7 +129,7 @@ def shorten_vertex_names(vertices, suffix=',...', aggressive=False):
                 break
         else:
             vmap = dict((k, v.replace('CN=NTDS Settings,', '*,', 1))
-                       for k, v in vmap.items())
+                        for k, v in vmap.items())
             replacements.append(('*', 'CN=NTDS Settings'))
 
     return vmap, replacements
index a618347fa212638f2b96e6975bca600ec96cb685..26a3beb7d56999bac1dcd262cea49fdc1bdf83a9 100644 (file)
@@ -42,12 +42,12 @@ class IDmapDB(samba.Ldb):
             url = lp.private_path("idmap.ldb")
 
         super(IDmapDB, self).__init__(url=url, lp=lp, modules_dir=modules_dir,
-                session_info=session_info, credentials=credentials, flags=flags,
-                options=options)
+                                      session_info=session_info, credentials=credentials, flags=flags,
+                                      options=options)
 
     def connect(self, url=None, flags=0, options=None):
         super(IDmapDB, self).connect(url=self.lp.private_path(url), flags=flags,
-                options=options)
+                                     options=options)
 
     def increment_xid(self):
         """Increment xidNumber, if not present it create and assign it to the lowerBound
index 4850b45d7977f363f83f84ac4e25328ac2ffbef4..e4f03075f4dbf435a5aee004a7ea7f7a62dc5b00 100644 (file)
@@ -227,7 +227,7 @@ class DCJoinContext(object):
                 creds.set_kerberos_state(ctx.creds.get_kerberos_state())
                 machine_samdb = SamDB(url="ldap://%s" % ctx.server,
                                       session_info=system_session(),
-                                    credentials=creds, lp=ctx.lp)
+                                      credentials=creds, lp=ctx.lp)
             except:
                 pass
             else:
@@ -235,10 +235,10 @@ class DCJoinContext(object):
                 if token_res[0]["tokenGroups"][0] \
                    == res[0]["objectSID"][0]:
                     raise DCJoinException("Not removing account %s which "
-                                       "looks like a Samba DC account "
-                                       "matching the password we already have.  "
-                                       "To override, remove secrets.ldb and secrets.tdb"
-                                    % ctx.samname)
+                                          "looks like a Samba DC account "
+                                          "matching the password we already have.  "
+                                          "To override, remove secrets.ldb and secrets.tdb"
+                                          % ctx.samname)
 
         ctx.del_noerror(res[0].dn, recursive=True)
 
@@ -256,13 +256,13 @@ class DCJoinContext(object):
 
         res = ctx.samdb.search(base=ctx.samdb.get_default_basedn(),
                                expression='(sAMAccountName=%s)' % ldb.binary_encode("dns-%s" % ctx.myname),
-                            attrs=[])
+                               attrs=[])
         if res:
             raise DCJoinException("Not removing account %s which looks like "
-                               "a Samba DNS service account but does not "
-                               "have servicePrincipalName=%s" %
-                               (ldb.binary_encode("dns-%s" % ctx.myname),
-                                ldb.binary_encode("dns/%s" % ctx.dnshostname)))
+                                  "a Samba DNS service account but does not "
+                                  "have servicePrincipalName=%s" %
+                                  (ldb.binary_encode("dns-%s" % ctx.myname),
+                                   ldb.binary_encode("dns/%s" % ctx.dnshostname)))
 
 
     def cleanup_old_join(ctx, force=False):
@@ -656,15 +656,15 @@ class DCJoinContext(object):
             # TODO Is this supposed to be for the schema partition too?
             expr = "(&(objectClass=crossRef)(ncName=%s))" % ldb.binary_encode(ctx.domaindns_zone)
             domain = (ctx.samdb.search(scope=ldb.SCOPE_ONELEVEL,
-                                      attrs=[],
-                                      base=ctx.samdb.get_partitions_dn(),
-                                      expression=expr), ctx.domaindns_zone)
+                                       attrs=[],
+                                       base=ctx.samdb.get_partitions_dn(),
+                                       expression=expr), ctx.domaindns_zone)
 
             expr = "(&(objectClass=crossRef)(ncName=%s))" % ldb.binary_encode(ctx.forestdns_zone)
             forest = (ctx.samdb.search(scope=ldb.SCOPE_ONELEVEL,
-                                      attrs=[],
-                                      base=ctx.samdb.get_partitions_dn(),
-                                      expression=expr), ctx.forestdns_zone)
+                                       attrs=[],
+                                       base=ctx.samdb.get_partitions_dn(),
+                                       expression=expr), ctx.forestdns_zone)
 
             for part, zone in (domain, forest):
                 if zone not in ctx.nc_list:
@@ -847,16 +847,16 @@ class DCJoinContext(object):
         smbconf = ctx.lp.configfile
 
         presult = provision(ctx.logger, system_session(), smbconf=smbconf,
-                targetdir=ctx.targetdir, samdb_fill=FILL_DRS, realm=ctx.realm,
-                rootdn=ctx.root_dn, domaindn=ctx.base_dn,
-                schemadn=ctx.schema_dn, configdn=ctx.config_dn,
-                serverdn=ctx.server_dn, domain=ctx.domain_name,
-                hostname=ctx.myname, domainsid=ctx.domsid,
-                machinepass=ctx.acct_pass, serverrole="active directory domain controller",
-                sitename=ctx.site, lp=ctx.lp, ntdsguid=ctx.ntds_guid,
-                use_ntvfs=ctx.use_ntvfs, dns_backend=ctx.dns_backend,
-                plaintext_secrets=ctx.plaintext_secrets,
-                backend_store=ctx.backend_store
+                            targetdir=ctx.targetdir, samdb_fill=FILL_DRS, realm=ctx.realm,
+                            rootdn=ctx.root_dn, domaindn=ctx.base_dn,
+                            schemadn=ctx.schema_dn, configdn=ctx.config_dn,
+                            serverdn=ctx.server_dn, domain=ctx.domain_name,
+                            hostname=ctx.myname, domainsid=ctx.domsid,
+                            machinepass=ctx.acct_pass, serverrole="active directory domain controller",
+                            sitename=ctx.site, lp=ctx.lp, ntdsguid=ctx.ntds_guid,
+                            use_ntvfs=ctx.use_ntvfs, dns_backend=ctx.dns_backend,
+                            plaintext_secrets=ctx.plaintext_secrets,
+                            backend_store=ctx.backend_store
                             )
         print("Provision OK for domain DN %s" % presult.domaindn)
         ctx.local_samdb = presult.samdb
@@ -942,19 +942,19 @@ class DCJoinContext(object):
             repl = ctx.create_replicator(repl_creds, binding_options)
 
             repl.replicate(ctx.schema_dn, source_dsa_invocation_id,
-                    destination_dsa_guid, schema=True, rodc=ctx.RODC,
-                    replica_flags=ctx.replica_flags)
+                           destination_dsa_guid, schema=True, rodc=ctx.RODC,
+                           replica_flags=ctx.replica_flags)
             repl.replicate(ctx.config_dn, source_dsa_invocation_id,
-                    destination_dsa_guid, rodc=ctx.RODC,
-                    replica_flags=ctx.replica_flags)
+                           destination_dsa_guid, rodc=ctx.RODC,
+                           replica_flags=ctx.replica_flags)
             if not ctx.subdomain:
                 # Replicate first the critical object for the basedn
                 if not ctx.domain_replica_flags & drsuapi.DRSUAPI_DRS_CRITICAL_ONLY:
                     print("Replicating critical objects from the base DN of the domain")
                     ctx.domain_replica_flags |= drsuapi.DRSUAPI_DRS_CRITICAL_ONLY
                     repl.replicate(ctx.base_dn, source_dsa_invocation_id,
-                                destination_dsa_guid, rodc=ctx.RODC,
-                                replica_flags=ctx.domain_replica_flags)
+                                   destination_dsa_guid, rodc=ctx.RODC,
+                                   replica_flags=ctx.domain_replica_flags)
                     ctx.domain_replica_flags ^= drsuapi.DRSUAPI_DRS_CRITICAL_ONLY
                 repl.replicate(ctx.base_dn, source_dsa_invocation_id,
                                destination_dsa_guid, rodc=ctx.RODC,
@@ -973,11 +973,11 @@ class DCJoinContext(object):
 
             if ctx.RODC:
                 repl.replicate(ctx.acct_dn, source_dsa_invocation_id,
-                        destination_dsa_guid,
-                        exop=drsuapi.DRSUAPI_EXOP_REPL_SECRET, rodc=True)
+                               destination_dsa_guid,
+                               exop=drsuapi.DRSUAPI_EXOP_REPL_SECRET, rodc=True)
                 repl.replicate(ctx.new_krbtgt_dn, source_dsa_invocation_id,
-                        destination_dsa_guid,
-                        exop=drsuapi.DRSUAPI_EXOP_REPL_SECRET, rodc=True)
+                               destination_dsa_guid,
+                               exop=drsuapi.DRSUAPI_EXOP_REPL_SECRET, rodc=True)
             elif ctx.rid_manager_dn != None:
                 # Try and get a RID Set if we can.  This is only possible against the RID Master.  Warn otherwise.
                 try:
@@ -1061,7 +1061,7 @@ class DCJoinContext(object):
 
         binding_options = "sign"
         dns_conn = dnsserver.dnsserver("ncacn_ip_tcp:%s[%s]" % (ctx.server, binding_options),
-                                      ctx.lp, ctx.creds)
+                                       ctx.lp, ctx.creds)
 
 
         name_found = True
@@ -1519,10 +1519,10 @@ def join_clone(logger=None, server=None, creds=None, lp=None,
     return ctx
 
 def join_subdomain(logger=None, server=None, creds=None, lp=None, site=None,
-        netbios_name=None, targetdir=None, parent_domain=None, dnsdomain=None,
-        netbios_domain=None, machinepass=None, adminpass=None, use_ntvfs=False,
-        dns_backend=None, plaintext_secrets=False,
-        backend_store=None):
+                   netbios_name=None, targetdir=None, parent_domain=None, dnsdomain=None,
+                   netbios_domain=None, machinepass=None, adminpass=None, use_ntvfs=False,
+                   dns_backend=None, plaintext_secrets=False,
+                   backend_store=None):
     """Join as a DC."""
     ctx = DCJoinContext(logger, server, creds, lp, site, netbios_name,
                         targetdir, parent_domain, machinepass, use_ntvfs,
@@ -1696,14 +1696,14 @@ class DCCloneAndRenameContext(DCCloneContext):
 
         # do the provision with the new/renamed domain DN values
         presult = provision(ctx.logger, system_session(),
-                targetdir=ctx.targetdir, samdb_fill=FILL_DRS,
-                realm=ctx.new_realm, lp=non_global_lp,
-                rootdn=ctx.rename_dn(ctx.root_dn), domaindn=ctx.new_base_dn,
-                schemadn=ctx.rename_dn(ctx.schema_dn),
-                configdn=ctx.rename_dn(ctx.config_dn),
-                domain=ctx.new_domain_name, domainsid=ctx.domsid,
-                serverrole="active directory domain controller",
-                dns_backend=ctx.dns_backend)
+                            targetdir=ctx.targetdir, samdb_fill=FILL_DRS,
+                            realm=ctx.new_realm, lp=non_global_lp,
+                            rootdn=ctx.rename_dn(ctx.root_dn), domaindn=ctx.new_base_dn,
+                            schemadn=ctx.rename_dn(ctx.schema_dn),
+                            configdn=ctx.rename_dn(ctx.config_dn),
+                            domain=ctx.new_domain_name, domainsid=ctx.domsid,
+                            serverrole="active directory domain controller",
+                            dns_backend=ctx.dns_backend)
 
         print("Provision OK for renamed domain DN %s" % presult.domaindn)
         ctx.local_samdb = presult.samdb
index ceb1be9311351453ae0d2fd00782cc942c51b72f..7704cb80f5d259fa99d0d6578728ceb83b3045a3 100644 (file)
@@ -34,9 +34,9 @@ class PlainHelpFormatter(optparse.IndentedHelpFormatter):
         paragraphs = description.split('\n')
         wrapped_paragraphs = [
             textwrap.fill(p,
-                    desc_width,
-                    initial_indent=indent,
-                    subsequent_indent=indent)
+                          desc_width,
+                          initial_indent=indent,
+                          subsequent_indent=indent)
             for p in paragraphs]
         result = "\n".join(wrapped_paragraphs) + "\n"
         return result
index 2d0ff620baee5a2980b48a9960be93febe79ad5d..c68cbabf42e98d3eed019dc245dd6a96699b53a9 100644 (file)
@@ -58,7 +58,7 @@ def netcmd_finddc(lp, creds, realm=None):
     if realm is None:
         realm = lp.get('realm')
     cldap_ret = net.finddc(domain=realm,
-                flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)
+                           flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)
     return cldap_ret.pdc_dns_name
 
 
@@ -67,5 +67,5 @@ def netcmd_get_domain_infos_via_cldap(lp, creds, address=None):
        DC with the specified address'''
     net = Net(creds=creds, lp=lp)
     cldap_ret = net.finddc(address=address,
-                flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS)
+                           flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS)
     return cldap_ret
index 7f5f07182597f37b77c871dccc8f59658a580a97..39d29af6264cd52895cc91430460bfc90745ba15 100644 (file)
@@ -421,7 +421,7 @@ class cmd_computer_list(Command):
         creds = credopts.get_credentials(lp, fallback_machine=True)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         filter = "(sAMAccountType=%u)" % (dsdb.ATYPE_WORKSTATION_TRUST)
 
index bd4f60f6bec43e39dc974b52e0e347792913ba07..073510c1a26d05989b2b3b3d278da02fb0cd7b38 100644 (file)
@@ -57,7 +57,7 @@ class cmd_dbcheck(Command):
 
     takes_options = [
         Option("--scope", dest="scope", default="SUB",
-            help="Pass search scope that builds DN list. Options: SUB, ONE, BASE"),
+               help="Pass search scope that builds DN list. Options: SUB, ONE, BASE"),
         Option("--fix", dest="fix", default=False, action='store_true',
                help='Fix any errors found'),
         Option("--yes", action='callback', callback=process_yes,
@@ -65,9 +65,9 @@ class cmd_dbcheck(Command):
         Option("--cross-ncs", dest="cross_ncs", default=False, action='store_true',
                help="cross naming context boundaries"),
         Option("-v", "--verbose", dest="verbose", action="store_true", default=False,
-            help="Print more details of checking"),
+               help="Print more details of checking"),
         Option("-q", "--quiet", action="store_true", default=False,
-            help="don't print details of checking"),
+               help="don't print details of checking"),
         Option("--attrs", dest="attrs", default=None, help="list of attributes to check (space separated)"),
         Option("--reindex", dest="reindex", default=False, action="store_true", help="force database re-index"),
         Option("--force-modules", dest="force_modules", default=False, action="store_true", help="force loading of Samba modules and ignore the @MODULES record (for very old databases)"),
@@ -154,7 +154,7 @@ class cmd_dbcheck(Command):
 
             else:
                 error_count = chk.check_database(DN=DN, scope=search_scope,
-                        controls=controls, attrs=attrs)
+                                                 controls=controls, attrs=attrs)
         except:
             if started_transaction:
                 samdb.transaction_cancel()
index 5eb4bb01b3c88a9b81188ec42a226b83d481530b..d8b7a79619e5e8a17249148c8787de5b026073cf 100644 (file)
@@ -68,9 +68,9 @@ class cmd_delegation_show(Command):
         (cleanedaccount, realm, domain) = _get_user_realm_domain(accountname)
 
         res = sam.search(expression="sAMAccountName=%s" %
-                    ldb.binary_encode(cleanedaccount),
-                    scope=ldb.SCOPE_SUBTREE,
-                    attrs=["userAccountControl", "msDS-AllowedToDelegateTo"])
+                         ldb.binary_encode(cleanedaccount),
+                         scope=ldb.SCOPE_SUBTREE,
+                         attrs=["userAccountControl", "msDS-AllowedToDelegateTo"])
         if len(res) == 0:
             raise CommandError("Unable to find account name '%s'" % accountname)
         assert(len(res) == 1)
@@ -80,9 +80,9 @@ class cmd_delegation_show(Command):
 
         self.outf.write("Account-DN: %s\n" %  str(res[0].dn))
         self.outf.write("UF_TRUSTED_FOR_DELEGATION: %s\n"
-            % bool(uac & dsdb.UF_TRUSTED_FOR_DELEGATION))
+                        % bool(uac & dsdb.UF_TRUSTED_FOR_DELEGATION))
         self.outf.write("UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: %s\n" %
-              bool(uac & dsdb.UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION))
+                        bool(uac & dsdb.UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION))
 
         if allowed is not None:
             for a in allowed:
@@ -190,8 +190,8 @@ class cmd_delegation_for_any_protocol(Command):
         flag = dsdb.UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION
         try:
             sam.toggle_userAccountFlags(search_filter, flag,
-                        flags_str="Trusted-to-Authenticate-for-Delegation",
-                        on=on, strict=True)
+                                        flags_str="Trusted-to-Authenticate-for-Delegation",
+                                        on=on, strict=True)
         except Exception as err:
             raise CommandError(err)
 
@@ -242,8 +242,8 @@ class cmd_delegation_add_service(Command):
         msg = ldb.Message()
         msg.dn = res[0].dn
         msg["msDS-AllowedToDelegateTo"] = ldb.MessageElement([principal],
-                                          ldb.FLAG_MOD_ADD,
-                                          "msDS-AllowedToDelegateTo")
+                                                             ldb.FLAG_MOD_ADD,
+                                                             "msDS-AllowedToDelegateTo")
         try:
             sam.modify(msg)
         except Exception as err:
@@ -296,8 +296,8 @@ class cmd_delegation_del_service(Command):
         msg = ldb.Message()
         msg.dn = res[0].dn
         msg["msDS-AllowedToDelegateTo"] = ldb.MessageElement([principal],
-                                          ldb.FLAG_MOD_DELETE,
-                                          "msDS-AllowedToDelegateTo")
+                                                             ldb.FLAG_MOD_DELETE,
+                                                             "msDS-AllowedToDelegateTo")
         try:
             sam.modify(msg)
         except Exception as err:
index 76871ac29346bce50c480154ca1159d2609c12f0..04a395cd34bfeb1904a59cbe53fb9fd6aed13eda 100644 (file)
@@ -123,7 +123,7 @@ def zone_notify_level_string(notify_level):
 
 def dp_flags_string(dp_flags):
     bitmap_defs = [ 'DNS_DP_AUTOCREATED', 'DNS_DP_LEGACY', 'DNS_DP_DOMAIN_DEFAULT',
-                'DNS_DP_FOREST_DEFAULT', 'DNS_DP_ENLISTED', 'DNS_DP_DELETED' ]
+                    'DNS_DP_FOREST_DEFAULT', 'DNS_DP_ENLISTED', 'DNS_DP_DELETED' ]
     return bitmap_string(dnsserver, bitmap_defs, dp_flags)
 
 
@@ -986,7 +986,7 @@ class cmd_update_record(Command):
         dns_conn = dns_connect(server, self.lp, self.creds)
 
         rec_match = dns_record_match(dns_conn, server, zone, name, record_type,
-                olddata)
+                                     olddata)
         if not rec_match:
             raise CommandError('Record or zone does not exist.')
 
index beec7b303045c15ac2d53c2ec93b0793f061b1ce..80834054055f3eb9eda2ae6f2d8047bebbfe3759 100644 (file)
@@ -514,28 +514,28 @@ class cmd_domain_provision(Command):
             backend_store = get_default_backend_store()
         try:
             result = provision(self.logger,
-                  session, smbconf=smbconf, targetdir=targetdir,
-                  samdb_fill=samdb_fill, realm=realm, domain=domain,
-                  domainguid=domain_guid, domainsid=domain_sid,
-                  hostname=host_name,
-                  hostip=host_ip, hostip6=host_ip6,
-                  sitename=site, ntdsguid=ntds_guid,
-                  invocationid=invocationid, adminpass=adminpass,
-                  krbtgtpass=krbtgtpass, machinepass=machinepass,
-                  dns_backend=dns_backend, dns_forwarder=dns_forwarder,
-                  dnspass=dnspass, root=root, nobody=nobody,
-                  users=users,
-                  serverrole=server_role, dom_for_fun_level=dom_for_fun_level,
-                  backend_type=ldap_backend_type,
-                  ldapadminpass=ldapadminpass, ol_mmr_urls=ol_mmr_urls, slapd_path=slapd_path,
-                  useeadb=eadb, next_rid=next_rid, lp=lp, use_ntvfs=use_ntvfs,
-                  use_rfc2307=use_rfc2307, skip_sysvolacl=False,
-                  ldap_backend_extra_port=ldap_backend_extra_port,
-                  ldap_backend_forced_uri=ldap_backend_forced_uri,
-                  nosync=ldap_backend_nosync, ldap_dryrun_mode=ldap_dryrun_mode,
-                  base_schema=base_schema,
-                  plaintext_secrets=plaintext_secrets,
-                  backend_store=backend_store)
+                               session, smbconf=smbconf, targetdir=targetdir,
+                               samdb_fill=samdb_fill, realm=realm, domain=domain,
+                               domainguid=domain_guid, domainsid=domain_sid,
+                               hostname=host_name,
+                               hostip=host_ip, hostip6=host_ip6,
+                               sitename=site, ntdsguid=ntds_guid,
+                               invocationid=invocationid, adminpass=adminpass,
+                               krbtgtpass=krbtgtpass, machinepass=machinepass,
+                               dns_backend=dns_backend, dns_forwarder=dns_forwarder,
+                               dnspass=dnspass, root=root, nobody=nobody,
+                               users=users,
+                               serverrole=server_role, dom_for_fun_level=dom_for_fun_level,
+                               backend_type=ldap_backend_type,
+                               ldapadminpass=ldapadminpass, ol_mmr_urls=ol_mmr_urls, slapd_path=slapd_path,
+                               useeadb=eadb, next_rid=next_rid, lp=lp, use_ntvfs=use_ntvfs,
+                               use_rfc2307=use_rfc2307, skip_sysvolacl=False,
+                               ldap_backend_extra_port=ldap_backend_extra_port,
+                               ldap_backend_forced_uri=ldap_backend_forced_uri,
+                               nosync=ldap_backend_nosync, ldap_dryrun_mode=ldap_dryrun_mode,
+                               base_schema=base_schema,
+                               plaintext_secrets=plaintext_secrets,
+                               backend_store=backend_store)
 
         except ProvisioningError as e:
             raise CommandError("Provision failed", e)
@@ -809,8 +809,8 @@ class cmd_domain_demote(Command):
 
         ntds_guid = samdb.get_ntds_GUID()
         msg = samdb.search(base=str(samdb.get_config_basedn()),
-            scope=ldb.SCOPE_SUBTREE, expression="(objectGUID=%s)" % ntds_guid,
-            attrs=['options'])
+                           scope=ldb.SCOPE_SUBTREE, expression="(objectGUID=%s)" % ntds_guid,
+                           attrs=['options'])
         if len(msg) == 0 or "options" not in msg[0]:
             raise CommandError("Failed to find options on %s" % ntds_guid)
 
@@ -870,14 +870,14 @@ class cmd_domain_demote(Command):
                         raise CommandError("Error while sending a DsReplicaSync for partition '%s'" % str(part), string)
         try:
             remote_samdb = SamDB(url="ldap://%s" % server,
-                                session_info=system_session(),
-                                credentials=creds, lp=lp)
+                                 session_info=system_session(),
+                                 credentials=creds, lp=lp)
 
             self.errf.write("Changing userControl and container\n")
             res = remote_samdb.search(base=str(remote_samdb.domain_dn()),
-                                expression="(&(objectClass=user)(sAMAccountName=%s$))" %
+                                      expression="(&(objectClass=user)(sAMAccountName=%s$))" %
                                       netbios_name.upper(),
-                                attrs=["userAccountControl"])
+                                      attrs=["userAccountControl"])
             dc_dn = res[0].dn
             uac = int(str(res[0]["userAccountControl"]))
 
@@ -954,8 +954,8 @@ class cmd_domain_demote(Command):
                 msg.dn = dc_dn
 
                 msg["userAccountControl"] = ldb.MessageElement("%d" % uac,
-                                                        ldb.FLAG_MOD_REPLACE,
-                                                        "userAccountControl")
+                                                               ldb.FLAG_MOD_REPLACE,
+                                                               "userAccountControl")
 
                 remote_samdb.modify(msg)
 
@@ -980,8 +980,8 @@ class cmd_domain_demote(Command):
             msg.dn = dc_dn
 
             msg["userAccountControl"] = ldb.MessageElement("%d" % uac,
-                                                    ldb.FLAG_MOD_REPLACE,
-                                                    "userAccountControl")
+                                                           ldb.FLAG_MOD_REPLACE,
+                                                           "userAccountControl")
 
             remote_samdb.modify(msg)
             raise CommandError("Error while renaming %s to %s" % (str(dc_dn), str(newdn)), e)
@@ -1032,7 +1032,7 @@ class cmd_domain_demote(Command):
                   "CN=NTFRS Subscriptions"):
             try:
                 remote_samdb.delete(ldb.Dn(remote_samdb,
-                                    "%s,%s" % (s, str(newdn))))
+                                           "%s,%s" % (s, str(newdn))))
             except ldb.LdbError as l:
                 pass
 
@@ -1059,10 +1059,10 @@ class cmd_domain_level(Command):
                metavar="URL", dest="H"),
         Option("-q", "--quiet", help="Be quiet", action="store_true"), # unused
         Option("--forest-level", type="choice", choices=["2003", "2008", "2008_R2", "2012", "2012_R2"],
-            help="The forest function level (2003 | 2008 | 2008_R2 | 2012 | 2012_R2)"),
+               help="The forest function level (2003 | 2008 | 2008_R2 | 2012 | 2012_R2)"),
         Option("--domain-level", type="choice", choices=["2003", "2008", "2008_R2", "2012", "2012_R2"],
-            help="The domain function level (2003 | 2008 | 2008_R2 | 2012 | 2012_R2)")
-            ]
+               help="The domain function level (2003 | 2008 | 2008_R2 | 2012 | 2012_R2)")
+        ]
 
     takes_args = ["subcommand"]
 
@@ -1072,21 +1072,21 @@ class cmd_domain_level(Command):
         creds = credopts.get_credentials(lp, fallback_machine=True)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         domain_dn = samdb.domain_dn()
 
         res_forest = samdb.search("CN=Partitions,%s" % samdb.get_config_basedn(),
-          scope=ldb.SCOPE_BASE, attrs=["msDS-Behavior-Version"])
+                                  scope=ldb.SCOPE_BASE, attrs=["msDS-Behavior-Version"])
         assert len(res_forest) == 1
 
         res_domain = samdb.search(domain_dn, scope=ldb.SCOPE_BASE,
-          attrs=["msDS-Behavior-Version", "nTMixedDomain"])
+                                  attrs=["msDS-Behavior-Version", "nTMixedDomain"])
         assert len(res_domain) == 1
 
         res_dc_s = samdb.search("CN=Sites,%s" % samdb.get_config_basedn(),
-          scope=ldb.SCOPE_SUBTREE, expression="(objectClass=nTDSDSA)",
-          attrs=["msDS-Behavior-Version"])
+                                scope=ldb.SCOPE_SUBTREE, expression="(objectClass=nTDSDSA)",
+                                attrs=["msDS-Behavior-Version"])
         assert len(res_dc_s) >= 1
 
         # default values, since "msDS-Behavior-Version" does not exist on Windows 2000 AD
@@ -1209,13 +1209,13 @@ class cmd_domain_level(Command):
                     m = ldb.Message()
                     m.dn = ldb.Dn(samdb, domain_dn)
                     m["nTMixedDomain"] = ldb.MessageElement("0",
-                      ldb.FLAG_MOD_REPLACE, "nTMixedDomain")
+                                                            ldb.FLAG_MOD_REPLACE, "nTMixedDomain")
                     samdb.modify(m)
                     # Under partitions
                     m = ldb.Message()
                     m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup") + ",CN=Partitions,%s" % samdb.get_config_basedn())
                     m["nTMixedDomain"] = ldb.MessageElement("0",
-                      ldb.FLAG_MOD_REPLACE, "nTMixedDomain")
+                                                            ldb.FLAG_MOD_REPLACE, "nTMixedDomain")
                     try:
                         samdb.modify(m)
                     except ldb.LdbError as e:
@@ -1233,7 +1233,7 @@ class cmd_domain_level(Command):
                 # Under partitions
                 m = ldb.Message()
                 m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup")
-                  + ",CN=Partitions,%s" % samdb.get_config_basedn())
+                              + ",CN=Partitions,%s" % samdb.get_config_basedn())
                 m["msDS-Behavior-Version"]= ldb.MessageElement(
                     str(new_level_domain), ldb.FLAG_MOD_REPLACE,
                           "msDS-Behavior-Version")
@@ -1297,13 +1297,13 @@ class cmd_domain_passwordsettings_show(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         domain_dn = samdb.domain_dn()
         res = samdb.search(domain_dn, scope=ldb.SCOPE_BASE,
-          attrs=["pwdProperties", "pwdHistoryLength", "minPwdLength",
-                 "minPwdAge", "maxPwdAge", "lockoutDuration", "lockoutThreshold",
-                 "lockOutObservationWindow"])
+                           attrs=["pwdProperties", "pwdHistoryLength", "minPwdLength",
+                                  "minPwdAge", "maxPwdAge", "lockoutDuration", "lockoutThreshold",
+                                  "lockOutObservationWindow"])
         assert(len(res) == 1)
         try:
             pwd_props = int(res[0]["pwdProperties"][0])
@@ -1366,24 +1366,24 @@ class cmd_domain_passwordsettings_set(Command):
                metavar="URL", dest="H"),
         Option("-q", "--quiet", help="Be quiet", action="store_true"), # unused
         Option("--complexity", type="choice", choices=["on","off","default"],
-          help="The password complexity (on | off | default). Default is 'on'"),
+               help="The password complexity (on | off | default). Default is 'on'"),
         Option("--store-plaintext", type="choice", choices=["on","off","default"],
-          help="Store plaintext passwords where account have 'store passwords with reversible encryption' set (on | off | default). Default is 'off'"),
+               help="Store plaintext passwords where account have 'store passwords with reversible encryption' set (on | off | default). Default is 'off'"),
         Option("--history-length",
-          help="The password history length (<integer> | default).  Default is 24.", type=str),
+               help="The password history length (<integer> | default).  Default is 24.", type=str),
         Option("--min-pwd-length",
-          help="The minimum password length (<integer> | default).  Default is 7.", type=str),
+               help="The minimum password length (<integer> | default).  Default is 7.", type=str),
         Option("--min-pwd-age",
-          help="The minimum password age (<integer in days> | default).  Default is 1.", type=str),
+               help="The minimum password age (<integer in days> | default).  Default is 1.", type=str),
         Option("--max-pwd-age",
-          help="The maximum password age (<integer in days> | default).  Default is 43.", type=str),
+               help="The maximum password age (<integer in days> | default).  Default is 43.", type=str),
         Option("--account-lockout-duration",
-          help="The the length of time an account is locked out after exeeding the limit on bad password attempts (<integer in mins> | default).  Default is 30 mins.", type=str),
+               help="The the length of time an account is locked out after exeeding the limit on bad password attempts (<integer in mins> | default).  Default is 30 mins.", type=str),
         Option("--account-lockout-threshold",
-          help="The number of bad password attempts allowed before locking out the account (<integer> | default).  Default is 0 (never lock out).", type=str),
+               help="The number of bad password attempts allowed before locking out the account (<integer> | default).  Default is 0 (never lock out).", type=str),
         Option("--reset-account-lockout-after",
-          help="After this time is elapsed, the recorded number of attempts restarts from zero (<integer> | default).  Default is 30.", type=str),
-          ]
+               help="After this time is elapsed, the recorded number of attempts restarts from zero (<integer> | default).  Default is 30.", type=str),
+        ]
 
     def run(self, H=None, min_pwd_age=None, max_pwd_age=None,
             quiet=False, complexity=None, store_plaintext=None, history_length=None,
@@ -1394,7 +1394,7 @@ class cmd_domain_passwordsettings_set(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         domain_dn = samdb.domain_dn()
         msgs = []
@@ -1420,7 +1420,7 @@ class cmd_domain_passwordsettings_set(Command):
 
         if complexity is not None or store_plaintext is not None:
             m["pwdProperties"] = ldb.MessageElement(str(pwd_props),
-              ldb.FLAG_MOD_REPLACE, "pwdProperties")
+                                                    ldb.FLAG_MOD_REPLACE, "pwdProperties")
 
         if history_length is not None:
             if history_length == "default":
@@ -1432,7 +1432,7 @@ class cmd_domain_passwordsettings_set(Command):
                 raise CommandError("Password history length must be in the range of 0 to 24!")
 
             m["pwdHistoryLength"] = ldb.MessageElement(str(pwd_hist_len),
-              ldb.FLAG_MOD_REPLACE, "pwdHistoryLength")
+                                                       ldb.FLAG_MOD_REPLACE, "pwdHistoryLength")
             msgs.append("Password history length changed!")
 
         if min_pwd_length is not None:
@@ -1445,7 +1445,7 @@ class cmd_domain_passwordsettings_set(Command):
                 raise CommandError("Minimum password length must be in the range of 0 to 14!")
 
             m["minPwdLength"] = ldb.MessageElement(str(min_pwd_len),
-              ldb.FLAG_MOD_REPLACE, "minPwdLength")
+                                                   ldb.FLAG_MOD_REPLACE, "minPwdLength")
             msgs.append("Minimum password length changed!")
 
         if min_pwd_age is not None:
@@ -1461,7 +1461,7 @@ class cmd_domain_passwordsettings_set(Command):
             min_pwd_age_ticks = -int(min_pwd_age * (24 * 60 * 60 * 1e7))
 
             m["minPwdAge"] = ldb.MessageElement(str(min_pwd_age_ticks),
-              ldb.FLAG_MOD_REPLACE, "minPwdAge")
+                                                ldb.FLAG_MOD_REPLACE, "minPwdAge")
             msgs.append("Minimum password age changed!")
 
         if max_pwd_age is not None:
@@ -1480,7 +1480,7 @@ class cmd_domain_passwordsettings_set(Command):
                 max_pwd_age_ticks = -int(max_pwd_age * (24 * 60 * 60 * 1e7))
 
             m["maxPwdAge"] = ldb.MessageElement(str(max_pwd_age_ticks),
-              ldb.FLAG_MOD_REPLACE, "maxPwdAge")
+                                                ldb.FLAG_MOD_REPLACE, "maxPwdAge")
             msgs.append("Maximum password age changed!")
 
         if account_lockout_duration is not None:
@@ -1499,7 +1499,7 @@ class cmd_domain_passwordsettings_set(Command):
                 account_lockout_duration_ticks = -int(account_lockout_duration * (60 * 1e7))
 
             m["lockoutDuration"] = ldb.MessageElement(str(account_lockout_duration_ticks),
-              ldb.FLAG_MOD_REPLACE, "lockoutDuration")
+                                                      ldb.FLAG_MOD_REPLACE, "lockoutDuration")
             msgs.append("Account lockout duration changed!")
 
         if account_lockout_threshold is not None:
@@ -1509,7 +1509,7 @@ class cmd_domain_passwordsettings_set(Command):
                 account_lockout_threshold = int(account_lockout_threshold)
 
             m["lockoutThreshold"] = ldb.MessageElement(str(account_lockout_threshold),
-              ldb.FLAG_MOD_REPLACE, "lockoutThreshold")
+                                                       ldb.FLAG_MOD_REPLACE, "lockoutThreshold")
             msgs.append("Account lockout threshold changed!")
 
         if reset_account_lockout_after is not None:
@@ -1528,7 +1528,7 @@ class cmd_domain_passwordsettings_set(Command):
                 reset_account_lockout_after_ticks = -int(reset_account_lockout_after * (60 * 1e7))
 
             m["lockOutObservationWindow"] = ldb.MessageElement(str(reset_account_lockout_after_ticks),
-              ldb.FLAG_MOD_REPLACE, "lockOutObservationWindow")
+                                                               ldb.FLAG_MOD_REPLACE, "lockOutObservationWindow")
             msgs.append("Duration to reset account lockout after changed!")
 
         if max_pwd_age and max_pwd_age > 0 and min_pwd_age >= max_pwd_age:
@@ -1649,7 +1649,7 @@ class cmd_domain_classicupgrade(Command):
             try:
                 try:
                     samba.ntacls.setntacl(lp, tmpfile.name,
-                                "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native")
+                                          "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native")
                     eadb = False
                 except Exception:
                     # FIXME: Don't catch all exceptions here
@@ -1848,7 +1848,7 @@ class DomainTrustCommand(Command):
             nbt.NBT_SERVER_FOREST_ROOT: "FOREST_ROOT",
         }
         server_type_string = self.generic_bitmap_to_string(flag_map,
-                                remote_info.server_type, names_only=True)
+                                                           remote_info.server_type, names_only=True)
         self.outf.write("RemoteDC Netbios[%s] DNS[%s] ServerType[%s]\n" % (
                         remote_info.pdc_name,
                         remote_info.pdc_dns_name,
@@ -2109,10 +2109,11 @@ class cmd_domain_trust_list(DomainTrustCommand):
             raise self.LocalRuntimeError(self, error, "failed to connect netlogon server")
 
         try:
-            local_netlogon_trusts = local_netlogon.netr_DsrEnumerateDomainTrusts(local_server,
-                                    netlogon.NETR_TRUST_FLAG_IN_FOREST |
-                                    netlogon.NETR_TRUST_FLAG_OUTBOUND |
-                                    netlogon.NETR_TRUST_FLAG_INBOUND)
+            local_netlogon_trusts = \
+                local_netlogon.netr_DsrEnumerateDomainTrusts(local_server,
+                                                             netlogon.NETR_TRUST_FLAG_IN_FOREST |
+                                                             netlogon.NETR_TRUST_FLAG_OUTBOUND |
+                                                             netlogon.NETR_TRUST_FLAG_INBOUND)
         except RuntimeError as error:
             if self.check_runtime_error(error, werror.WERR_RPC_S_PROCNUM_OUT_OF_RANGE):
                 # TODO: we could implement a fallback to lsa.EnumTrustDom()
@@ -2169,8 +2170,10 @@ class cmd_domain_trust_show(DomainTrustCommand):
         lsaString = lsa.String()
         lsaString.string = domain
         try:
-            local_tdo_full = local_lsa.QueryTrustedDomainInfoByName(local_policy,
-                                        lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
+            local_tdo_full = \
+                local_lsa.QueryTrustedDomainInfoByName(local_policy,
+                                                       lsaString,
+                                                       lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
             local_tdo_info = local_tdo_full.info_ex
             local_tdo_posix = local_tdo_full.posix_offset
         except NTSTATUSError as error:
@@ -2180,8 +2183,10 @@ class cmd_domain_trust_show(DomainTrustCommand):
             raise self.LocalRuntimeError(self, error, "QueryTrustedDomainInfoByName(FULL_INFO) failed")
 
         try:
-            local_tdo_enctypes = local_lsa.QueryTrustedDomainInfoByName(local_policy,
-                                        lsaString, lsa.LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES)
+            local_tdo_enctypes = \
+                local_lsa.QueryTrustedDomainInfoByName(local_policy,
+                                                       lsaString,
+                                                       lsa.LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES)
         except NTSTATUSError as error:
             if self.check_runtime_error(error, ntstatus.NT_STATUS_INVALID_PARAMETER):
                 error = None
@@ -2190,7 +2195,7 @@ class cmd_domain_trust_show(DomainTrustCommand):
 
             if error is not None:
                 raise self.LocalRuntimeError(self, error,
-                           "QueryTrustedDomainInfoByName(SUPPORTED_ENCRYPTION_TYPES) failed")
+                                             "QueryTrustedDomainInfoByName(SUPPORTED_ENCRYPTION_TYPES) failed")
 
             local_tdo_enctypes = lsa.TrustDomainInfoSupportedEncTypes()
             local_tdo_enctypes.enc_types = 0
@@ -2198,8 +2203,10 @@ class cmd_domain_trust_show(DomainTrustCommand):
         try:
             local_tdo_forest = None
             if local_tdo_info.trust_attributes & lsa.LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE:
-                local_tdo_forest = local_lsa.lsaRQueryForestTrustInformation(local_policy,
-                                        lsaString, lsa.LSA_FOREST_TRUST_DOMAIN_INFO)
+                local_tdo_forest = \
+                    local_lsa.lsaRQueryForestTrustInformation(local_policy,
+                                                              lsaString,
+                                                              lsa.LSA_FOREST_TRUST_DOMAIN_INFO)
         except RuntimeError as error:
             if self.check_runtime_error(error, ntstatus.NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE):
                 error = None
@@ -2458,47 +2465,55 @@ class cmd_domain_trust_create(DomainTrustCommand):
 
         try:
             lsaString.string = local_trust_info.domain_name.string
-            local_old_netbios = local_lsa.QueryTrustedDomainInfoByName(local_policy,
-                                        lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
+            local_old_netbios = \
+                local_lsa.QueryTrustedDomainInfoByName(local_policy,
+                                                       lsaString,
+                                                       lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
             raise CommandError("TrustedDomain %s already exist'" % lsaString.string)
         except NTSTATUSError as error:
             if not self.check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
                 raise self.LocalRuntimeError(self, error,
-                                "QueryTrustedDomainInfoByName(%s, FULL_INFO) failed" % (
+                                             "QueryTrustedDomainInfoByName(%s, FULL_INFO) failed" % (
                                     lsaString.string))
 
         try:
             lsaString.string = local_trust_info.netbios_name.string
-            local_old_dns = local_lsa.QueryTrustedDomainInfoByName(local_policy,
-                                        lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
+            local_old_dns = \
+                local_lsa.QueryTrustedDomainInfoByName(local_policy,
+                                                       lsaString,
+                                                       lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
             raise CommandError("TrustedDomain %s already exist'" % lsaString.string)
         except NTSTATUSError as error:
             if not self.check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
                 raise self.LocalRuntimeError(self, error,
-                                "QueryTrustedDomainInfoByName(%s, FULL_INFO) failed" % (
+                                             "QueryTrustedDomainInfoByName(%s, FULL_INFO) failed" % (
                                     lsaString.string))
 
         if remote_trust_info:
             try:
                 lsaString.string = remote_trust_info.domain_name.string
-                remote_old_netbios = remote_lsa.QueryTrustedDomainInfoByName(remote_policy,
-                                            lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
+                remote_old_netbios = \
+                    remote_lsa.QueryTrustedDomainInfoByName(remote_policy,
+                                                            lsaString,
+                                                            lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
                 raise CommandError("TrustedDomain %s already exist'" % lsaString.string)
             except NTSTATUSError as error:
                 if not self.check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
                     raise self.RemoteRuntimeError(self, error,
-                                    "QueryTrustedDomainInfoByName(%s, FULL_INFO) failed" % (
+                                                  "QueryTrustedDomainInfoByName(%s, FULL_INFO) failed" % (
                                         lsaString.string))
 
             try:
                 lsaString.string = remote_trust_info.netbios_name.string
-                remote_old_dns = remote_lsa.QueryTrustedDomainInfoByName(remote_policy,
-                                            lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
+                remote_old_dns = \
+                    remote_lsa.QueryTrustedDomainInfoByName(remote_policy,
+                                                            lsaString,
+                                                            lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)
                 raise CommandError("TrustedDomain %s already exist'" % lsaString.string)
             except NTSTATUSError as error:
                 if not self.check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
                     raise self.RemoteRuntimeError(self, error,
-                                    "QueryTrustedDomainInfoByName(%s, FULL_INFO) failed" % (
+                                                  "QueryTrustedDomainInfoByName(%s, FULL_INFO) failed" % (
                                         lsaString.string))
 
         try:
@@ -2592,10 +2607,11 @@ class cmd_domain_trust_create(DomainTrustCommand):
             if remote_trust_info:
                 self.outf.write("Creating remote TDO.\n")
                 current_request = { "location": "remote", "name": "CreateTrustedDomainEx2"}
-                remote_tdo_handle = remote_lsa.CreateTrustedDomainEx2(remote_policy,
-                                                                      remote_trust_info,
-                                                                      remote_auth_info,
-                                                                      lsa.LSA_TRUSTED_DOMAIN_ALL_ACCESS)
+                remote_tdo_handle = \
+                    remote_lsa.CreateTrustedDomainEx2(remote_policy,
+                                                      remote_trust_info,
+                                                      remote_auth_info,
+                                                      lsa.LSA_TRUSTED_DOMAIN_ALL_ACCESS)
                 self.outf.write("Remote TDO created.\n")
                 if enc_types:
                     self.outf.write("Setting supported encryption types on remote TDO.\n")
@@ -2642,19 +2658,21 @@ class cmd_domain_trust_create(DomainTrustCommand):
                     # this triggers netr_GetForestTrustInformation to the remote domain
                     # and lsaRSetForestTrustInformation() locally, but new top level
                     # names are disabled by default.
-                    local_forest_info = local_netlogon.netr_DsRGetForestTrustInformation(local_netlogon_info.dc_unc,
-                                                                  remote_lsa_info.dns_domain.string,
-                                                                  netlogon.DS_GFTI_UPDATE_TDO)
+                    local_forest_info = \
+                        local_netlogon.netr_DsRGetForestTrustInformation(local_netlogon_info.dc_unc,
+                                                                         remote_lsa_info.dns_domain.string,
+                                                                         netlogon.DS_GFTI_UPDATE_TDO)
                 except RuntimeError as error:
                     raise self.LocalRuntimeError(self, error, "netr_DsRGetForestTrustInformation() failed")
 
                 try:
                     # here we try to enable all top level names
-                    local_forest_collision = local_lsa.lsaRSetForestTrustInformation(local_policy,
-                                                                  remote_lsa_info.dns_domain,
-                                                                  lsa.LSA_FOREST_TRUST_DOMAIN_INFO,
-                                                                  local_forest_info,
-                                                                  0)
+                    local_forest_collision = \
+                        local_lsa.lsaRSetForestTrustInformation(local_policy,
+                                                                remote_lsa_info.dns_domain,
+                                                                lsa.LSA_FOREST_TRUST_DOMAIN_INFO,
+                                                                local_forest_info,
+                                                                0)
                 except RuntimeError as error:
                     raise self.LocalRuntimeError(self, error, "lsaRSetForestTrustInformation() failed")
 
@@ -2669,19 +2687,21 @@ class cmd_domain_trust_create(DomainTrustCommand):
                         # this triggers netr_GetForestTrustInformation to our domain.
                         # and lsaRSetForestTrustInformation() remotely, but new top level
                         # names are disabled by default.
-                        remote_forest_info = remote_netlogon.netr_DsRGetForestTrustInformation(remote_netlogon_dc_unc,
-                                                                                               local_lsa_info.dns_domain.string,
-                                                                                               netlogon.DS_GFTI_UPDATE_TDO)
+                        remote_forest_info = \
+                            remote_netlogon.netr_DsRGetForestTrustInformation(remote_netlogon_dc_unc,
+                                                                              local_lsa_info.dns_domain.string,
+                                                                              netlogon.DS_GFTI_UPDATE_TDO)
                     except RuntimeError as error:
                         raise self.RemoteRuntimeError(self, error, "netr_DsRGetForestTrustInformation() failed")
 
                     try:
                         # here we try to enable all top level names
-                        remote_forest_collision = remote_lsa.lsaRSetForestTrustInformation(remote_policy,
-                                                                      local_lsa_info.dns_domain,
-                                                                      lsa.LSA_FOREST_TRUST_DOMAIN_INFO,
-                                                                      remote_forest_info,
-                                                                      0)
+                        remote_forest_collision = \
+                            remote_lsa.lsaRSetForestTrustInformation(remote_policy,
+                                                                     local_lsa_info.dns_domain,
+                                                                     lsa.LSA_FOREST_TRUST_DOMAIN_INFO,
+                                                                     remote_forest_info,
+                                                                     0)
                     except RuntimeError as error:
                         raise self.RemoteRuntimeError(self, error, "lsaRSetForestTrustInformation() failed")
 
@@ -2693,9 +2713,9 @@ class cmd_domain_trust_create(DomainTrustCommand):
                 self.outf.write("Validating outgoing trust...\n")
                 try:
                     local_trust_verify = local_netlogon.netr_LogonControl2Ex(local_netlogon_info.dc_unc,
-                                                                      netlogon.NETLOGON_CONTROL_TC_VERIFY,
-                                                                      2,
-                                                                      remote_lsa_info.dns_domain.string)
+                                                                             netlogon.NETLOGON_CONTROL_TC_VERIFY,
+                                                                             2,
+                                                                             remote_lsa_info.dns_domain.string)
                 except RuntimeError as error:
                     raise self.LocalRuntimeError(self, error, "NETLOGON_CONTROL_TC_VERIFY failed")
 
@@ -2722,10 +2742,11 @@ class cmd_domain_trust_create(DomainTrustCommand):
                 if remote_trust_info.trust_direction & lsa.LSA_TRUST_DIRECTION_OUTBOUND:
                     self.outf.write("Validating incoming trust...\n")
                     try:
-                        remote_trust_verify = remote_netlogon.netr_LogonControl2Ex(remote_netlogon_dc_unc,
-                                                                                   netlogon.NETLOGON_CONTROL_TC_VERIFY,
-                                                                                   2,
-                                                                                   local_lsa_info.dns_domain.string)
+                        remote_trust_verify = \
+                            remote_netlogon.netr_LogonControl2Ex(remote_netlogon_dc_unc,
+                                                                 netlogon.NETLOGON_CONTROL_TC_VERIFY,
+                                                                 2,
+                                                                 local_lsa_info.dns_domain.string)
                     except RuntimeError as error:
                         raise self.RemoteRuntimeError(self, error, "NETLOGON_CONTROL_TC_VERIFY failed")
 
@@ -2825,7 +2846,7 @@ class cmd_domain_trust_delete(DomainTrustCommand):
         try:
             lsaString.string = domain
             local_tdo_info = local_lsa.QueryTrustedDomainInfoByName(local_policy,
-                                        lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_INFO_EX)
+                                                                    lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_INFO_EX)
         except NTSTATUSError as error:
             if self.check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
                 raise CommandError("Failed to find trust for domain '%s'" % domain)
@@ -2863,8 +2884,10 @@ class cmd_domain_trust_delete(DomainTrustCommand):
 
             try:
                 lsaString.string = local_lsa_info.dns_domain.string
-                remote_tdo_info = remote_lsa.QueryTrustedDomainInfoByName(remote_policy,
-                                            lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_INFO_EX)
+                remote_tdo_info = \
+                    remote_lsa.QueryTrustedDomainInfoByName(remote_policy,
+                                                            lsaString,
+                                                            lsa.LSA_TRUSTED_DOMAIN_INFO_INFO_EX)
             except NTSTATUSError as error:
                 if not self.check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
                     raise self.RemoteRuntimeError(self, error, "QueryTrustedDomainInfoByName(%s)" % (
@@ -2883,9 +2906,10 @@ class cmd_domain_trust_delete(DomainTrustCommand):
         if local_tdo_info is not None:
             try:
                 lsaString.string = local_tdo_info.domain_name.string
-                local_tdo_handle = local_lsa.OpenTrustedDomainByName(local_policy,
-                                                                     lsaString,
-                                                                     security.SEC_STD_DELETE)
+                local_tdo_handle = \
+                    local_lsa.OpenTrustedDomainByName(local_policy,
+                                                      lsaString,
+                                                      security.SEC_STD_DELETE)
             except RuntimeError as error:
                 raise self.LocalRuntimeError(self, error, "OpenTrustedDomainByName(%s)" % (
                                              lsaString.string))
@@ -2896,9 +2920,10 @@ class cmd_domain_trust_delete(DomainTrustCommand):
         if remote_tdo_info is not None:
             try:
                 lsaString.string = remote_tdo_info.domain_name.string
-                remote_tdo_handle = remote_lsa.OpenTrustedDomainByName(remote_policy,
-                                                                       lsaString,
-                                                                       security.SEC_STD_DELETE)
+                remote_tdo_handle = \
+                    remote_lsa.OpenTrustedDomainByName(remote_policy,
+                                                       lsaString,
+                                                       security.SEC_STD_DELETE)
             except RuntimeError as error:
                 raise self.RemoteRuntimeError(self, error, "OpenTrustedDomainByName(%s)" % (
                                               lsaString.string))
@@ -2967,8 +2992,10 @@ class cmd_domain_trust_validate(DomainTrustCommand):
         try:
             lsaString = lsa.String()
             lsaString.string = domain
-            local_tdo_info = local_lsa.QueryTrustedDomainInfoByName(local_policy,
-                                        lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_INFO_EX)
+            local_tdo_info = \
+                local_lsa.QueryTrustedDomainInfoByName(local_policy,
+                                                       lsaString,
+                                                       lsa.LSA_TRUSTED_DOMAIN_INFO_INFO_EX)
         except NTSTATUSError as error:
             if self.check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
                 raise CommandError("trusted domain object does not exist for domain [%s]" % domain)
@@ -2986,10 +3013,11 @@ class cmd_domain_trust_validate(DomainTrustCommand):
             raise self.LocalRuntimeError(self, error, "failed to connect netlogon server")
 
         try:
-            local_trust_verify = local_netlogon.netr_LogonControl2Ex(local_server,
-                                                                 netlogon.NETLOGON_CONTROL_TC_VERIFY,
-                                                                 2,
-                                                                 local_tdo_info.domain_name.string)
+            local_trust_verify = \
+                local_netlogon.netr_LogonControl2Ex(local_server,
+                                                    netlogon.NETLOGON_CONTROL_TC_VERIFY,
+                                                    2,
+                                                    local_tdo_info.domain_name.string)
         except RuntimeError as error:
             raise self.LocalRuntimeError(self, error, "NETLOGON_CONTROL_TC_VERIFY failed")
 
@@ -3015,10 +3043,11 @@ class cmd_domain_trust_validate(DomainTrustCommand):
         try:
             server = local_trust_verify.trusted_dc_name.replace('\\', '')
             domain_and_server = "%s\\%s" % (local_tdo_info.domain_name.string, server)
-            local_trust_rediscover = local_netlogon.netr_LogonControl2Ex(local_server,
-                                                                 netlogon.NETLOGON_CONTROL_REDISCOVER,
-                                                                 2,
-                                                                 domain_and_server)
+            local_trust_rediscover = \
+                local_netlogon.netr_LogonControl2Ex(local_server,
+                                                    netlogon.NETLOGON_CONTROL_REDISCOVER,
+                                                    2,
+                                                    domain_and_server)
         except RuntimeError as error:
             raise self.LocalRuntimeError(self, error, "NETLOGON_CONTROL_REDISCOVER failed")
 
@@ -3044,10 +3073,11 @@ class cmd_domain_trust_validate(DomainTrustCommand):
                 raise self.RemoteRuntimeError(self, error, "failed to connect netlogon server")
 
             try:
-                remote_trust_verify = remote_netlogon.netr_LogonControl2Ex(remote_server,
-                                                                  netlogon.NETLOGON_CONTROL_TC_VERIFY,
-                                                                  2,
-                                                                  local_lsa_info.dns_domain.string)
+                remote_trust_verify = \
+                    remote_netlogon.netr_LogonControl2Ex(remote_server,
+                                                         netlogon.NETLOGON_CONTROL_TC_VERIFY,
+                                                         2,
+                                                         local_lsa_info.dns_domain.string)
             except RuntimeError as error:
                 raise self.RemoteRuntimeError(self, error, "NETLOGON_CONTROL_TC_VERIFY failed")
 
@@ -3073,10 +3103,11 @@ class cmd_domain_trust_validate(DomainTrustCommand):
             try:
                 server = remote_trust_verify.trusted_dc_name.replace('\\', '')
                 domain_and_server = "%s\\%s" % (local_lsa_info.dns_domain.string, server)
-                remote_trust_rediscover = remote_netlogon.netr_LogonControl2Ex(remote_server,
-                                                                     netlogon.NETLOGON_CONTROL_REDISCOVER,
-                                                                     2,
-                                                                     domain_and_server)
+                remote_trust_rediscover = \
+                    remote_netlogon.netr_LogonControl2Ex(remote_server,
+                                                         netlogon.NETLOGON_CONTROL_REDISCOVER,
+                                                         2,
+                                                         domain_and_server)
             except RuntimeError as error:
                 raise self.RemoteRuntimeError(self, error, "NETLOGON_CONTROL_REDISCOVER failed")
 
@@ -3529,8 +3560,10 @@ class cmd_domain_trust_namespaces(DomainTrustCommand):
         try:
             lsaString = lsa.String()
             lsaString.string = domain
-            local_tdo_info = local_lsa.QueryTrustedDomainInfoByName(local_policy,
-                                        lsaString, lsa.LSA_TRUSTED_DOMAIN_INFO_INFO_EX)
+            local_tdo_info = \
+                local_lsa.QueryTrustedDomainInfoByName(local_policy,
+                                                       lsaString,
+                                                       lsa.LSA_TRUSTED_DOMAIN_INFO_INFO_EX)
         except NTSTATUSError as error:
             if self.check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND):
                 raise CommandError("trusted domain object does not exist for domain [%s]" % domain)
@@ -3569,18 +3602,20 @@ class cmd_domain_trust_namespaces(DomainTrustCommand):
                 # this triggers netr_GetForestTrustInformation to the remote domain
                 # and lsaRSetForestTrustInformation() locally, but new top level
                 # names are disabled by default.
-                fresh_forest_info = local_netlogon.netr_DsRGetForestTrustInformation(local_netlogon_info.dc_unc,
-                                                              local_tdo_info.domain_name.string,
-                                                              netlogon_update_tdo)
+                fresh_forest_info = \
+                    local_netlogon.netr_DsRGetForestTrustInformation(local_netlogon_info.dc_unc,
+                                                                     local_tdo_info.domain_name.string,
+                                                                     netlogon_update_tdo)
             except RuntimeError as error:
                 raise self.LocalRuntimeError(self, error, "netr_DsRGetForestTrustInformation() failed")
 
             try:
-                fresh_forest_collision = local_lsa.lsaRSetForestTrustInformation(local_policy,
-                                                              local_tdo_info.domain_name,
-                                                              lsa.LSA_FOREST_TRUST_DOMAIN_INFO,
-                                                              fresh_forest_info,
-                                                              lsa_update_check)
+                fresh_forest_collision = \
+                    local_lsa.lsaRSetForestTrustInformation(local_policy,
+                                                            local_tdo_info.domain_name,
+                                                            lsa.LSA_FOREST_TRUST_DOMAIN_INFO,
+                                                            fresh_forest_info,
+                                                            lsa_update_check)
             except RuntimeError as error:
                 raise self.LocalRuntimeError(self, error, "lsaRSetForestTrustInformation() failed")
 
@@ -3593,7 +3628,8 @@ class cmd_domain_trust_namespaces(DomainTrustCommand):
                 try:
                     lsaString = lsa.String()
                     lsaString.string = local_tdo_info.domain_name.string
-                    stored_forest_info = local_lsa.lsaRQueryForestTrustInformation(local_policy,
+                    stored_forest_info = \
+                        local_lsa.lsaRQueryForestTrustInformation(local_policy,
                                                                   lsaString,
                                                                   lsa.LSA_FOREST_TRUST_DOMAIN_INFO)
                 except RuntimeError as error:
@@ -3612,9 +3648,10 @@ class cmd_domain_trust_namespaces(DomainTrustCommand):
         try:
             lsaString = lsa.String()
             lsaString.string = local_tdo_info.domain_name.string
-            local_forest_info = local_lsa.lsaRQueryForestTrustInformation(local_policy,
-                                                      lsaString,
-                                                      lsa.LSA_FOREST_TRUST_DOMAIN_INFO)
+            local_forest_info = \
+                local_lsa.lsaRQueryForestTrustInformation(local_policy,
+                                                          lsaString,
+                                                          lsa.LSA_FOREST_TRUST_DOMAIN_INFO)
         except RuntimeError as error:
             raise self.LocalRuntimeError(self, error, "lsaRQueryForestTrustInformation() failed")
 
@@ -3807,9 +3844,9 @@ class cmd_domain_trust_namespaces(DomainTrustCommand):
 
         try:
             update_forest_collision = local_lsa.lsaRSetForestTrustInformation(local_policy,
-                                                          local_tdo_info.domain_name,
-                                                          lsa.LSA_FOREST_TRUST_DOMAIN_INFO,
-                                                          update_forest_info, 0)
+                                                                              local_tdo_info.domain_name,
+                                                                              lsa.LSA_FOREST_TRUST_DOMAIN_INFO,
+                                                                              update_forest_info, 0)
         except RuntimeError as error:
             raise self.LocalRuntimeError(self, error, "lsaRSetForestTrustInformation() failed")
 
@@ -3822,8 +3859,8 @@ class cmd_domain_trust_namespaces(DomainTrustCommand):
             lsaString = lsa.String()
             lsaString.string = local_tdo_info.domain_name.string
             stored_forest_info = local_lsa.lsaRQueryForestTrustInformation(local_policy,
-                                                          lsaString,
-                                                          lsa.LSA_FOREST_TRUST_DOMAIN_INFO)
+                                                                           lsaString,
+                                                                           lsa.LSA_FOREST_TRUST_DOMAIN_INFO)
         except RuntimeError as error:
             raise self.LocalRuntimeError(self, error, "lsaRQueryForestTrustInformation() failed")
 
@@ -3876,7 +3913,7 @@ This command expunges tombstones from the database."""
 
         if len(ncs) == 0:
             res = samdb.search(expression="", base="", scope=ldb.SCOPE_BASE,
-                         attrs=["namingContexts"])
+                               attrs=["namingContexts"])
 
             ncs = []
             for nc in res[0]["namingContexts"]:
@@ -4288,7 +4325,7 @@ class cmd_domain_functional_prep(Command):
             domain_dn = samdb.domain_dn()
             infrastructure_dn = "CN=Infrastructure," + domain_dn
             master = get_fsmo_roleowner(samdb, infrastructure_dn,
-                                       'infrastructure')
+                                        'infrastructure')
             if own_dn != master:
                 raise CommandError("This server is not the infrastructure master.")
 
index 9046763841556a43b443fcd0d67e5ba2e0f0d7fa..c044a7a49efd7163a9a98dc822557a8c2a9147ac 100644 (file)
@@ -76,16 +76,16 @@ class cmd_dsacl_set(Command):
         Option("--action", type="choice", choices=["allow", "deny"],
                help="""Deny or allow access"""),
         Option("--objectdn", help="DN of the object whose SD to modify",
-            type="string"),
+               type="string"),
         Option("--trusteedn", help="DN of the entity that gets access",
-            type="string"),
+               type="string"),
         Option("--sddl", help="An ACE or group of ACEs to be added on the object",
-            type="string"),
+               type="string"),
     ]
 
     def find_trustee_sid(self, samdb, trusteedn):
         res = samdb.search(base=trusteedn, expression="(objectClass=*)",
-            scope=SCOPE_BASE)
+                           scope=SCOPE_BASE)
         assert(len(res) == 1)
         return ndr_unpack( security.dom_sid,res[0]["objectSid"][0])
 
@@ -100,7 +100,7 @@ class cmd_dsacl_set(Command):
 
     def read_descriptor(self, samdb, object_dn):
         res = samdb.search(base=object_dn, scope=SCOPE_BASE,
-                attrs=["nTSecurityDescriptor"])
+                           attrs=["nTSecurityDescriptor"])
         # we should theoretically always have an SD
         assert(len(res) == 1)
         desc = res[0]["nTSecurityDescriptor"][0]
@@ -108,7 +108,7 @@ class cmd_dsacl_set(Command):
 
     def get_domain_sid(self, samdb):
         res = samdb.search(base=samdb.domain_dn(),
-                expression="(objectClass=*)", scope=SCOPE_BASE)
+                           expression="(objectClass=*)", scope=SCOPE_BASE)
         return ndr_unpack( security.dom_sid,res[0]["objectSid"][0])
 
     def add_ace(self, samdb, object_dn, new_ace):
@@ -145,7 +145,7 @@ class cmd_dsacl_set(Command):
             return self.usage()
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
         cars = {'change-rid' : GUID_DRS_CHANGE_RID_MASTER,
                 'change-pdc' : GUID_DRS_CHANGE_PDC,
                 'change-infrastructure' : GUID_DRS_CHANGE_INFR_MASTER,
index 8b1499189f62ff2e66f3a793aedeba5c3a41f6f0..2ab0abd00520fde037dcd03ad695a74f99d00a03 100644 (file)
@@ -53,7 +53,7 @@ class cmd_forest_show(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         domain_dn = samdb.domain_dn()
         object_dn = "%s,%s" % (self.objectdn, domain_dn)
@@ -103,7 +103,7 @@ class cmd_forest_set(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         domain_dn = samdb.domain_dn()
         object_dn = "%s,%s" % (self.objectdn, domain_dn)
index c31fc6735b5782b5f66272c3f25d453040d0e0f1..e8a64f98513ce9f5866ff05499e3994465efb64a 100644 (file)
@@ -72,8 +72,8 @@ def transfer_dns_role(outf, sambaopts, credopts, role, samdb):
     if 'fSMORoleOwner' in res[0]:
         try:
             master_guid = str(misc.GUID(ldb.Dn(samdb,
-                              res[0]['fSMORoleOwner'][0].decode('utf8'))
-                              .get_extended_component('GUID')))
+                                               res[0]['fSMORoleOwner'][0].decode('utf8'))
+                                        .get_extended_component('GUID')))
             master_owner = str(ldb.Dn(samdb, res[0]['fSMORoleOwner'][0].decode('utf8')))
         except LdbError as e3:
             (num, msg) = e3.args
@@ -231,7 +231,7 @@ class cmd_fsmo_seize(Command):
                help="Force seizing of role without attempting to transfer.",
                action="store_true"),
         Option("--role", type="choice", choices=["rid", "pdc", "infrastructure",
-               "schema", "naming", "domaindns", "forestdns", "all"],
+                                                 "schema", "naming", "domaindns", "forestdns", "all"],
                help="""The FSMO role to seize or transfer.\n
 rid=RidAllocationMasterRole\n
 schema=SchemaMasterRole\n
@@ -443,7 +443,7 @@ class cmd_fsmo_show(Command):
         creds = credopts.get_credentials(lp, fallback_machine=True)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         domain_dn = samdb.domain_dn()
         forest_dn = samba.dn_from_dns_name(samdb.forest_dns_name())
@@ -489,7 +489,7 @@ class cmd_fsmo_transfer(Command):
         Option("-H", "--URL", help="LDB URL for database or target server",
                type=str, metavar="URL", dest="H"),
         Option("--role", type="choice", choices=["rid", "pdc", "infrastructure",
-               "schema", "naming", "domaindns", "forestdns", "all"],
+                                                 "schema", "naming", "domaindns", "forestdns", "all"],
                help="""The FSMO role to seize or transfer.\n
 rid=RidAllocationMasterRole\n
 schema=SchemaMasterRole\n
index e9396d23cf152c80059dde649abe44eb06e56760..0f3fe6238af0aa120c243d9a579771ee8a5622a2 100644 (file)
@@ -418,7 +418,7 @@ class cmd_list(Command):
 
     takes_options = [
         Option("-H", "--URL", help="LDB URL for database or target server",
-            type=str, metavar="URL", dest="H")
+               type=str, metavar="URL", dest="H")
     ]
 
     def run(self, username, H=None, sambaopts=None, credopts=None, versionopts=None):
@@ -480,7 +480,7 @@ class cmd_list(Command):
                         secdesc = ndr_unpack(security.descriptor, secdesc_ndr)
                     except Exception:
                         self.outf.write("Failed to fetch gpo object with nTSecurityDescriptor %s\n" %
-                            g['dn'])
+                                        g['dn'])
                         continue
 
                     try:
@@ -630,9 +630,9 @@ class cmd_setlink(Command):
     takes_options = [
         Option("-H", help="LDB URL for database or target server", type=str),
         Option("--disable", dest="disabled", default=False, action='store_true',
-            help="Disable policy"),
+               help="Disable policy"),
         Option("--enforce", dest="enforced", default=False, action='store_true',
-            help="Enforce policy")
+               help="Enforce policy")
     ]
 
     def run(self, container_dn, gpo, H=None, disabled=False, enforced=False,
index 996cbb6db2a484a3686b276f88b9932ec82c5845..0a6dc433b74606b5bc437d891e0b782799990f3b 100644 (file)
@@ -89,12 +89,12 @@ Example3 adds a new RFC2307 enabled group for NIS domain samdom and GID 12345 (b
         Option("-H", "--URL", help="LDB URL for database or target server", type=str,
                metavar="URL", dest="H"),
         Option("--groupou",
-           help="Alternative location (without domainDN counterpart) to default CN=Users in which new user object will be created",
-           type=str),
+               help="Alternative location (without domainDN counterpart) to default CN=Users in which new user object will be created",
+               type=str),
         Option("--group-scope", type="choice", choices=["Domain", "Global", "Universal"],
-            help="Group scope (Domain | Global | Universal)"),
+               help="Group scope (Domain | Global | Universal)"),
         Option("--group-type", type="choice", choices=["Security", "Distribution"],
-            help="Group type (Security | Distribution)"),
+               help="Group type (Security | Distribution)"),
         Option("--description", help="Group's description", type=str),
         Option("--mail-address", help="Group's email address", type=str),
         Option("--notes", help="Groups's notes", type=str),
@@ -123,8 +123,8 @@ Example3 adds a new RFC2307 enabled group for NIS domain samdom and GID 12345 (b
             samdb = SamDB(url=H, session_info=system_session(),
                           credentials=creds, lp=lp)
             samdb.newgroup(groupname, groupou=groupou, grouptype = gtype,
-                          description=description, mailaddress=mail_address, notes=notes,
-                          gidnumber=gid_number, nisdomain=nis_domain)
+                           description=description, mailaddress=mail_address, notes=notes,
+                           gidnumber=gid_number, nisdomain=nis_domain)
         except Exception as e:
             # FIXME: catch more specific exception
             raise CommandError('Failed to create group "%s"' % groupname, e)
@@ -239,7 +239,7 @@ Example2 shows how to add a single user account, User2, to the supergroup AD gro
                           credentials=creds, lp=lp)
             groupmembers = listofmembers.split(',')
             samdb.add_remove_group_members(groupname, groupmembers,
-                    add_members_operation=True)
+                                           add_members_operation=True)
         except Exception as e:
             # FIXME: catch more specific exception
             raise CommandError('Failed to add members "%s" to group "%s"' % (
@@ -290,7 +290,7 @@ Example2 shows how to remove a single user account, User2, from the supergroup A
             samdb = SamDB(url=H, session_info=system_session(),
                           credentials=creds, lp=lp)
             samdb.add_remove_group_members(groupname, listofmembers.split(","),
-                    add_members_operation=False)
+                                           add_members_operation=False)
         except Exception as e:
             # FIXME: Catch more specific exception
             raise CommandError('Failed to remove members "%s" from group "%s"' % (listofmembers, groupname), e)
@@ -323,12 +323,12 @@ class cmd_group_list(Command):
         creds = credopts.get_credentials(lp, fallback_machine=True)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         domain_dn = samdb.domain_dn()
         res = samdb.search(domain_dn, scope=ldb.SCOPE_SUBTREE,
-                    expression=("(objectClass=group)"),
-                    attrs=["samaccountname", "grouptype"])
+                           expression=("(objectClass=group)"),
+                           attrs=["samaccountname", "grouptype"])
         if (len(res) == 0):
             return
 
index 5945d97904b21b6c7a710fedf738f732debe9173..d5a27d416bea56d5410ee9f012192c7c30526bab 100644 (file)
@@ -87,13 +87,13 @@ class LDAPBase(object):
         if self.two_domains and not self.quiet:
             self.outf.write("\n* Place-holders for %s:\n" % self.host)
             self.outf.write(4*" " + "${DOMAIN_DN}      => %s\n" %
-                self.base_dn)
+                            self.base_dn)
             self.outf.write(4*" " + "${DOMAIN_NETBIOS} => %s\n" %
-                self.domain_netbios)
+                            self.domain_netbios)
             self.outf.write(4*" " + "${SERVER_NAME}     => %s\n" %
-                self.server_names)
+                            self.server_names)
             self.outf.write(4*" " + "${DOMAIN_NAME}    => %s\n" %
-                self.domain_name)
+                            self.domain_name)
 
     def find_domain_sid(self):
         res = self.ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE)
@@ -103,7 +103,7 @@ class LDAPBase(object):
         """
         """
         res = self.ldb.search(base="OU=Domain Controllers,%s" % self.base_dn,
-                scope=SCOPE_SUBTREE, expression="(objectClass=computer)", attrs=["cn"])
+                              scope=SCOPE_SUBTREE, expression="(objectClass=computer)", attrs=["cn"])
         assert len(res) > 0
         srv = []
         for x in res:
@@ -112,7 +112,7 @@ class LDAPBase(object):
 
     def find_netbios(self):
         res = self.ldb.search(base="CN=Partitions,%s" % self.config_dn,
-                scope=SCOPE_SUBTREE, attrs=["nETBIOSName"])
+                              scope=SCOPE_SUBTREE, attrs=["nETBIOSName"])
         assert len(res) > 0
         for x in res:
             if "nETBIOSName" in x.keys():
@@ -497,8 +497,8 @@ class LDAPObject(object):
             #
             # May contain DOMAIN_NETBIOS and SERVER_NAME
             self.servername_attributes = [ "distinguishedName", "name", "CN", "sAMAccountName", "dNSHostName",
-                "servicePrincipalName", "rIDSetReferences", "serverReference", "serverReferenceBL",
-                "msDS-IsDomainFor", "interSiteTopologyGenerator",]
+                                           "servicePrincipalName", "rIDSetReferences", "serverReference", "serverReferenceBL",
+                                           "msDS-IsDomainFor", "interSiteTopologyGenerator",]
             self.servername_attributes = [x.upper() for x in self.servername_attributes]
             #
             self.netbios_attributes = [ "servicePrincipalName", "CN", "distinguishedName", "nETBIOSName", "name",]
@@ -793,10 +793,10 @@ class LDAPBundel(object):
                 raise
             try:
                 object2 = LDAPObject(connection=other.con,
-                        dn=other.dn_list[index],
-                        summary=other.summary,
-                        filter_list=self.filter_list,
-                        outf=self.outf, errf=self.errf)
+                                     dn=other.dn_list[index],
+                                     summary=other.summary,
+                                     filter_list=self.filter_list,
+                                     outf=self.outf, errf=self.errf)
             except LdbError as e1:
                 (enum, estr) = e1.args
                 if enum == ERR_NO_SUCH_OBJECT:
@@ -893,27 +893,27 @@ class cmd_ldapcmp(Command):
 
     takes_options = [
         Option("-w", "--two", dest="two", action="store_true", default=False,
-            help="Hosts are in two different domains"),
+               help="Hosts are in two different domains"),
         Option("-q", "--quiet", dest="quiet", action="store_true", default=False,
-            help="Do not print anything but relay on just exit code"),
+               help="Do not print anything but relay on just exit code"),
         Option("-v", "--verbose", dest="verbose", action="store_true", default=False,
-            help="Print all DN pairs that have been compared"),
+               help="Print all DN pairs that have been compared"),
         Option("--sd", dest="descriptor", action="store_true", default=False,
-            help="Compare nTSecurityDescriptor attibutes only"),
+               help="Compare nTSecurityDescriptor attibutes only"),
         Option("--sort-aces", dest="sort_aces", action="store_true", default=False,
-            help="Sort ACEs before comparison of nTSecurityDescriptor attribute"),
+               help="Sort ACEs before comparison of nTSecurityDescriptor attribute"),
         Option("--view", dest="view", default="section",
-            help="Display mode for nTSecurityDescriptor results. Possible values: section or collision."),
+               help="Display mode for nTSecurityDescriptor results. Possible values: section or collision."),
         Option("--base", dest="base", default="",
-            help="Pass search base that will build DN list for the first DC."),
+               help="Pass search base that will build DN list for the first DC."),
         Option("--base2", dest="base2", default="",
-            help="Pass search base that will build DN list for the second DC. Used when --two or when compare two different DNs."),
+               help="Pass search base that will build DN list for the second DC. Used when --two or when compare two different DNs."),
         Option("--scope", dest="scope", default="SUB",
-            help="Pass search scope that builds DN list. Options: SUB, ONE, BASE"),
+               help="Pass search scope that builds DN list. Options: SUB, ONE, BASE"),
         Option("--filter", dest="filter", default="",
-            help="List of comma separated attributes to ignore in the comparision"),
+               help="List of comma separated attributes to ignore in the comparision"),
         Option("--skip-missing-dn", dest="skip_missing_dn", action="store_true", default=False,
-            help="Skip report and failure due to missing DNs in one server or another"),
+               help="Skip report and failure due to missing DNs in one server or another"),
     ]
 
     def run(self, URL1, URL2,
@@ -993,7 +993,7 @@ class cmd_ldapcmp(Command):
             if b1 == b2:
                 if not quiet:
                     self.outf.write("\n* Result for [%s]: SUCCESS\n" %
-                        context)
+                                    context)
             else:
                 if not quiet:
                     self.outf.write("\n* Result for [%s]: FAILURE\n" % context)
index e68294f88df59c3529690d7840dc107608e771ce..a5c74790032c8106a7e27a6a01dd680d42b69f43 100644 (file)
@@ -174,7 +174,7 @@ def make_pso_ldb_msg(outf, samdb, pso_dn, create, lockout_threshold=None,
     if create:
         ldb_oper = ldb.FLAG_MOD_ADD
         m["msDS-objectClass"] = ldb.MessageElement("msDS-PasswordSettings",
-              ldb_oper, "objectClass")
+                                                   ldb_oper, "objectClass")
     else:
         ldb_oper = ldb.FLAG_MOD_REPLACE
 
@@ -252,14 +252,14 @@ def check_pso_constraints(min_pwd_length=None, history_length=None,
 # the same args are used for both create and set commands
 pwd_settings_options = [
     Option("--complexity", type="choice", choices=["on", "off"],
-      help="The password complexity (on | off)."),
+           help="The password complexity (on | off)."),
     Option("--store-plaintext", type="choice", choices=["on", "off"],
-      help="Store plaintext passwords where account have "
+           help="Store plaintext passwords where account have "
            "'store passwords with reversible encryption' set (on | off)."),
     Option("--history-length",
-      help="The password history length (<integer>).", type=int),
+           help="The password history length (<integer>).", type=int),
     Option("--min-pwd-length",
-      help="The minimum password length (<integer>).", type=int),
+           help="The minimum password length (<integer>).", type=int),
     Option("--min-pwd-age",
            help=("The minimum password age (<integer in days>). "
                  "Default is domain setting."), type=int),
@@ -336,7 +336,7 @@ class cmd_domain_pwdsettings_pso_create(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         try:
             precedence = int(precedence)
@@ -374,9 +374,9 @@ class cmd_domain_pwdsettings_pso_create(Command):
 
         # lookup the current domain password-settings
         res = samdb.search(samdb.domain_dn(), scope=ldb.SCOPE_BASE,
-            attrs=["pwdProperties", "pwdHistoryLength", "minPwdLength",
-                "minPwdAge", "maxPwdAge", "lockoutDuration",
-                "lockoutThreshold", "lockOutObservationWindow"])
+                           attrs=["pwdProperties", "pwdHistoryLength", "minPwdLength",
+                                  "minPwdAge", "maxPwdAge", "lockoutDuration",
+                                  "lockoutThreshold", "lockOutObservationWindow"])
         assert(len(res) == 1)
 
         # use the domain settings for any missing arguments
@@ -473,7 +473,7 @@ class cmd_domain_pwdsettings_pso_set(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         # sanity-check the PSO exists
         pso_dn = "CN=%s,%s" % (psoname, pso_container(samdb))
@@ -549,7 +549,7 @@ class cmd_domain_pwdsettings_pso_delete(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         pso_dn = "CN=%s,%s" % (psoname, pso_container(samdb))
         # sanity-check the PSO exists
@@ -587,7 +587,7 @@ class cmd_domain_pwdsettings_pso_list(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         res = samdb.search(pso_container(samdb), scope=ldb.SCOPE_SUBTREE,
                            attrs=['name', 'msDS-PasswordSettingsPrecedence'],
@@ -634,7 +634,7 @@ class cmd_domain_pwdsettings_pso_show(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         pso_dn = "CN=%s,%s" % (psoname, pso_container(samdb))
         check_pso_valid(samdb, pso_dn, psoname)
@@ -664,7 +664,7 @@ class cmd_domain_pwdsettings_pso_show_user(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         show_pso_for_user(self.outf, samdb, username)
 
@@ -700,7 +700,7 @@ class cmd_domain_pwdsettings_pso_apply(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         pso_dn = "CN=%s,%s" % (psoname, pso_container(samdb))
         # sanity-check the PSO exists
@@ -760,7 +760,7 @@ class cmd_domain_pwdsettings_pso_unapply(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         pso_dn = "CN=%s,%s" % (psoname, pso_container(samdb))
         # sanity-check the PSO exists
index de11632c86af9f64fe44caf67c6528fa72ee937b..a82c6aee4ade2cf3eb50b74070b3404991960faf 100644 (file)
@@ -111,7 +111,7 @@ class cmd_schema_attribute_modify(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         schema_dn = samdb.schema_dn()
         # For now we make assumptions about the CN
@@ -154,7 +154,7 @@ class cmd_schema_attribute_show(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         schema_dn = samdb.schema_dn()
 
@@ -229,7 +229,7 @@ class cmd_schema_attribute_show_oc(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         schema_dn = samdb.schema_dn()
 
@@ -239,9 +239,9 @@ class cmd_schema_attribute_show_oc(Command):
         '(|(mustContain={0})(systemMustContain={0})))'.format(attribute)
 
         may_res = samdb.search(base=schema_dn, scope=ldb.SCOPE_SUBTREE,
-                           expression=may_filt, attrs=['cn'])
+                               expression=may_filt, attrs=['cn'])
         must_res = samdb.search(base=schema_dn, scope=ldb.SCOPE_SUBTREE,
-                           expression=must_filt, attrs=['cn'])
+                                expression=must_filt, attrs=['cn'])
 
         self.outf.write('--- MAY contain ---\n')
         for msg in may_res:
@@ -279,7 +279,7 @@ class cmd_schema_objectclass_show(Command):
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         schema_dn = samdb.schema_dn()
 
index 363a5b7f5f2964655c05774bd6203babeb15d7fe..b4125e18d90ef574c17a5d95d0260f923439f89d 100644 (file)
@@ -123,7 +123,7 @@ class cmd_spn_add(Command):
             tab.append(name)
             msg.dn = res[0].dn
             msg["servicePrincipalName"] = ldb.MessageElement(tab, flag,
-                                                "servicePrincipalName")
+                                                             "servicePrincipalName")
             if not found:
                 sam.modify(msg)
             else:
@@ -173,8 +173,8 @@ class cmd_spn_delete(Command):
                     for r in res:
                         listUser = "%s\n%s" % (listUser, str(r.dn))
                     raise CommandError("More than one user has the spn %s "
-                           "and no specific user was specified, list of users"
-                           " with this spn:%s" % (name, listUser))
+                                       "and no specific user was specified, list of users"
+                                       " with this spn:%s" % (name, listUser))
                 else:
                     result=res[0]
 
@@ -189,7 +189,7 @@ class cmd_spn_delete(Command):
                 flag = ldb.FLAG_MOD_REPLACE
             msg.dn = result.dn
             msg["servicePrincipalName"] = ldb.MessageElement(tab, flag,
-                                            "servicePrincipalName")
+                                                             "servicePrincipalName")
             sam.modify(msg)
         else:
             raise CommandError("Service principal %s not affected" % name)
index dc5a0b5346a558782aca29c63d7a6cec77300d3b..e2abd8a9a25fd3761b9adcc6c5b49ef175b6ed33 100644 (file)
@@ -201,9 +201,9 @@ class cmd_testparm(Command):
         # this is totally ugly, a real `quick' hack
         for s in lp.services():
             if (self.allow_access(lp.get("hosts deny"), lp.get("hosts allow"), cname,
-                             caddr) and
+                                  caddr) and
                 self.allow_access(lp.get("hosts deny", s), lp.get("hosts allow", s),
-                             cname, caddr)):
+                                  cname, caddr)):
                 logger.info("Allow connection from %s (%s) to %s", cname, caddr, s)
             else:
                 logger.info("Deny connection from %s (%s) to %s", cname, caddr, s)
index f002c1a2b0418de7de98ea0a20d84a23f506db57..49538c9cefcd529888f34d07ad501b6577e0c42d 100644 (file)
@@ -479,13 +479,13 @@ class cmd_user_list(Command):
         creds = credopts.get_credentials(lp, fallback_machine=True)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         domain_dn = samdb.domain_dn()
         res = samdb.search(domain_dn, scope=ldb.SCOPE_SUBTREE,
-                    expression=("(&(objectClass=user)(userAccountControl:%s:=%u))"
-                    % (ldb.OID_COMPARATOR_AND, dsdb.UF_NORMAL_ACCOUNT)),
-                    attrs=["samaccountname"])
+                           expression=("(&(objectClass=user)(userAccountControl:%s:=%u))"
+                                       % (ldb.OID_COMPARATOR_AND, dsdb.UF_NORMAL_ACCOUNT)),
+                           attrs=["samaccountname"])
         if (len(res) == 0):
             return
 
@@ -554,7 +554,7 @@ Example3 shows how to enable a user in the domain against a local LDAP server.
         creds = credopts.get_credentials(lp, fallback_machine=True)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
         try:
             samdb.enable_account(filter)
         except Exception as msg:
@@ -593,7 +593,7 @@ class cmd_user_disable(Command):
         creds = credopts.get_credentials(lp, fallback_machine=True)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
         try:
             samdb.disable_account(filter)
         except Exception as msg:
@@ -659,7 +659,7 @@ Example4 shows how to set the account expiration so that it will never expire.
         creds = credopts.get_credentials(lp)
 
         samdb = SamDB(url=H, session_info=system_session(),
-            credentials=creds, lp=lp)
+                      credentials=creds, lp=lp)
 
         try:
             samdb.setexpiry(filter, days*24*3600, no_expiry_req=noexpiry)
index 19e8f6347598e8148e7341182dc64775f51733a8..542693bf719b2d5aa6367fb6edf1a575c803e86d 100644 (file)
@@ -181,7 +181,7 @@ class ProvisionNames(object):
 
 
 def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
-        lp):
+                                  lp):
     """Get key provision parameters (realm, domain, ...) from a given provision
 
     :param samdb: An LDB object connected to the sam.ldb file
@@ -213,19 +213,19 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
     # That's a bit simplistic but it's ok as long as we have only 3
     # partitions
     current = samdb.search(expression="(objectClass=*)",
-        base="", scope=ldb.SCOPE_BASE,
-        attrs=["defaultNamingContext", "schemaNamingContext",
-               "configurationNamingContext","rootDomainNamingContext",
-               "namingContexts"])
+                           base="", scope=ldb.SCOPE_BASE,
+                           attrs=["defaultNamingContext", "schemaNamingContext",
+                                  "configurationNamingContext","rootDomainNamingContext",
+                                  "namingContexts"])
 
     names.configdn = current[0]["configurationNamingContext"][0]
     names.schemadn = current[0]["schemaNamingContext"][0]
     if not (ldb.Dn(samdb, basedn) == (ldb.Dn(samdb,
-                                       current[0]["defaultNamingContext"][0].decode('utf8')))):
+                                             current[0]["defaultNamingContext"][0].decode('utf8')))):
         raise ProvisioningError(("basedn in %s (%s) and from %s (%s)"
                                  "is not the same ..." % (paths.samdb,
-                                    str(current[0]["defaultNamingContext"][0].decode('utf8')),
-                                     paths.smbconf, basedn)))
+                                                          str(current[0]["defaultNamingContext"][0].decode('utf8')),
+                                                          paths.smbconf, basedn)))
 
     names.domaindn=current[0]["defaultNamingContext"][0]
     names.rootdn=current[0]["rootDomainNamingContext"][0]
@@ -248,7 +248,7 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
 
     # default site name
     res3 = samdb.search(expression="(objectClass=site)",
-        base="CN=Sites," + names.configdn, scope=ldb.SCOPE_ONELEVEL, attrs=["cn"])
+                        base="CN=Sites," + names.configdn, scope=ldb.SCOPE_ONELEVEL, attrs=["cn"])
     names.sitename = str(res3[0]["cn"])
 
     # dns hostname and server dn
@@ -266,16 +266,16 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
 
     # invocation id/objectguid
     res5 = samdb.search(expression="(objectClass=*)",
-            base="CN=NTDS Settings,%s" % str(names.serverdn),
-            scope=ldb.SCOPE_BASE,
-            attrs=["invocationID", "objectGUID"])
+                        base="CN=NTDS Settings,%s" % str(names.serverdn),
+                        scope=ldb.SCOPE_BASE,
+                        attrs=["invocationID", "objectGUID"])
     names.invocation = str(ndr_unpack(misc.GUID, res5[0]["invocationId"][0]))
     names.ntdsguid = str(ndr_unpack(misc.GUID, res5[0]["objectGUID"][0]))
 
     # domain guid/sid
     res6 = samdb.search(expression="(objectClass=*)", base=basedn,
-            scope=ldb.SCOPE_BASE, attrs=["objectGUID",
-                "objectSid","msDS-Behavior-Version" ])
+                        scope=ldb.SCOPE_BASE, attrs=["objectGUID",
+                                                     "objectSid","msDS-Behavior-Version" ])
     names.domainguid = str(ndr_unpack(misc.GUID, res6[0]["objectGUID"][0]))
     names.domainsid = ndr_unpack( security.dom_sid, res6[0]["objectSid"][0])
     names.forestsid = ndr_unpack( security.dom_sid, res6[0]["objectSid"][0])
@@ -371,8 +371,10 @@ def update_provision_usn(samdb, low, high, id, replace=False):
     tab.append("%s-%s;%s" % (low, high, id))
     delta = ldb.Message()
     delta.dn = ldb.Dn(samdb, "@PROVISION")
-    delta[LAST_PROVISION_USN_ATTRIBUTE] = ldb.MessageElement(tab,
-        ldb.FLAG_MOD_REPLACE, LAST_PROVISION_USN_ATTRIBUTE)
+    delta[LAST_PROVISION_USN_ATTRIBUTE] = \
+        ldb.MessageElement(tab,
+                           ldb.FLAG_MOD_REPLACE,
+                           LAST_PROVISION_USN_ATTRIBUTE)
     entry = samdb.search(expression='provisionnerID=*',
                          base="@PROVISION", scope=ldb.SCOPE_BASE,
                          attrs=["provisionnerID"])
@@ -398,8 +400,10 @@ def set_provision_usn(samdb, low, high, id):
 
     delta = ldb.Message()
     delta.dn = ldb.Dn(samdb, "@PROVISION")
-    delta[LAST_PROVISION_USN_ATTRIBUTE] = ldb.MessageElement(tab,
-        ldb.FLAG_MOD_ADD, LAST_PROVISION_USN_ATTRIBUTE)
+    delta[LAST_PROVISION_USN_ATTRIBUTE] = \
+        ldb.MessageElement(tab,
+                           ldb.FLAG_MOD_ADD,
+                           LAST_PROVISION_USN_ATTRIBUTE)
     samdb.add(delta)
 
 
@@ -428,8 +432,8 @@ def get_last_provision_usn(sam):
     """
     try:
         entry = sam.search(expression="%s=*" % LAST_PROVISION_USN_ATTRIBUTE,
-                       base="@PROVISION", scope=ldb.SCOPE_BASE,
-                       attrs=[LAST_PROVISION_USN_ATTRIBUTE, "provisionnerID"])
+                           base="@PROVISION", scope=ldb.SCOPE_BASE,
+                           attrs=[LAST_PROVISION_USN_ATTRIBUTE, "provisionnerID"])
     except ldb.LdbError as e1:
         (ecode, emsg) = e1.args
         if ecode == ldb.ERR_NO_SUCH_OBJECT:
@@ -508,7 +512,7 @@ def check_install(lp, session_info, credentials):
     if lp.get("realm") == "":
         raise Exception("Realm empty")
     samdb = Ldb(lp.samdb_url(), session_info=session_info,
-            credentials=credentials, lp=lp)
+                credentials=credentials, lp=lp)
     if len(samdb.search("(cn=Administrator)")) != 1:
         raise ProvisioningError("No administrator account found")
 
@@ -774,7 +778,7 @@ def make_smbconf(smbconf, hostname, domain, realm, targetdir,
     if serverrole == "active directory domain controller":
         shares["sysvol"] = os.path.join(lp.get("state directory"), "sysvol")
         shares["netlogon"] = os.path.join(shares["sysvol"], realm.lower(),
-            "scripts")
+                                          "scripts")
     else:
         global_settings["passdb backend"] = "samba_dsdb"
 
@@ -906,11 +910,11 @@ def secretsdb_self_join(secretsdb, domain,
     :param machinepass: Machine password
     """
     attrs = ["whenChanged",
-           "secret",
-           "priorSecret",
-           "priorChanged",
-           "krb5Keytab",
-           "privateKeytab"]
+             "secret",
+             "priorSecret",
+             "priorChanged",
+             "krb5Keytab",
+             "privateKeytab"]
 
     if realm is not None:
         if dnsdomain is None:
@@ -943,8 +947,8 @@ def secretsdb_self_join(secretsdb, domain,
     # but we don't delete the old record that we are about to modify,
     # because that would delete the keytab and previous password.
     res = secretsdb.search(base="cn=Primary Domains", attrs=attrs,
-        expression=("(&(|(flatname=%s)(realm=%s)(objectSid=%s))(objectclass=primaryDomain)(!(distinguishedName=%s)))" % (domain, realm, str(domainsid), str(msg.dn))),
-        scope=ldb.SCOPE_ONELEVEL)
+                           expression=("(&(|(flatname=%s)(realm=%s)(objectSid=%s))(objectclass=primaryDomain)(!(distinguishedName=%s)))" % (domain, realm, str(domainsid), str(msg.dn))),
+                           scope=ldb.SCOPE_ONELEVEL)
 
     for del_msg in res:
         secretsdb.delete(del_msg.dn)
@@ -1025,13 +1029,13 @@ def setup_secretsdb(paths, session_info, backend_credentials, lp):
             backend_credentials.authentication_requested()):
             if backend_credentials.get_bind_dn() is not None:
                 setup_add_ldif(secrets_ldb,
-                    setup_path("secrets_simple_ldap.ldif"), {
+                               setup_path("secrets_simple_ldap.ldif"), {
                         "LDAPMANAGERDN": backend_credentials.get_bind_dn(),
                         "LDAPMANAGERPASS_B64": b64encode(backend_credentials.get_password()).decode('utf8')
                     })
             else:
                 setup_add_ldif(secrets_ldb,
-                    setup_path("secrets_sasl_ldap.ldif"), {
+                               setup_path("secrets_sasl_ldap.ldif"), {
                         "LDAPADMINUSER": backend_credentials.get_username(),
                         "LDAPADMINREALM": backend_credentials.get_realm(),
                         "LDAPADMINPASS_B64": b64encode(backend_credentials.get_password()).decode('utf8')
@@ -1130,9 +1134,9 @@ def setup_samdb_rootdse(samdb, names):
 
 
 def setup_self_join(samdb, admin_session_info, names, fill, machinepass,
-        dns_backend, dnspass, domainsid, next_rid, invocationid,
-        policyguid, policyguid_dc,
-        domainControllerFunctionality, ntdsguid=None, dc_rid=None):
+                    dns_backend, dnspass, domainsid, next_rid, invocationid,
+                    policyguid, policyguid_dc,
+                    domainControllerFunctionality, ntdsguid=None, dc_rid=None):
     """Join a host to its own domain."""
     assert isinstance(invocationid, str)
     if ntdsguid is not None:
@@ -1188,7 +1192,7 @@ def setup_self_join(samdb, admin_session_info, names, fill, machinepass,
 
     # Setup fSMORoleOwner entries to point at the newly created DC entry
         setup_modify_ldif(samdb,
-            setup_path("provision_self_join_modify_config.ldif"), {
+                          setup_path("provision_self_join_modify_config.ldif"), {
                 "CONFIGDN": names.configdn,
                 "SCHEMADN": names.schemadn,
                 "DEFAULTSITE": names.sitename,
@@ -1268,8 +1272,8 @@ def create_default_gpo(sysvolpath, dnsdomain, policyguid, policyguid_dc):
 
 
 def setup_samdb(path, session_info, provision_backend, lp, names,
-        logger, fill, serverrole, schema, am_rodc=False,
-        plaintext_secrets=False, backend_store=None):
+                logger, fill, serverrole, schema, am_rodc=False,
+                plaintext_secrets=False, backend_store=None):
     """Setup a complete SAM Database.
 
     :note: This will wipe the main SAM database file!
@@ -1277,9 +1281,9 @@ def setup_samdb(path, session_info, provision_backend, lp, names,
 
     # Also wipes the database
     setup_samdb_partitions(path, logger=logger, lp=lp,
-        provision_backend=provision_backend, session_info=session_info,
-        names=names, serverrole=serverrole, plaintext_secrets=plaintext_secrets,
-        backend_store=backend_store)
+                           provision_backend=provision_backend, session_info=session_info,
+                           names=names, serverrole=serverrole, plaintext_secrets=plaintext_secrets,
+                           backend_store=backend_store)
 
     # Load the database, but don's load the global schema and don't connect
     # quite yet
@@ -1316,10 +1320,10 @@ def setup_samdb(path, session_info, provision_backend, lp, names,
 
 
 def fill_samdb(samdb, lp, names, logger, policyguid,
-        policyguid_dc, fill, adminpass, krbtgtpass, machinepass, dns_backend,
-        dnspass, invocationid, ntdsguid, serverrole, am_rodc=False,
-        dom_for_fun_level=None, schema=None, next_rid=None, dc_rid=None,
-        backend_store=None):
+               policyguid_dc, fill, adminpass, krbtgtpass, machinepass, dns_backend,
+               dnspass, invocationid, ntdsguid, serverrole, am_rodc=False,
+               dom_for_fun_level=None, schema=None, next_rid=None, dc_rid=None,
+               backend_store=None):
 
     if next_rid is None:
         next_rid = 1000
@@ -1359,7 +1363,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
     samdb.set_opaque_integer("domainFunctionality", domainFunctionality)
     samdb.set_opaque_integer("forestFunctionality", forestFunctionality)
     samdb.set_opaque_integer("domainControllerFunctionality",
-        domainControllerFunctionality)
+                             domainControllerFunctionality)
 
     samdb.set_domain_sid(str(names.domainsid))
     samdb.set_invocation_id(invocationid)
@@ -1419,7 +1423,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
     # Now register this container in the root of the forest
     msg = ldb.Message(ldb.Dn(samdb, names.domaindn))
     msg["subRefs"] = ldb.MessageElement(names.configdn , ldb.FLAG_MOD_ADD,
-                "subRefs")
+                                        "subRefs")
 
     samdb.invocation_id = invocationid
 
@@ -1476,7 +1480,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
 
         logger.info("Modifying display specifiers and extended rights")
         setup_modify_ldif(samdb,
-            setup_path("provision_configuration_modify.ldif"), {
+                          setup_path("provision_configuration_modify.ldif"), {
                 "CONFIGDN": names.configdn,
                 "DISPLAYSPECIFIERS_DESCRIPTOR": protected2_descr
             })
@@ -1498,7 +1502,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
             })
     logger.info("Modifying computers container")
     setup_modify_ldif(samdb,
-        setup_path("provision_computers_modify.ldif"), {
+                      setup_path("provision_computers_modify.ldif"), {
             "DOMAINDN": names.domaindn})
     logger.info("Setting up sam.ldb data")
     infrastructure_desc = b64encode(get_domain_infrastructure_descriptor(names.domainsid)).decode('utf8')
@@ -1554,21 +1558,21 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
 
         logger.info("Setting up self join")
         setup_self_join(samdb, admin_session_info, names=names, fill=fill,
-            invocationid=invocationid,
-            dns_backend=dns_backend,
-            dnspass=dnspass,
-            machinepass=machinepass,
-            domainsid=names.domainsid,
-            next_rid=next_rid,
-            dc_rid=dc_rid,
-            policyguid=policyguid,
-            policyguid_dc=policyguid_dc,
-            domainControllerFunctionality=domainControllerFunctionality,
-            ntdsguid=ntdsguid)
+                        invocationid=invocationid,
+                        dns_backend=dns_backend,
+                        dnspass=dnspass,
+                        machinepass=machinepass,
+                        domainsid=names.domainsid,
+                        next_rid=next_rid,
+                        dc_rid=dc_rid,
+                        policyguid=policyguid,
+                        policyguid_dc=policyguid_dc,
+                        domainControllerFunctionality=domainControllerFunctionality,
+                        ntdsguid=ntdsguid)
 
         ntds_dn = "CN=NTDS Settings,%s" % names.serverdn
         names.ntdsguid = samdb.searchone(basedn=ntds_dn,
-            attribute="objectGUID", expression="", scope=ldb.SCOPE_BASE)
+                                         attribute="objectGUID", expression="", scope=ldb.SCOPE_BASE)
         assert isinstance(names.ntdsguid, str)
 
     return samdb
@@ -1583,10 +1587,10 @@ def set_dir_acl(path, acl, lp, domsid, use_ntvfs, passdb, service=SYSVOL_SERVICE
     for root, dirs, files in os.walk(path, topdown=False):
         for name in files:
             setntacl(lp, os.path.join(root, name), acl, domsid,
-                    use_ntvfs=use_ntvfs, skip_invalid_chown=True, passdb=passdb, service=service)
+                     use_ntvfs=use_ntvfs, skip_invalid_chown=True, passdb=passdb, service=service)
         for name in dirs:
             setntacl(lp, os.path.join(root, name), acl, domsid,
-                    use_ntvfs=use_ntvfs, skip_invalid_chown=True, passdb=passdb, service=service)
+                     use_ntvfs=use_ntvfs, skip_invalid_chown=True, passdb=passdb, service=service)
 
 
 def set_gpos_acl(sysvol, dnsdomain, domainsid, domaindn, samdb, lp, use_ntvfs, passdb):
@@ -1604,7 +1608,7 @@ def set_gpos_acl(sysvol, dnsdomain, domainsid, domaindn, samdb, lp, use_ntvfs, p
     # Set ACL for GPO root folder
     root_policy_path = os.path.join(sysvol, dnsdomain, "Policies")
     setntacl(lp, root_policy_path, POLICIES_ACL, str(domainsid),
-            use_ntvfs=use_ntvfs, skip_invalid_chown=True, passdb=passdb, service=SYSVOL_SERVICE)
+             use_ntvfs=use_ntvfs, skip_invalid_chown=True, passdb=passdb, service=SYSVOL_SERVICE)
 
     res = samdb.search(base="CN=Policies,CN=System,%s"%(domaindn),
                        attrs=["cn", "nTSecurityDescriptor"],
@@ -1620,7 +1624,7 @@ def set_gpos_acl(sysvol, dnsdomain, domainsid, domaindn, samdb, lp, use_ntvfs, p
 
 
 def setsysvolacl(samdb, netlogon, sysvol, uid, gid, domainsid, dnsdomain,
-        domaindn, lp, use_ntvfs):
+                 domaindn, lp, use_ntvfs):
     """Set the ACL for the sysvol share and the subfolders
 
     :param samdb: An LDB object on the SAM db
@@ -1758,7 +1762,7 @@ def check_dir_acl(path, acl, lp, domainsid, direct_db_access):
 
 
 def check_gpos_acl(sysvol, dnsdomain, domainsid, domaindn, samdb, lp,
-        direct_db_access):
+                   direct_db_access):
     """Set ACL on the sysvol/<dnsname>/Policies folder and the policy
     folders beneath.
 
@@ -1792,7 +1796,7 @@ def check_gpos_acl(sysvol, dnsdomain, domainsid, domaindn, samdb, lp,
 
 
 def checksysvolacl(samdb, netlogon, sysvol, domainsid, dnsdomain, domaindn,
-        lp):
+                   lp):
     """Set the ACL for the sysvol share and the subfolders
 
     :param samdb: An LDB object on the SAM db
@@ -1837,7 +1841,7 @@ def checksysvolacl(samdb, netlogon, sysvol, domainsid, dnsdomain, domaindn,
 
         # Check acls on Policy folder and policies folders
         check_gpos_acl(sysvol, dnsdomain, domainsid, domaindn, samdb, lp,
-                direct_db_access)
+                       direct_db_access)
 
 
 def interface_ips_v4(lp):
@@ -1895,15 +1899,15 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths,
     samdb.transaction_start()
     try:
         samdb = fill_samdb(samdb, lp, names, logger=logger,
-                       schema=schema,
-                       policyguid=policyguid, policyguid_dc=policyguid_dc,
-                       fill=samdb_fill, adminpass=adminpass, krbtgtpass=krbtgtpass,
-                       invocationid=invocationid, machinepass=machinepass,
-                       dns_backend=dns_backend, dnspass=dnspass,
-                       ntdsguid=ntdsguid, serverrole=serverrole,
-                       dom_for_fun_level=dom_for_fun_level, am_rodc=am_rodc,
-                       next_rid=next_rid, dc_rid=dc_rid,
-                       backend_store=backend_store)
+                           schema=schema,
+                           policyguid=policyguid, policyguid_dc=policyguid_dc,
+                           fill=samdb_fill, adminpass=adminpass, krbtgtpass=krbtgtpass,
+                           invocationid=invocationid, machinepass=machinepass,
+                           dns_backend=dns_backend, dnspass=dnspass,
+                           ntdsguid=ntdsguid, serverrole=serverrole,
+                           dom_for_fun_level=dom_for_fun_level, am_rodc=am_rodc,
+                           next_rid=next_rid, dc_rid=dc_rid,
+                           backend_store=backend_store)
 
         # Set up group policies (domain policy and domain controller
         # policy)
@@ -1927,9 +1931,9 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths,
             logger.info("Setting acl on sysvol skipped")
 
         secretsdb_self_join(secrets_ldb, domain=names.domain,
-                realm=names.realm, dnsdomain=names.dnsdomain,
-                netbiosname=names.netbiosname, domainsid=names.domainsid,
-                machinepass=machinepass, secure_channel_type=SEC_CHAN_BDC)
+                            realm=names.realm, dnsdomain=names.dnsdomain,
+                            netbiosname=names.netbiosname, domainsid=names.domainsid,
+                            machinepass=machinepass, secure_channel_type=SEC_CHAN_BDC)
 
         # Now set up the right msDS-SupportedEncryptionTypes into the DB
         # In future, this might be determined from some configuration
@@ -1974,7 +1978,7 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths,
     # fix any dangling GUIDs from the provision
     logger.info("Fixing provision GUIDs")
     chk = dbcheck(samdb, samdb_schema=samdb, verbose=False, fix=True, yes=True,
-            quiet=True)
+                  quiet=True)
     samdb.transaction_start()
     try:
         # a small number of GUIDs are missing because of ordering issues in the
@@ -1991,7 +1995,7 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths,
                                   'ipsecNegotiationPolicyReference',
                                   'ipsecNFAReference'])
         if chk.check_database(DN=names.schemadn, scope=ldb.SCOPE_SUBTREE,
-                attrs=['attributeId', 'governsId']) != 0:
+                              attrs=['attributeId', 'governsId']) != 0:
             raise ProvisioningError("Duplicate attributeId or governsId in schema. Must be fixed manually!!")
     except:
         samdb.transaction_cancel()
@@ -2030,7 +2034,7 @@ def sanitize_server_role(role):
 
 
 def provision_fake_ypserver(logger, samdb, domaindn, netbiosname, nisdomain,
-        maxuid, maxgid):
+                            maxuid, maxgid):
     """Create AD entries for the fake ypserver.
 
     This is needed for being able to manipulate posix attrs via ADUC.
@@ -2067,7 +2071,7 @@ def determine_host_ip(logger, lp, hostip=None):
             hostip = hostips[0]
             if len(hostips) > 1:
                 logger.warning("More than one IPv4 address found. Using %s",
-                    hostip)
+                               hostip)
     if hostip == "127.0.0.1":
         hostip = None
     if hostip is None:
@@ -2089,21 +2093,21 @@ def determine_host_ip6(logger, lp, hostip6=None):
     return hostip6
 
 def provision(logger, session_info, smbconf=None,
-        targetdir=None, samdb_fill=FILL_FULL, realm=None, rootdn=None,
-        domaindn=None, schemadn=None, configdn=None, serverdn=None,
-        domain=None, hostname=None, hostip=None, hostip6=None, domainsid=None,
-        next_rid=1000, dc_rid=None, adminpass=None, ldapadminpass=None,
-        krbtgtpass=None, domainguid=None, policyguid=None, policyguid_dc=None,
-        dns_backend=None, dns_forwarder=None, dnspass=None,
-        invocationid=None, machinepass=None, ntdsguid=None,
-        root=None, nobody=None, users=None, backup=None, aci=None,
-        serverrole=None, dom_for_fun_level=None, backend_type=None,
-        sitename=None, ol_mmr_urls=None, ol_olc=None, slapd_path=None,
-        useeadb=False, am_rodc=False, lp=None, use_ntvfs=False,
-        use_rfc2307=False, maxuid=None, maxgid=None, skip_sysvolacl=True,
-        ldap_backend_forced_uri=None, nosync=False, ldap_dryrun_mode=False,
-        ldap_backend_extra_port=None, base_schema=None,
-        plaintext_secrets=False, backend_store=None):
+              targetdir=None, samdb_fill=FILL_FULL, realm=None, rootdn=None,
+              domaindn=None, schemadn=None, configdn=None, serverdn=None,
+              domain=None, hostname=None, hostip=None, hostip6=None, domainsid=None,
+              next_rid=1000, dc_rid=None, adminpass=None, ldapadminpass=None,
+              krbtgtpass=None, domainguid=None, policyguid=None, policyguid_dc=None,
+              dns_backend=None, dns_forwarder=None, dnspass=None,
+              invocationid=None, machinepass=None, ntdsguid=None,
+              root=None, nobody=None, users=None, backup=None, aci=None,
+              serverrole=None, dom_for_fun_level=None, backend_type=None,
+              sitename=None, ol_mmr_urls=None, ol_olc=None, slapd_path=None,
+              useeadb=False, am_rodc=False, lp=None, use_ntvfs=False,
+              use_rfc2307=False, maxuid=None, maxgid=None, skip_sysvolacl=True,
+              ldap_backend_forced_uri=None, nosync=False, ldap_dryrun_mode=False,
+              ldap_backend_extra_port=None, base_schema=None,
+              plaintext_secrets=False, backend_store=None):
     """Provision samba4
 
     :note: caution, this wipes all existing data!
@@ -2186,9 +2190,9 @@ def provision(logger, session_info, smbconf=None,
         lp = samba.param.LoadParm()
     lp.load(smbconf)
     names = guess_names(lp=lp, hostname=hostname, domain=domain,
-        dnsdomain=realm, serverrole=serverrole, domaindn=domaindn,
-        configdn=configdn, schemadn=schemadn, serverdn=serverdn,
-        sitename=sitename, rootdn=rootdn, domain_names_forced=(samdb_fill == FILL_DRS))
+                        dnsdomain=realm, serverrole=serverrole, domaindn=domaindn,
+                        configdn=configdn, schemadn=schemadn, serverdn=serverdn,
+                        sitename=sitename, rootdn=rootdn, domain_names_forced=(samdb_fill == FILL_DRS))
     paths = provision_paths_from_lp(lp, names.dnsdomain)
 
     paths.bind_gid = bind_gid
@@ -2219,35 +2223,35 @@ def provision(logger, session_info, smbconf=None,
     ldapi_url = "ldapi://%s" % urllib_quote(paths.s4_ldapi_path, safe="")
 
     schema = Schema(domainsid, invocationid=invocationid,
-        schemadn=names.schemadn, base_schema=base_schema)
+                    schemadn=names.schemadn, base_schema=base_schema)
 
     if backend_type == "ldb":
         provision_backend = LDBBackend(backend_type, paths=paths,
-            lp=lp,
-            names=names, logger=logger)
+                                       lp=lp,
+                                       names=names, logger=logger)
     elif backend_type == "existing":
         # If support for this is ever added back, then the URI will need to be
         # specified again
         provision_backend = ExistingBackend(backend_type, paths=paths,
-            lp=lp,
-            names=names, logger=logger,
-            ldap_backend_forced_uri=ldap_backend_forced_uri)
+                                            lp=lp,
+                                            names=names, logger=logger,
+                                            ldap_backend_forced_uri=ldap_backend_forced_uri)
     elif backend_type == "fedora-ds":
         provision_backend = FDSBackend(backend_type, paths=paths,
-            lp=lp,
-            names=names, logger=logger, domainsid=domainsid,
-            schema=schema, hostname=hostname, ldapadminpass=ldapadminpass,
-            slapd_path=slapd_path,
-            root=root)
+                                       lp=lp,
+                                       names=names, logger=logger, domainsid=domainsid,
+                                       schema=schema, hostname=hostname, ldapadminpass=ldapadminpass,
+                                       slapd_path=slapd_path,
+                                       root=root)
     elif backend_type == "openldap":
         provision_backend = OpenLDAPBackend(backend_type, paths=paths,
-            lp=lp,
-            names=names, logger=logger, domainsid=domainsid,
-            schema=schema, hostname=hostname, ldapadminpass=ldapadminpass,
-            slapd_path=slapd_path, ol_mmr_urls=ol_mmr_urls,
-            ldap_backend_extra_port=ldap_backend_extra_port,
-            ldap_dryrun_mode=ldap_dryrun_mode, nosync=nosync,
-            ldap_backend_forced_uri=ldap_backend_forced_uri)
+                                            lp=lp,
+                                            names=names, logger=logger, domainsid=domainsid,
+                                            schema=schema, hostname=hostname, ldapadminpass=ldapadminpass,
+                                            slapd_path=slapd_path, ol_mmr_urls=ol_mmr_urls,
+                                            ldap_backend_extra_port=ldap_backend_extra_port,
+                                            ldap_dryrun_mode=ldap_dryrun_mode, nosync=nosync,
+                                            ldap_backend_forced_uri=ldap_backend_forced_uri)
     else:
         raise ValueError("Unknown LDAP backend type selected")
 
@@ -2262,8 +2266,8 @@ def provision(logger, session_info, smbconf=None,
 
     logger.info("Setting up secrets.ldb")
     secrets_ldb = setup_secretsdb(paths,
-        session_info=session_info,
-        backend_credentials=provision_backend.credentials, lp=lp)
+                                  session_info=session_info,
+                                  backend_credentials=provision_backend.credentials, lp=lp)
 
     try:
         logger.info("Setting up the registry")
@@ -2306,18 +2310,18 @@ def provision(logger, session_info, smbconf=None,
 
         if samdb_fill == FILL_FULL:
             provision_fill(samdb, secrets_ldb, logger, names, paths,
-                    schema=schema, targetdir=targetdir, samdb_fill=samdb_fill,
-                    hostip=hostip, hostip6=hostip6,
-                    next_rid=next_rid, dc_rid=dc_rid, adminpass=adminpass,
-                    krbtgtpass=krbtgtpass,
-                    policyguid=policyguid, policyguid_dc=policyguid_dc,
-                    invocationid=invocationid, machinepass=machinepass,
-                    ntdsguid=ntdsguid, dns_backend=dns_backend,
-                    dnspass=dnspass, serverrole=serverrole,
-                    dom_for_fun_level=dom_for_fun_level, am_rodc=am_rodc,
-                    lp=lp, use_ntvfs=use_ntvfs,
-                    skip_sysvolacl=skip_sysvolacl,
-                    backend_store=backend_store)
+                           schema=schema, targetdir=targetdir, samdb_fill=samdb_fill,
+                           hostip=hostip, hostip6=hostip6,
+                           next_rid=next_rid, dc_rid=dc_rid, adminpass=adminpass,
+                           krbtgtpass=krbtgtpass,
+                           policyguid=policyguid, policyguid_dc=policyguid_dc,
+                           invocationid=invocationid, machinepass=machinepass,
+                           ntdsguid=ntdsguid, dns_backend=dns_backend,
+                           dnspass=dnspass, serverrole=serverrole,
+                           dom_for_fun_level=dom_for_fun_level, am_rodc=am_rodc,
+                           lp=lp, use_ntvfs=use_ntvfs,
+                           skip_sysvolacl=skip_sysvolacl,
+                           backend_store=backend_store)
 
         if not is_heimdal_built():
             create_kdc_conf(paths.kdcconf, realm, domain, os.path.dirname(lp.get("log file")))
@@ -2404,33 +2408,33 @@ def provision(logger, session_info, smbconf=None,
 
     if use_rfc2307:
         provision_fake_ypserver(logger=logger, samdb=samdb,
-                domaindn=names.domaindn, netbiosname=names.netbiosname,
-                nisdomain=names.domain.lower(), maxuid=maxuid, maxgid=maxgid)
+                                domaindn=names.domaindn, netbiosname=names.netbiosname,
+                                nisdomain=names.domain.lower(), maxuid=maxuid, maxgid=maxgid)
 
     return result
 
 
 def provision_become_dc(smbconf=None, targetdir=None,
-        realm=None, rootdn=None, domaindn=None, schemadn=None, configdn=None,
-        serverdn=None, domain=None, hostname=None, domainsid=None,
-        adminpass=None, krbtgtpass=None, domainguid=None, policyguid=None,
-        policyguid_dc=None, invocationid=None, machinepass=None, dnspass=None,
-        dns_backend=None, root=None, nobody=None, users=None,
-        backup=None, serverrole=None, ldap_backend=None,
-        ldap_backend_type=None, sitename=None, debuglevel=1, use_ntvfs=False):
+                        realm=None, rootdn=None, domaindn=None, schemadn=None, configdn=None,
+                        serverdn=None, domain=None, hostname=None, domainsid=None,
+                        adminpass=None, krbtgtpass=None, domainguid=None, policyguid=None,
+                        policyguid_dc=None, invocationid=None, machinepass=None, dnspass=None,
+                        dns_backend=None, root=None, nobody=None, users=None,
+                        backup=None, serverrole=None, ldap_backend=None,
+                        ldap_backend_type=None, sitename=None, debuglevel=1, use_ntvfs=False):
 
     logger = logging.getLogger("provision")
     samba.set_debug_level(debuglevel)
 
     res = provision(logger, system_session(),
-        smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS,
-        realm=realm, rootdn=rootdn, domaindn=domaindn, schemadn=schemadn,
-        configdn=configdn, serverdn=serverdn, domain=domain,
-        hostname=hostname, hostip=None, domainsid=domainsid,
-        machinepass=machinepass,
-        serverrole="active directory domain controller",
-        sitename=sitename, dns_backend=dns_backend, dnspass=dnspass,
-        use_ntvfs=use_ntvfs)
+                    smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS,
+                    realm=realm, rootdn=rootdn, domaindn=domaindn, schemadn=schemadn,
+                    configdn=configdn, serverdn=serverdn, domain=domain,
+                    hostname=hostname, hostip=None, domainsid=domainsid,
+                    machinepass=machinepass,
+                    serverrole="active directory domain controller",
+                    sitename=sitename, dns_backend=dns_backend, dnspass=dnspass,
+                    use_ntvfs=use_ntvfs)
     res.lp.set("debuglevel", str(debuglevel))
     return res
 
index 6e398c14e6064def0e55022b5bef004bb8580228..8b72851c3004907be466fcdd974f33818b441b3f 100644 (file)
@@ -49,8 +49,8 @@ class SlapdAlreadyRunning(Exception):
     def __init__(self, uri):
         self.ldapi_uri = uri
         super(SlapdAlreadyRunning, self).__init__("Another slapd Instance "
-            "seems already running on this host, listening to %s." %
-            self.ldapi_uri)
+                                                  "seems already running on this host, listening to %s." %
+                                                  self.ldapi_uri)
 
 
 class BackendResult(object):
@@ -83,7 +83,7 @@ class LDAPBackendResult(BackendResult):
 class ProvisionBackend(object):
 
     def __init__(self, backend_type, paths=None, lp=None,
-            names=None, logger=None):
+                 names=None, logger=None):
         """Provision a backend for samba4"""
         self.paths = paths
         self.lp = lp
@@ -137,18 +137,18 @@ class LDBBackend(ProvisionBackend):
 class ExistingBackend(ProvisionBackend):
 
     def __init__(self, backend_type, paths=None, lp=None,
-            names=None, logger=None, ldapi_uri=None):
+                 names=None, logger=None, ldapi_uri=None):
 
         super(ExistingBackend, self).__init__(backend_type=backend_type,
-                paths=paths, lp=lp,
-                names=names, logger=logger,
-                ldap_backend_forced_uri=ldapi_uri)
+                                              paths=paths, lp=lp,
+                                              names=names, logger=logger,
+                                              ldap_backend_forced_uri=ldapi_uri)
 
     def init(self):
         # Check to see that this 'existing' LDAP backend in fact exists
         ldapi_db = Ldb(self.ldapi_uri)
         ldapi_db.search(base="", scope=SCOPE_BASE,
-            expression="(objectClass=OpenLDAProotDSE)")
+                        expression="(objectClass=OpenLDAProotDSE)")
 
         # For now, assume existing backends at least emulate OpenLDAP
         self.ldap_backend_type = "openldap"
@@ -163,8 +163,8 @@ class LDAPBackend(ProvisionBackend):
                  ldap_backend_forced_uri=None, ldap_dryrun_mode=False):
 
         super(LDAPBackend, self).__init__(backend_type=backend_type,
-                paths=paths, lp=lp,
-                names=names, logger=logger)
+                                          paths=paths, lp=lp,
+                                          names=names, logger=logger)
 
         self.domainsid = domainsid
         self.schema = schema
@@ -198,7 +198,7 @@ class LDAPBackend(ProvisionBackend):
         try:
             ldapi_db = Ldb(self.ldap_uri)
             ldapi_db.search(base="", scope=SCOPE_BASE,
-                expression="(objectClass=OpenLDAProotDSE)")
+                            expression="(objectClass=OpenLDAProotDSE)")
             try:
                 f = open(self.slapd_pid, "r")
             except IOError as err:
@@ -221,7 +221,7 @@ class LDAPBackend(ProvisionBackend):
             raise ProvisioningError("Warning: LDAP-Backend must be setup with path to slapd, e.g. --slapd-path=\"/usr/local/libexec/slapd\"!")
         if not os.path.exists(self.slapd_path):
             self.logger.warning("Path (%s) to slapd does not exist!",
-                self.slapd_path)
+                                self.slapd_path)
 
         if not os.path.isdir(self.ldapdir):
             os.makedirs(self.ldapdir, 0o700)
@@ -266,7 +266,7 @@ class LDAPBackend(ProvisionBackend):
         # subprocess context around, to kill this off at the successful
         # end of the script
         self.slapd = subprocess.Popen(self.slapd_provision_command,
-            close_fds=True, shell=False)
+                                      close_fds=True, shell=False)
 
         count = 0
         while self.slapd.poll() is None:
@@ -275,7 +275,7 @@ class LDAPBackend(ProvisionBackend):
                 time.sleep(1)
                 ldapi_db = Ldb(self.ldap_uri, lp=self.lp, credentials=self.credentials)
                 ldapi_db.search(base="", scope=SCOPE_BASE,
-                    expression="(objectClass=OpenLDAProotDSE)")
+                                expression="(objectClass=OpenLDAProotDSE)")
                 # If we have got here, then we must have a valid connection to
                 # the LDAP server!
                 return
@@ -306,25 +306,25 @@ class LDAPBackend(ProvisionBackend):
 
     def post_setup(self):
         return LDAPBackendResult(self.slapd_command_escaped,
-                    self.ldapdir)
+                                 self.ldapdir)
 
 
 class OpenLDAPBackend(LDAPBackend):
 
     def __init__(self, backend_type, paths=None, lp=None,
-            credentials=None, names=None, logger=None, domainsid=None,
-            schema=None, hostname=None, ldapadminpass=None, slapd_path=None,
-            ldap_backend_extra_port=None, ldap_dryrun_mode=False,
-            ol_mmr_urls=None, nosync=False, ldap_backend_forced_uri=None):
+                 credentials=None, names=None, logger=None, domainsid=None,
+                 schema=None, hostname=None, ldapadminpass=None, slapd_path=None,
+                 ldap_backend_extra_port=None, ldap_dryrun_mode=False,
+                 ol_mmr_urls=None, nosync=False, ldap_backend_forced_uri=None):
         from samba.provision import setup_path
         super(OpenLDAPBackend, self).__init__( backend_type=backend_type,
-                paths=paths, lp=lp,
-                names=names, logger=logger,
-                domainsid=domainsid, schema=schema, hostname=hostname,
-                ldapadminpass=ldapadminpass, slapd_path=slapd_path,
-                ldap_backend_extra_port=ldap_backend_extra_port,
-                ldap_backend_forced_uri=ldap_backend_forced_uri,
-                ldap_dryrun_mode=ldap_dryrun_mode)
+                                               paths=paths, lp=lp,
+                                               names=names, logger=logger,
+                                               domainsid=domainsid, schema=schema, hostname=hostname,
+                                               ldapadminpass=ldapadminpass, slapd_path=slapd_path,
+                                               ldap_backend_extra_port=ldap_backend_extra_port,
+                                               ldap_backend_forced_uri=ldap_backend_forced_uri,
+                                               ldap_dryrun_mode=ldap_dryrun_mode)
 
         self.ol_mmr_urls = ol_mmr_urls
         self.nosync = nosync
@@ -557,14 +557,14 @@ class OpenLDAPBackend(LDAPBackend):
                 server_port_string = "ldap://0.0.0.0:%d" % self.ldap_backend_extra_port
             else:
                 server_port_string = "ldap://%s.%s:%d" (self.names.hostname,
-                    self.names.dnsdomain, self.ldap_backend_extra_port)
+                                                        self.names.dnsdomain, self.ldap_backend_extra_port)
         else:
             server_port_string = ""
 
         # Prepare the 'result' information - the commands to return in
         # particular
         self.slapd_provision_command = [self.slapd_path, "-F" + self.olcdir,
-            "-h"]
+                                        "-h"]
 
         # copy this command so we have two version, one with -d0 and only
         # ldapi (or the forced ldap_uri), and one with all the listen commands
@@ -619,13 +619,13 @@ class FDSBackend(LDAPBackend):
         from samba.provision import setup_path
 
         super(FDSBackend, self).__init__(backend_type=backend_type,
-                paths=paths, lp=lp,
-                names=names, logger=logger,
-                domainsid=domainsid, schema=schema, hostname=hostname,
-                ldapadminpass=ldapadminpass, slapd_path=slapd_path,
-                ldap_backend_extra_port=ldap_backend_extra_port,
-                ldap_backend_forced_uri=ldap_backend_forced_uri,
-                ldap_dryrun_mode=ldap_dryrun_mode)
+                                         paths=paths, lp=lp,
+                                         names=names, logger=logger,
+                                         domainsid=domainsid, schema=schema, hostname=hostname,
+                                         ldapadminpass=ldapadminpass, slapd_path=slapd_path,
+                                         ldap_backend_extra_port=ldap_backend_extra_port,
+                                         ldap_backend_forced_uri=ldap_backend_forced_uri,
+                                         ldap_dryrun_mode=ldap_dryrun_mode)
 
         self.root = root
         self.setup_ds_path = setup_ds_path
@@ -635,13 +635,13 @@ class FDSBackend(LDAPBackend):
 
         self.fedoradsinf = os.path.join(self.ldapdir, "fedorads.inf")
         self.partitions_ldif = os.path.join(self.ldapdir,
-            "fedorads-partitions.ldif")
+                                            "fedorads-partitions.ldif")
         self.sasl_ldif = os.path.join(self.ldapdir, "fedorads-sasl.ldif")
         self.dna_ldif = os.path.join(self.ldapdir, "fedorads-dna.ldif")
         self.pam_ldif = os.path.join(self.ldapdir, "fedorads-pam.ldif")
         self.refint_ldif = os.path.join(self.ldapdir, "fedorads-refint.ldif")
         self.linked_attrs_ldif = os.path.join(self.ldapdir,
-            "fedorads-linked-attributes.ldif")
+                                              "fedorads-linked-attributes.ldif")
         self.index_ldif = os.path.join(self.ldapdir, "fedorads-index.ldif")
         self.samba_ldif = os.path.join(self.ldapdir, "fedorads-samba.ldif")
 
@@ -650,10 +650,10 @@ class FDSBackend(LDAPBackend):
         self.samba3_ldif = os.path.join(self.ldapdir, "samba3.ldif")
 
         self.retcode = subprocess.call(["bin/oLschema2ldif",
-                "-I", self.samba3_schema,
-                "-O", self.samba3_ldif,
-                "-b", self.names.domaindn],
-                close_fds=True, shell=False)
+                                        "-I", self.samba3_schema,
+                                        "-O", self.samba3_ldif,
+                                        "-b", self.names.domaindn],
+                                       close_fds=True, shell=False)
 
         if self.retcode != 0:
             raise Exception("Unable to convert Samba 3 schema.")
@@ -684,7 +684,7 @@ class FDSBackend(LDAPBackend):
                     "SERVERPORT": serverport})
 
         setup_file(setup_path("fedorads-partitions.ldif"),
-            self.partitions_ldif,
+                   self.partitions_ldif,
                    {"CONFIGDN": self.names.configdn,
                     "SCHEMADN": self.names.schemadn,
                     "SAMBADN": self.sambadn,
@@ -771,7 +771,7 @@ class FDSBackend(LDAPBackend):
         f = open(setup_path(mapping), 'r')
         try:
             backend_schema_data = self.schema.convert_to_openldap("fedora-ds",
-                f.read())
+                                                                  f.read())
         finally:
             f.close()
         assert backend_schema_data is not None
@@ -784,19 +784,21 @@ class FDSBackend(LDAPBackend):
         self.credentials.set_bind_dn(self.names.ldapmanagerdn)
 
         # Destory the target directory, or else setup-ds.pl will complain
-        fedora_ds_dir = os.path.join(self.ldapdir,
-            "slapd-" + self.ldap_instance)
+        fedora_ds_dir = \
+            os.path.join(self.ldapdir,
+                         "slapd-" + self.ldap_instance)
         shutil.rmtree(fedora_ds_dir, True)
 
         self.slapd_provision_command = [self.slapd_path, "-D", fedora_ds_dir,
-                "-i", self.slapd_pid]
+                                        "-i", self.slapd_pid]
         # In the 'provision' command line, stay in the foreground so we can
         # easily kill it
         self.slapd_provision_command.append("-d0")
 
         #the command for the final run is the normal script
-        self.slapd_command = [os.path.join(self.ldapdir,
-            "slapd-" + self.ldap_instance, "start-slapd")]
+        self.slapd_command = \
+            [os.path.join(self.ldapdir,
+                          "slapd-" + self.ldap_instance, "start-slapd")]
 
         # If we were just looking for crashes up to this point, it's a
         # good time to exit before we realise we don't have Fedora DS on
@@ -809,11 +811,11 @@ class FDSBackend(LDAPBackend):
             raise ProvisioningError("Fedora DS LDAP-Backend must be setup with path to setup-ds, e.g. --setup-ds-path=\"/usr/sbin/setup-ds.pl\"!")
         if not os.path.exists(self.setup_ds_path):
             self.logger.warning("Path (%s) to slapd does not exist!",
-                self.setup_ds_path)
+                                self.setup_ds_path)
 
         # Run the Fedora DS setup utility
         retcode = subprocess.call([self.setup_ds_path, "--silent", "--file",
-            self.fedoradsinf], close_fds=True, shell=False)
+                                   self.fedoradsinf], close_fds=True, shell=False)
         if retcode != 0:
             raise ProvisioningError("setup-ds failed")
 
@@ -839,4 +841,4 @@ class FDSBackend(LDAPBackend):
             m.dn = ldb.Dn(ldapi_db, dnstring)
             ldapi_db.modify(m)
         return LDAPBackendResult(self.credentials, self.slapd_command_escaped,
-            self.ldapdir)
+                                 self.ldapdir)
index 8ee6eba841db3d21f5359510684172f3cb6e6cf0..99372e364f8e8058bd1c75d6b6a0574cc75c2f54 100644 (file)
@@ -141,7 +141,7 @@ class SOARecord(dnsp.DnssrvRpcRecord):
 class SRVRecord(dnsp.DnssrvRpcRecord):
 
     def __init__(self, target, port, priority=0, weight=100, serial=1, ttl=900,
-                rank=dnsp.DNS_RANK_ZONE):
+                 rank=dnsp.DNS_RANK_ZONE):
         super(SRVRecord, self).__init__()
         self.wType = dnsp.DNS_TYPE_SRV
         self.rank = rank
@@ -314,8 +314,9 @@ def add_dns_container(samdb, domaindn, prefix, domain_sid, dnsadmins_sid, forest
     # CN=MicrosoftDNS,<PREFIX>,<DOMAINDN>
     msg = ldb.Message(ldb.Dn(samdb, "CN=MicrosoftDNS,%s,%s" % (prefix, domaindn)))
     msg["objectClass"] = ["top", "container"]
-    msg["nTSecurityDescriptor"] = ldb.MessageElement(sd_val, ldb.FLAG_MOD_ADD,
-        "nTSecurityDescriptor")
+    msg["nTSecurityDescriptor"] = \
+        ldb.MessageElement(sd_val, ldb.FLAG_MOD_ADD,
+                           "nTSecurityDescriptor")
     samdb.add(msg)
 
 
@@ -492,8 +493,10 @@ def add_domain_record(samdb, domaindn, prefix, dnsdomain, domainsid, dnsadmins_s
     props.append(ndr_pack(AgingEnabledTimeProperty()))
     msg = ldb.Message(ldb.Dn(samdb, "DC=%s,CN=MicrosoftDNS,%s,%s" % (dnsdomain, prefix, domaindn)))
     msg["objectClass"] = ["top", "dnsZone"]
-    msg["ntSecurityDescriptor"] = ldb.MessageElement(ndr_pack(sec), ldb.FLAG_MOD_ADD,
-        "nTSecurityDescriptor")
+    msg["ntSecurityDescriptor"] = \
+        ldb.MessageElement(ndr_pack(sec),
+                           ldb.FLAG_MOD_ADD,
+                           "nTSecurityDescriptor")
     msg["dNSProperty"] = ldb.MessageElement(props, ldb.FLAG_MOD_ADD, "dNSProperty")
     samdb.add(msg)
 
@@ -507,7 +510,7 @@ def add_msdcs_record(samdb, forestdn, prefix, dnsforest):
 
 
 def add_dc_domain_records(samdb, domaindn, prefix, site, dnsdomain, hostname,
-        hostip, hostip6):
+                          hostip, hostip6):
 
     fqdn_hostname = "%s.%s" % (hostname, dnsdomain)
 
@@ -517,39 +520,39 @@ def add_dc_domain_records(samdb, domaindn, prefix, site, dnsdomain, hostname,
 
     # DC=@ record
     add_at_record(samdb, domain_container_dn, "DC=@", hostname, dnsdomain,
-            hostip, hostip6)
+                  hostip, hostip6)
 
     # DC=<HOSTNAME> record
     add_host_record(samdb, domain_container_dn, "DC=%s" % hostname, hostip,
-            hostip6)
+                    hostip6)
 
     # DC=_kerberos._tcp record
     add_srv_record(samdb, domain_container_dn, "DC=_kerberos._tcp",
-            fqdn_hostname, 88)
+                   fqdn_hostname, 88)
 
     # DC=_kerberos._tcp.<SITENAME>._sites record
     add_srv_record(samdb, domain_container_dn, "DC=_kerberos._tcp.%s._sites" %
-            site, fqdn_hostname, 88)
+                   site, fqdn_hostname, 88)
 
     # DC=_kerberos._udp record
     add_srv_record(samdb, domain_container_dn, "DC=_kerberos._udp",
-            fqdn_hostname, 88)
+                   fqdn_hostname, 88)
 
     # DC=_kpasswd._tcp record
     add_srv_record(samdb, domain_container_dn, "DC=_kpasswd._tcp",
-            fqdn_hostname, 464)
+                   fqdn_hostname, 464)
 
     # DC=_kpasswd._udp record
     add_srv_record(samdb, domain_container_dn, "DC=_kpasswd._udp",
-            fqdn_hostname, 464)
+                   fqdn_hostname, 464)
 
     # DC=_ldap._tcp record
     add_srv_record(samdb, domain_container_dn, "DC=_ldap._tcp", fqdn_hostname,
-            389)
+                   389)
 
     # DC=_ldap._tcp.<SITENAME>._sites record
     add_srv_record(samdb, domain_container_dn, "DC=_ldap._tcp.%s._sites" %
-            site, fqdn_hostname, 389)
+                   site, fqdn_hostname, 389)
 
     # FIXME: The number of SRV records depend on the various roles this DC has.
     #        _gc and _msdcs records are added if the we are the forest dc and not subdomain dc
@@ -558,11 +561,11 @@ def add_dc_domain_records(samdb, domaindn, prefix, site, dnsdomain, hostname,
 
     # DC=_gc._tcp record
     add_srv_record(samdb, domain_container_dn, "DC=_gc._tcp", fqdn_hostname,
-            3268)
+                   3268)
 
     # DC=_gc._tcp.<SITENAME>,_sites record
     add_srv_record(samdb, domain_container_dn, "DC=_gc._tcp.%s._sites" % site,
-            fqdn_hostname, 3268)
+                   fqdn_hostname, 3268)
 
     # DC=_msdcs record
     add_ns_glue_record(samdb, domain_container_dn, "DC=_msdcs", fqdn_hostname)
@@ -574,13 +577,13 @@ def add_dc_domain_records(samdb, domaindn, prefix, site, dnsdomain, hostname,
 
     # DC=_ldap._tcp.<SITENAME>._sites.DomainDnsZones
     add_srv_record(samdb, domain_container_dn,
-            "DC=_ldap._tcp.%s._sites.DomainDnsZones" % site, fqdn_hostname,
-            389)
+                   "DC=_ldap._tcp.%s._sites.DomainDnsZones" % site, fqdn_hostname,
+                   389)
 
     # DC=_ldap._tcp.<SITENAME>._sites.ForestDnsZones
     add_srv_record(samdb, domain_container_dn,
-            "DC=_ldap._tcp.%s._sites.ForestDnsZones" % site, fqdn_hostname,
-            389)
+                   "DC=_ldap._tcp.%s._sites.ForestDnsZones" % site, fqdn_hostname,
+                   389)
 
     # DC=_ldap._tcp.DomainDnsZones
     add_srv_record(samdb, domain_container_dn, "DC=_ldap._tcp.DomainDnsZones",
@@ -592,11 +595,11 @@ def add_dc_domain_records(samdb, domaindn, prefix, site, dnsdomain, hostname,
 
     # DC=DomainDnsZones
     add_host_record(samdb, domain_container_dn, "DC=DomainDnsZones", hostip,
-            hostip6)
+                    hostip6)
 
     # DC=ForestDnsZones
     add_host_record(samdb, domain_container_dn, "DC=ForestDnsZones", hostip,
-            hostip6)
+                    hostip6)
 
 
 def add_dc_msdcs_records(samdb, forestdn, prefix, site, dnsforest, hostname,
@@ -610,46 +613,46 @@ def add_dc_msdcs_records(samdb, forestdn, prefix, site, dnsforest, hostname,
 
     # DC=@ record
     add_at_record(samdb, forest_container_dn, "DC=@", hostname, dnsforest,
-            None, None)
+                  None, None)
 
     # DC=_kerberos._tcp.dc record
     add_srv_record(samdb, forest_container_dn, "DC=_kerberos._tcp.dc",
-            fqdn_hostname, 88)
+                   fqdn_hostname, 88)
 
     # DC=_kerberos._tcp.<SITENAME>._sites.dc record
     add_srv_record(samdb, forest_container_dn,
-            "DC=_kerberos._tcp.%s._sites.dc" % site, fqdn_hostname, 88)
+                   "DC=_kerberos._tcp.%s._sites.dc" % site, fqdn_hostname, 88)
 
     # DC=_ldap._tcp.dc record
     add_srv_record(samdb, forest_container_dn, "DC=_ldap._tcp.dc",
-            fqdn_hostname, 389)
+                   fqdn_hostname, 389)
 
     # DC=_ldap._tcp.<SITENAME>._sites.dc record
     add_srv_record(samdb, forest_container_dn, "DC=_ldap._tcp.%s._sites.dc" %
-            site, fqdn_hostname, 389)
+                   site, fqdn_hostname, 389)
 
     # DC=_ldap._tcp.<SITENAME>._sites.gc record
     add_srv_record(samdb, forest_container_dn, "DC=_ldap._tcp.%s._sites.gc" %
-            site, fqdn_hostname, 3268)
+                   site, fqdn_hostname, 3268)
 
     # DC=_ldap._tcp.gc record
     add_srv_record(samdb, forest_container_dn, "DC=_ldap._tcp.gc",
-            fqdn_hostname, 3268)
+                   fqdn_hostname, 3268)
 
     # DC=_ldap._tcp.pdc record
     add_srv_record(samdb, forest_container_dn, "DC=_ldap._tcp.pdc",
-            fqdn_hostname, 389)
+                   fqdn_hostname, 389)
 
     # DC=gc record
     add_host_record(samdb, forest_container_dn, "DC=gc", hostip, hostip6)
 
     # DC=_ldap._tcp.<DOMAINGUID>.domains record
     add_srv_record(samdb, forest_container_dn,
-            "DC=_ldap._tcp.%s.domains" % domainguid, fqdn_hostname, 389)
+                   "DC=_ldap._tcp.%s.domains" % domainguid, fqdn_hostname, 389)
 
     # DC=<NTDSGUID>
     add_cname_record(samdb, forest_container_dn, "DC=%s" % ntdsguid,
-            fqdn_hostname)
+                     fqdn_hostname)
 
 
 def secretsdb_setup_dns(secretsdb, names, private_dir, binddns_dir, realm,
@@ -824,7 +827,7 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
             "DOMAINSID" : str(domainsid),
             "DESCRIPTOR" : descr})
         setup_add_ldif(dom_ldb,
-            setup_path("provision_basedn_options.ldif"), None)
+                       setup_path("provision_basedn_options.ldif"), None)
 
     except:
         logger.error(
@@ -850,9 +853,9 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
     metadata_file = "metadata.tdb"
     try:
         os.link(os.path.join(samldb_dir, metadata_file),
-            os.path.join(dns_samldb_dir, metadata_file))
+                os.path.join(dns_samldb_dir, metadata_file))
         os.link(os.path.join(private_dir, domainzone_file),
-            os.path.join(dns_dir, domainzone_file))
+                os.path.join(dns_dir, domainzone_file))
         if forestzone_file:
             os.link(os.path.join(private_dir, forestzone_file),
                     os.path.join(dns_dir, forestzone_file))
@@ -873,10 +876,10 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
             pfile = partfile[nc]
             if backend_store == "mdb":
                 mdb_copy(os.path.join(private_dir, pfile),
-                        os.path.join(dns_dir, pfile))
+                         os.path.join(dns_dir, pfile))
             else:
                 tdb_copy(os.path.join(private_dir, pfile),
-                        os.path.join(dns_dir, pfile))
+                         os.path.join(dns_dir, pfile))
     except:
         logger.error(
             "Failed to setup database for BIND, AD based DNS cannot be used")
@@ -980,7 +983,7 @@ def create_named_conf(paths, realm, dnsdomain, dns_backend, logger):
 
 
 def create_named_txt(path, realm, dnsdomain, dnsname, binddns_dir,
-        keytab_name):
+                     keytab_name):
     """Write out a file containing zone statements suitable for inclusion in a
     named.conf file (including GSS-TSIG configuration).
 
@@ -1030,7 +1033,7 @@ def create_dns_partitions(samdb, domainsid, names, domaindn, forestdn,
                           dnsadmins_sid, fill_level):
     # Set up additional partitions (DomainDnsZones, ForstDnsZones)
     setup_dns_partitions(samdb, domainsid, domaindn, forestdn,
-                        names.configdn, names.serverdn, fill_level)
+                         names.configdn, names.serverdn, fill_level)
 
     # Set up MicrosoftDNS containers
     add_dns_container(samdb, domaindn, "DC=DomainDnsZones", domainsid,
@@ -1089,8 +1092,8 @@ def fill_dns_data_partitions(samdb, domainsid, site, domaindn, forestdn,
 
 
 def setup_ad_dns(samdb, secretsdb, names, paths, lp, logger,
-        dns_backend, os_level, dnspass=None, hostip=None, hostip6=None,
-        targetdir=None, fill_level=FILL_FULL, backend_store=None):
+                 dns_backend, os_level, dnspass=None, hostip=None, hostip6=None,
+                 targetdir=None, fill_level=FILL_FULL, backend_store=None):
     """Provision DNS information (assuming GC role)
 
     :param samdb: LDB object connected to sam.ldb file
@@ -1190,9 +1193,9 @@ def setup_ad_dns(samdb, secretsdb, names, paths, lp, logger,
 
 
 def setup_bind9_dns(samdb, secretsdb, names, paths, lp, logger,
-        dns_backend, os_level, site=None, dnspass=None, hostip=None,
-        hostip6=None, targetdir=None, key_version_number=None,
-        backend_store=None):
+                    dns_backend, os_level, site=None, dnspass=None, hostip=None,
+                    hostip6=None, targetdir=None, key_version_number=None,
+                    backend_store=None):
     """Provision DNS information (assuming BIND9 backend in DC role)
 
     :param samdb: LDB object connected to sam.ldb file
index 4a7737b4ec65fef8e26a6216ff2556491cb04d1b..f9698cdfdc7c183031cf53df20c5dfb93806af2c 100644 (file)
@@ -160,7 +160,7 @@ def remove_dns_references(samdb, logger, dnsHostName, ignore_no_name=False):
 
         if len(a_recs) != orig_num_recs:
             logger.info("updating %s keeping %d values, removing %s values" % \
-                (a_name, len(a_recs), orig_num_recs - len(a_recs)))
+                        (a_name, len(a_recs), orig_num_recs - len(a_recs)))
             samdb.dns_replace(a_name, a_recs)
 
     remove_hanging_dns_references(samdb, logger, dnsHostNameUpper, zones)
@@ -305,7 +305,7 @@ def offline_remove_ntds_dc(samdb,
 
     try:
         msgs = samdb.search(base=ntds_dn, expression="objectClass=ntdsDSA",
-                        attrs=["objectGUID"], scope=ldb.SCOPE_BASE)
+                            attrs=["objectGUID"], scope=ldb.SCOPE_BASE)
     except LdbError as e5:
         (enum, estr) = e5.args
         if enum == ldb.ERR_NO_SUCH_OBJECT:
@@ -388,7 +388,7 @@ def remove_dc(samdb, logger, dc_name):
                                        attrs=[],
                                        expression="(&(objectClass=server)"
                                        "(cn=%s))"
-                                    % ldb.binary_encode(dc_name))
+                                       % ldb.binary_encode(dc_name))
         except LdbError as e3:
             (enum, estr) = e3.args
             raise DemoteException("Failure checking if %s is an server "
index 8911b6bb7a69b1ec791785f167998b946103fb6f..073244ba7f7eb082b67746995434e03e5d302943 100644 (file)
@@ -60,8 +60,8 @@ class SamDB(samba.Ldb):
         self.url = url
 
         super(SamDB, self).__init__(url=url, lp=lp, modules_dir=modules_dir,
-            session_info=session_info, credentials=credentials, flags=flags,
-            options=options)
+                                    session_info=session_info, credentials=credentials, flags=flags,
+                                    options=options)
 
         if global_schema:
             dsdb._dsdb_set_global_schema(self)
@@ -76,7 +76,7 @@ class SamDB(samba.Ldb):
         self.url = url
 
         super(SamDB, self).connect(url=url, flags=flags,
-                options=options)
+                                   options=options)
 
     def am_rodc(self):
         '''return True if we are an RODC'''
@@ -200,8 +200,8 @@ pwdLastSet: 0
         # The new user record. Note the reliance on the SAMLDB module which
         # fills in the default informations
         ldbmessage = {"dn": group_dn,
-            "sAMAccountName": groupname,
-            "objectClass": "group"}
+                      "sAMAccountName": groupname,
+                      "objectClass": "group"}
 
         if grouptype is not None:
             ldbmessage["groupType"] = normalise_int32(grouptype)
@@ -237,7 +237,7 @@ pwdLastSet: 0
         self.transaction_start()
         try:
             targetgroup = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE,
-                               expression=groupfilter, attrs=[])
+                                      expression=groupfilter, attrs=[])
             if len(targetgroup) == 0:
                 raise Exception('Unable to find group "%s"' % groupname)
             assert(len(targetgroup) == 1)
@@ -264,7 +264,7 @@ pwdLastSet: 0
         self.transaction_start()
         try:
             targetgroup = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE,
-                               expression=groupfilter, attrs=['member'])
+                                      expression=groupfilter, attrs=['member'])
             if len(targetgroup) == 0:
                 raise Exception('Unable to find group "%s"' % groupname)
             assert(len(targetgroup) == 1)
@@ -324,15 +324,15 @@ member: %s
             self.transaction_commit()
 
     def newuser(self, username, password,
-            force_password_change_at_next_login_req=False,
-            useusernameascn=False, userou=None, surname=None, givenname=None,
-            initials=None, profilepath=None, scriptpath=None, homedrive=None,
-            homedirectory=None, jobtitle=None, department=None, company=None,
-            description=None, mailaddress=None, internetaddress=None,
-            telephonenumber=None, physicaldeliveryoffice=None, sd=None,
-            setpassword=True, uidnumber=None, gidnumber=None, gecos=None,
-            loginshell=None, uid=None, nisdomain=None, unixhome=None,
-            smartcard_required=False):
+                force_password_change_at_next_login_req=False,
+                useusernameascn=False, userou=None, surname=None, givenname=None,
+                initials=None, profilepath=None, scriptpath=None, homedrive=None,
+                homedirectory=None, jobtitle=None, department=None, company=None,
+                description=None, mailaddress=None, internetaddress=None,
+                telephonenumber=None, physicaldeliveryoffice=None, sd=None,
+                setpassword=True, uidnumber=None, gidnumber=None, gecos=None,
+                loginshell=None, uid=None, nisdomain=None, unixhome=None,
+                smartcard_required=False):
         """Adds a new user with additional parameters
 
         :param username: Name of the new user
@@ -451,7 +451,7 @@ member: %s
 
         ldbmessage2 = None
         if any(map(lambda b: b is not None, (uid, uidnumber, gidnumber, gecos,
-                loginshell, nisdomain, unixhome))):
+                                             loginshell, nisdomain, unixhome))):
             ldbmessage2 = ldb.Message()
             ldbmessage2.dn = ldb.Dn(self, user_dn)
             if uid is not None:
@@ -576,7 +576,7 @@ member: %s
             self.transaction_commit()
 
     def setpassword(self, search_filter, password,
-            force_change_at_next_login=False, username=None):
+                    force_change_at_next_login=False, username=None):
         """Sets the password for a user
 
         :param search_filter: LDAP filter to find the user (eg
@@ -630,8 +630,8 @@ unicodePwd:: %s
         self.transaction_start()
         try:
             res = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE,
-                          expression=search_filter,
-                          attrs=["userAccountControl", "accountExpires"])
+                              expression=search_filter,
+                              attrs=["userAccountControl", "accountExpires"])
             if len(res) == 0:
                 raise Exception('Unable to find user "%s"' % search_filter)
             assert(len(res) == 1)
@@ -674,7 +674,7 @@ accountExpires: %u
         return dsdb._samdb_get_domain_sid(self)
 
     domain_sid = property(get_domain_sid, set_domain_sid,
-        "SID for the domain")
+                          "SID for the domain")
 
     def set_invocation_id(self, invocation_id):
         """Set the invocation id for this SamDB handle.
@@ -688,16 +688,16 @@ accountExpires: %u
         return dsdb._samdb_ntds_invocation_id(self)
 
     invocation_id = property(get_invocation_id, set_invocation_id,
-        "Invocation ID GUID")
+                             "Invocation ID GUID")
 
     def get_oid_from_attid(self, attid):
         return dsdb._dsdb_get_oid_from_attid(self, attid)
 
     def get_attid_from_lDAPDisplayName(self, ldap_display_name,
-            is_schema_nc=False):
+                                       is_schema_nc=False):
         '''return the attribute ID for a LDAP attribute as an integer as found in DRSUAPI'''
         return dsdb._dsdb_get_attid_from_lDAPDisplayName(self,
-            ldap_display_name, is_schema_nc)
+                                                         ldap_display_name, is_schema_nc)
 
     def get_syntax_oid_from_lDAPDisplayName(self, ldap_display_name):
         '''return the syntax OID for a LDAP attribute as a string'''
@@ -802,7 +802,7 @@ schemaUpdateNow: 1
         res = self.search(expression="objectClass=attributeSchema",
                           controls=["search_options:1:2"],
                           attrs=["attributeID",
-                           "lDAPDisplayName"])
+                                 "lDAPDisplayName"])
         if len(res) > 0:
             for e in res:
                 strDisplay = str(e.get("lDAPDisplayName"))
@@ -839,7 +839,7 @@ schemaUpdateNow: 1
         return None
 
     def set_attribute_replmetadata_version(self, dn, att, value,
-            addifnotexist=False):
+                                           addifnotexist=False):
         res = self.search(expression="distinguishedName=%s" % dn,
                           scope=ldb.SCOPE_SUBTREE,
                           controls=["search_options:1:2"],
@@ -887,9 +887,10 @@ schemaUpdateNow: 1
             replBlob = ndr_pack(repl)
             msg = ldb.Message()
             msg.dn = res[0].dn
-            msg["replPropertyMetaData"] = ldb.MessageElement(replBlob,
-                                                ldb.FLAG_MOD_REPLACE,
-                                                "replPropertyMetaData")
+            msg["replPropertyMetaData"] = \
+                ldb.MessageElement(replBlob,
+                                   ldb.FLAG_MOD_REPLACE,
+                                   "replPropertyMetaData")
             self.modify(msg, ["local_oid:1.3.6.1.4.1.7165.4.3.14:0"])
 
     def write_prefixes_from_schema(self):
@@ -988,11 +989,14 @@ schemaUpdateNow: 1
         m.dn = ldb.Dn(self, "CN=Directory Service,CN=Windows NT,CN=Services,%s"
                       % self.get_config_basedn().get_linearized())
         if dsheuristics is not None:
-            m["dSHeuristics"] = ldb.MessageElement(dsheuristics,
-                ldb.FLAG_MOD_REPLACE, "dSHeuristics")
+            m["dSHeuristics"] = \
+                ldb.MessageElement(dsheuristics,
+                                   ldb.FLAG_MOD_REPLACE,
+                                   "dSHeuristics")
         else:
-            m["dSHeuristics"] = ldb.MessageElement([], ldb.FLAG_MOD_DELETE,
-                "dSHeuristics")
+            m["dSHeuristics"] = \
+                ldb.MessageElement([], ldb.FLAG_MOD_DELETE,
+                                   "dSHeuristics")
         self.modify(m)
 
     def get_dsheuristics(self):
index 8d7006586d8231c5d2f00c8396509be0197a7b37..1e846329452ffaec6dc3a5298960db180ebc0a7d 100644 (file)
@@ -65,8 +65,8 @@ class Schema(object):
     # the schema files (and corresponding object version) that we know about
     base_schemas = {
         "2008_R2_old" : ("MS-AD_Schema_2K8_R2_Attributes.txt",
-                        "MS-AD_Schema_2K8_R2_Classes.txt",
-                        47),
+                         "MS-AD_Schema_2K8_R2_Classes.txt",
+                         47),
        "2008_R2" : ("Attributes_for_AD_DS__Windows_Server_2008_R2.ldf",
                     "Classes_for_AD_DS__Windows_Server_2008_R2.ldf",
                     47),
@@ -114,7 +114,7 @@ class Schema(object):
                 self.schema_data += open(file, 'r').read()
 
         self.schema_data = substitute_var(self.schema_data,
-            {"SCHEMADN": schemadn})
+                                          {"SCHEMADN": schemadn})
         check_all_substituted(self.schema_data)
 
         schema_version = str(Schema.get_version(base_schema))
@@ -248,4 +248,4 @@ def ldb_with_schema(schemadn="cn=schema,cn=configuration,dc=example,dc=com",
     else:
         domainsid = security.dom_sid(domainsid)
     return Schema(domainsid, schemadn=schemadn,
-        override_prefixmap=override_prefixmap)
+                  override_prefixmap=override_prefixmap)
index 86575890652cc1c3e80d50b44ca96ae8506c6f44..6f7aea09ccffdec83adf6ae91f3e55206df8ef78 100644 (file)
@@ -55,7 +55,7 @@ def create_site(samdb, configDn, siteName):
     """
 
     ret = samdb.search(base=configDn, scope=ldb.SCOPE_SUBTREE,
-                    expression='(&(objectclass=Site)(cn=%s))' % siteName)
+                       expression='(&(objectclass=Site)(cn=%s))' % siteName)
     if len(ret) != 0:
         raise SiteAlreadyExistsException('A site with the name %s already exists' % siteName)
 
index cdc593398a005ec9a9d81f2b248e360c1ef61dde..ae208430d169ce8cb5aa735cba6620b39fc8f1db 100644 (file)
@@ -57,7 +57,7 @@ class RemotedTestCase(unittest.TestCase):
 
     def error(self, label):
         raise NotImplementedError("%s on RemotedTestCases is not permitted." %
-            label)
+                                  label)
 
     def setUp(self):
         self.error("setUp")
index 4704b925de5840b35e69b86d6ec01782d82ed1b0..b8e55528775d5ec7fcdb3b5aaa7994a57c790cd7 100644 (file)
@@ -93,7 +93,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         self.assertEquals("Authentication", msg["type"])
         self.assertEquals("NT_STATUS_OK", msg["Authentication"]["status"])
         self._assert_ncacn_np_serviceDescription(binding,
-                          msg["Authentication"]["serviceDescription"])
+                                                 msg["Authentication"]["serviceDescription"])
         self.assertEquals(authTypes[1],
                           msg["Authentication"]["authDescription"])
 
@@ -101,7 +101,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         msg = messages[1]
         self.assertEquals("Authorization", msg["type"])
         self._assert_ncacn_np_serviceDescription(binding,
-                          msg["Authorization"]["serviceDescription"])
+                                                 msg["Authorization"]["serviceDescription"])
         self.assertEquals(authTypes[2], msg["Authorization"]["authType"])
         self.assertEquals("SMB", msg["Authorization"]["transportProtection"])
         self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
@@ -161,7 +161,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         msg = messages[2]
         self.assertEquals("Authorization", msg["type"])
         self._assert_ncacn_np_serviceDescription(binding,
-                          msg["Authorization"]["serviceDescription"])
+                                                 msg["Authorization"]["serviceDescription"])
         self.assertEquals(authTypes[3], msg["Authorization"]["authType"])
         self.assertEquals("SMB", msg["Authorization"]["transportProtection"])
         self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
@@ -486,7 +486,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
 
         creds = self.insta_creds(template=self.get_credentials())
         creds.set_bind_dn("%s\\%s" % (creds.get_domain(),
-                          creds.get_username()))
+                                      creds.get_username()))
 
         self.samdb = SamDB(url="ldaps://%s" % os.environ["SERVER"],
                            lp=self.get_loadparm(),
@@ -517,7 +517,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         creds = self.insta_creds(template=self.get_credentials())
         creds.set_password("badPassword")
         creds.set_bind_dn("%s\\%s" % (creds.get_domain(),
-                          creds.get_username()))
+                                      creds.get_username()))
 
         thrown = False
         try:
index 504d458b7f80afbd29abb4600a73c76da404c226..4abb05420d2d20447849d250de041ccdcb57bf12 100644 (file)
@@ -30,24 +30,24 @@ class SubstituteVarTestCase(TestCase):
 
     def test_nothing(self):
         self.assertEquals("foo bar",
-                samba.substitute_var("foo bar", {"bar": "bla"}))
+                          samba.substitute_var("foo bar", {"bar": "bla"}))
 
     def test_replace(self):
         self.assertEquals("foo bla",
-                samba.substitute_var("foo ${bar}", {"bar": "bla"}))
+                          samba.substitute_var("foo ${bar}", {"bar": "bla"}))
 
     def test_broken(self):
         self.assertEquals("foo ${bdkjfhsdkfh sdkfh ",
-            samba.substitute_var("foo ${bdkjfhsdkfh sdkfh ", {"bar": "bla"}))
+                          samba.substitute_var("foo ${bdkjfhsdkfh sdkfh ", {"bar": "bla"}))
 
     def test_unknown_var(self):
         self.assertEquals("foo ${bla} gsff",
-                samba.substitute_var("foo ${bla} gsff", {"bar": "bla"}))
+                          samba.substitute_var("foo ${bla} gsff", {"bar": "bla"}))
 
     def test_check_all_substituted(self):
         samba.check_all_substituted("nothing to see here")
         self.assertRaises(Exception, samba.check_all_substituted,
-                "Not subsituted: ${FOOBAR}")
+                          "Not subsituted: ${FOOBAR}")
 
 class ArcfourTestCase(TestCase):
 
@@ -73,7 +73,7 @@ class LdbExtensionTests(TestCaseInTempDir):
         try:
             l.add({"dn": "foo=dc", "bar": "bla"})
             self.assertEquals(b"bla",
-                l.searchone(basedn=ldb.Dn(l, "foo=dc"), attribute="bar"))
+                              l.searchone(basedn=ldb.Dn(l, "foo=dc"), attribute="bar"))
         finally:
             del l
             os.unlink(path)
index 380164cff1081da14e4fcde3e3b0f68a8ccf27fa..00968f15f0e04b0fb3805f950473352f19821ed6 100644 (file)
@@ -28,33 +28,33 @@ class BareTestCase(samba.tests.TestCase):
     def test_bare(self):
         # Connect to the echo pipe
         x = ClientConnection("ncalrpc:localhost[DEFAULT]",
-                ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
-                lp_ctx=samba.tests.env_loadparm())
+                             ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
+                             lp_ctx=samba.tests.env_loadparm())
         self.assertEquals(b"\x01\x00\x00\x00", x.request(0, chr(0) * 4))
 
     def test_two_contexts(self):
         x = ClientConnection("ncalrpc:localhost[DEFAULT]",
-                ("12345778-1234-abcd-ef00-0123456789ac", 1),
-                lp_ctx=samba.tests.env_loadparm())
+                             ("12345778-1234-abcd-ef00-0123456789ac", 1),
+                             lp_ctx=samba.tests.env_loadparm())
         y = ClientConnection("ncalrpc:localhost",
-                ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
-                basis_connection=x, lp_ctx=samba.tests.env_loadparm())
+                             ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
+                             basis_connection=x, lp_ctx=samba.tests.env_loadparm())
         self.assertEquals(24, len(x.request(0, chr(0) * 8)))
         self.assertEquals(b"\x01\x00\x00\x00", y.request(0, chr(0) * 4))
 
     def test_bare_tcp(self):
         # Connect to the echo pipe
         x = ClientConnection("ncacn_ip_tcp:%s" % os.environ["SERVER"],
-                ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
-                lp_ctx=samba.tests.env_loadparm())
+                             ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
+                             lp_ctx=samba.tests.env_loadparm())
         self.assertEquals(b"\x01\x00\x00\x00", x.request(0, chr(0) * 4))
 
     def test_two_contexts_tcp(self):
         x = ClientConnection("ncacn_ip_tcp:%s" % os.environ["SERVER"],
-                ("12345778-1234-abcd-ef00-0123456789ac", 1),
-                lp_ctx=samba.tests.env_loadparm())
+                             ("12345778-1234-abcd-ef00-0123456789ac", 1),
+                             lp_ctx=samba.tests.env_loadparm())
         y = ClientConnection("ncacn_ip_tcp:%s" % os.environ["SERVER"],
-                ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
-                basis_connection=x, lp_ctx=samba.tests.env_loadparm())
+                             ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
+                             basis_connection=x, lp_ctx=samba.tests.env_loadparm())
         self.assertEquals(24, len(x.request(0, chr(0) * 8)))
         self.assertEquals(b"\x01\x00\x00\x00", y.request(0, chr(0) * 4))
index 404dde0040ba95f844c84fc6c0fae2b7dcf10259..2a1a87be492ae83e75082b9501cadfa4822c270a 100755 (executable)
@@ -68,9 +68,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         # self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -113,9 +113,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         # self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -135,9 +135,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         # self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -366,7 +366,7 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.verify_pdu(rep, dcerpc.DCERPC_PKT_BIND_NAK, req.call_id,
                         auth_length=0)
         self.assertEquals(rep.u.reject_reason,
-                dcerpc.DCERPC_BIND_NAK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_NAK_REASON_NOT_SPECIFIED)
         self.assertEquals(rep.u.num_versions, 1)
         self.assertEquals(rep.u.versions[0].rpc_vers, req.rpc_vers)
         self.assertEquals(rep.u.versions[0].rpc_vers_minor, req.rpc_vers_minor)
@@ -381,7 +381,7 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.verify_pdu(rep, dcerpc.DCERPC_PKT_BIND_NAK, req.call_id,
                         auth_length=0)
         self.assertEquals(rep.u.reject_reason,
-                dcerpc.DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED)
+                          dcerpc.DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED)
         self.assertEquals(rep.u.num_versions, 1)
         self.assertEquals(rep.u.versions[0].rpc_vers, req.rpc_vers)
         self.assertEquals(rep.u.versions[0].rpc_vers_minor, req.rpc_vers_minor)
@@ -412,9 +412,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -432,7 +432,7 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.verify_pdu(rep, dcerpc.DCERPC_PKT_BIND_NAK, req.call_id,
                         auth_length=0)
         self.assertEquals(rep.u.reject_reason,
-                dcerpc.DCERPC_BIND_NAK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_NAK_REASON_NOT_SPECIFIED)
         self.assertEquals(rep.u.num_versions, 1)
         self.assertEquals(rep.u.versions[0].rpc_vers, req.rpc_vers)
         self.assertEquals(rep.u.versions[0].rpc_vers_minor, req.rpc_vers_minor)
@@ -452,7 +452,7 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.verify_pdu(rep, dcerpc.DCERPC_PKT_BIND_NAK, req.call_id,
                         auth_length=0)
         self.assertEquals(rep.u.reject_reason,
-                dcerpc.DCERPC_BIND_NAK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_NAK_REASON_NOT_SPECIFIED)
         self.assertEquals(rep.u.num_versions, 1)
         self.assertEquals(rep.u.versions[0].rpc_vers, req.rpc_vers)
         self.assertEquals(rep.u.versions[0].rpc_vers_minor, req.rpc_vers_minor)
@@ -488,9 +488,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -541,9 +541,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -561,9 +561,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         #self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -611,9 +611,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, zero_syntax)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -631,9 +631,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         #self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, zero_syntax)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -669,9 +669,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         #self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, zero_syntax)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -693,7 +693,7 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.verify_pdu(rep, dcerpc.DCERPC_PKT_BIND_NAK, req.call_id,
                         auth_length=0)
         self.assertEquals(rep.u.reject_reason,
-                dcerpc.DCERPC_BIND_NAK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_NAK_REASON_NOT_SPECIFIED)
         self.assertEquals(rep.u.num_versions, 1)
         self.assertEquals(rep.u.versions[0].rpc_vers, req.rpc_vers)
         self.assertEquals(rep.u.versions[0].rpc_vers_minor, req.rpc_vers_minor)
@@ -731,9 +731,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -792,9 +792,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -854,9 +854,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -883,9 +883,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         #self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, zero_syntax)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -932,9 +932,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, zero_syntax)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -958,9 +958,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         #self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -997,9 +997,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         #self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -1036,9 +1036,9 @@ class TestDCERPC_BIND(RawDCERPCTest):
         #self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 1)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -1082,14 +1082,14 @@ class TestDCERPC_BIND(RawDCERPCTest):
         #self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 2)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE)
         self.assertEquals(rep.u.ctx_list[0].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_NOT_SPECIFIED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[0].syntax, ndr32)
         self.assertEquals(rep.u.ctx_list[1].result,
-                dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
+                          dcerpc.DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION)
         self.assertEquals(rep.u.ctx_list[1].reason,
-                dcerpc.DCERPC_BIND_ACK_REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED)
+                          dcerpc.DCERPC_BIND_ACK_REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED)
         self.assertNDRSyntaxEquals(rep.u.ctx_list[1].syntax, zero_syntax)
         self.assertEquals(rep.u.auth_info, '\0' * 0)
 
@@ -1119,14 +1119,14 @@ class TestDCERPC_BIND(RawDCERPCTest):
         #self.assertEquals(rep.u._pad1, '\0' * 2)
         self.assertEquals(rep.u.num_results, 2)
         self.assertEquals(rep.u.ctx_list[0].result,
-                dc