diff options
51 files changed, 233 insertions, 233 deletions
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py index 843649fa5db..521c8415c1b 100644 --- a/python/samba/dbchecker.py +++ b/python/samba/dbchecker.py @@ -597,7 +597,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) def err_missing_dn_GUID_component(self, dn, attrname, val, dsdb_dn, errstr): """handle a missing GUID extended DN component""" self.report("ERROR: %s component for %s in object %s - %s" % (errstr, attrname, dn, val)) - controls=["extended_dn:1:1", "show_recycled:1"] + controls = ["extended_dn:1:1", "show_recycled:1"] try: res = self.samdb.search(base=str(dsdb_dn.dn), scope=ldb.SCOPE_BASE, attrs=[], controls=controls) @@ -629,7 +629,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) def err_incorrect_binary_dn(self, dn, attrname, val, dsdb_dn, errstr): """handle an incorrect binary DN component""" self.report("ERROR: %s binary component for %s in object %s - %s" % (errstr, attrname, dn, val)) - controls=["extended_dn:1:1", "show_recycled:1"] + controls = ["extended_dn:1:1", "show_recycled:1"] if not self.confirm_all('Change DN to %s?' % str(dsdb_dn), 'fix_all_binary_dn'): self.report("Not fixing %s" % errstr) @@ -1224,7 +1224,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) dsdb_dn.binary = "%08X" % int(res[0]['instanceType'][0]) if str(dsdb_dn) != val: - error_count +=1 + error_count += 1 self.err_incorrect_binary_dn(obj.dn, attrname, val, dsdb_dn, "incorrect instanceType part of Binary DN") continue @@ -2097,7 +2097,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) if len(set_attrs_from_md) < len(list_attid_from_md) \ or len(wrong_attids) > 0 \ or sorted(list_attid_from_md) != list_attid_from_md: - error_count +=1 + error_count += 1 self.err_replmetadata_incorrect_attid(dn, attrname, obj[attrname], wrong_attids) else: diff --git a/python/samba/descriptor.py b/python/samba/descriptor.py index 7009cf67f52..4aad686bd45 100644 --- a/python/samba/descriptor.py +++ b/python/samba/descriptor.py @@ -44,7 +44,7 @@ def sddl2binary(sddl_in, domain_sid, name_map): return ndr_pack(sec) def get_empty_descriptor(domain_sid, name_map={}): - sddl= "" + sddl = "" return sddl2binary(sddl, domain_sid, name_map) # "get_schema_descriptor" is located in "schema.py" @@ -127,7 +127,7 @@ def get_config_delete_protected2_descriptor(domain_sid, name_map={}): return sddl2binary(sddl, domain_sid, name_map) def get_domain_descriptor(domain_sid, name_map={}): - sddl= "O:BAG:BAD:AI(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \ + sddl = "O:BAG:BAD:AI(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \ "(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;bf967aba-0de6-11d0-a285-00aa003049e2;RU)" \ "(OA;CIIO;RP;5f202010-79a5-11d0-9020-00c04fc2d4cf;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \ "(OA;CIIO;RP;5f202010-79a5-11d0-9020-00c04fc2d4cf;bf967aba-0de6-11d0-a285-00aa003049e2;RU)" \ diff --git a/python/samba/gpclass.py b/python/samba/gpclass.py index 106bed26cdd..c419c363611 100644 --- a/python/samba/gpclass.py +++ b/python/samba/gpclass.py @@ -373,7 +373,7 @@ class gp_inf_ext(gp_ext): # then we return that boolean at the end. inf_conf = ConfigParser() - inf_conf.optionxform=str + inf_conf.optionxform = str try: inf_conf.readfp(StringIO(policy)) except: diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index e8c2e1de9bb..050a158e2e4 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -545,7 +545,7 @@ class cmd_domain_provision(Command): def _get_nameserver_ip(self): """Grab the nameserver IP address from /etc/resolv.conf.""" from os import path - RESOLV_CONF="/etc/resolv.conf" + RESOLV_CONF = "/etc/resolv.conf" if not path.isfile(RESOLV_CONF): self.logger.warning("Failed to locate %s" % RESOLV_CONF) @@ -1226,7 +1226,7 @@ class cmd_domain_level(Command): # Directly on the base DN m = ldb.Message() m.dn = ldb.Dn(samdb, domain_dn) - m["msDS-Behavior-Version"]= ldb.MessageElement( + m["msDS-Behavior-Version"] = ldb.MessageElement( str(new_level_domain), ldb.FLAG_MOD_REPLACE, "msDS-Behavior-Version") samdb.modify(m) @@ -1234,7 +1234,7 @@ class cmd_domain_level(Command): m = ldb.Message() m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup") + ",CN=Partitions,%s" % samdb.get_config_basedn()) - m["msDS-Behavior-Version"]= ldb.MessageElement( + m["msDS-Behavior-Version"] = ldb.MessageElement( str(new_level_domain), ldb.FLAG_MOD_REPLACE, "msDS-Behavior-Version") try: @@ -1266,7 +1266,7 @@ class cmd_domain_level(Command): m = ldb.Message() m.dn = ldb.Dn(samdb, "CN=Partitions,%s" % samdb.get_config_basedn()) - m["msDS-Behavior-Version"]= ldb.MessageElement( + m["msDS-Behavior-Version"] = ldb.MessageElement( str(new_level_forest), ldb.FLAG_MOD_REPLACE, "msDS-Behavior-Version") samdb.modify(m) @@ -1855,7 +1855,7 @@ class DomainTrustCommand(Command): server_type_string)) self.remote_server = remote_info.pdc_dns_name - self.remote_binding_string="ncacn_np:%s[%s]" % (self.remote_server, remote_binding_options) + self.remote_binding_string = "ncacn_np:%s[%s]" % (self.remote_server, remote_binding_options) self.remote_creds = remote_creds return self.remote_server @@ -3977,7 +3977,7 @@ class ldif_schema_update: print("Defunct object %s doesn't exist, skipping" % self.dn) return True elif self.unknown_oid is not None: - print("Skipping unknown OID %s for object %s" %(self.unknown_oid, self.dn)) + print("Skipping unknown OID %s for object %s" % (self.unknown_oid, self.dn)) return True return False diff --git a/python/samba/netcmd/drs.py b/python/samba/netcmd/drs.py index 12cfee02d81..2d4ad9cd501 100644 --- a/python/samba/netcmd/drs.py +++ b/python/samba/netcmd/drs.py @@ -729,7 +729,7 @@ class cmd_drs_options(Command): #save new options m = ldb.Message() m.dn = ldb.Dn(self.samdb, ntds_dn) - m["options"]= ldb.MessageElement(str(dsa_opts), ldb.FLAG_MOD_REPLACE, "options") + m["options"] = ldb.MessageElement(str(dsa_opts), ldb.FLAG_MOD_REPLACE, "options") self.samdb.modify(m) # print out new DSA options cur_opts = [x for x in self.option_map if self.option_map[x] & dsa_opts] diff --git a/python/samba/netcmd/fsmo.py b/python/samba/netcmd/fsmo.py index e8a64f98513..3dab02407dc 100644 --- a/python/samba/netcmd/fsmo.py +++ b/python/samba/netcmd/fsmo.py @@ -118,7 +118,7 @@ def transfer_dns_role(outf, sambaopts, credopts, role, samdb): m = ldb.Message() m.dn = ldb.Dn(samdb, role_object) - m["fSMORoleOwner"]= ldb.MessageElement(new_owner, + m["fSMORoleOwner"] = ldb.MessageElement(new_owner, ldb.FLAG_MOD_ADD, "fSMORoleOwner") try: @@ -164,7 +164,7 @@ def transfer_role(outf, role, samdb): m.dn = ldb.Dn(samdb, "") if role == "rid": master_owner = get_fsmo_roleowner(samdb, rid_dn, role) - m["becomeRidMaster"]= ldb.MessageElement( + m["becomeRidMaster"] = ldb.MessageElement( "1", ldb.FLAG_MOD_REPLACE, "becomeRidMaster") elif role == "pdc": @@ -174,22 +174,22 @@ def transfer_role(outf, role, samdb): scope=ldb.SCOPE_BASE, attrs=["objectSid"]) assert len(res) == 1 sid = res[0]["objectSid"][0] - m["becomePdc"]= ldb.MessageElement( + m["becomePdc"] = ldb.MessageElement( sid, ldb.FLAG_MOD_REPLACE, "becomePdc") elif role == "naming": master_owner = get_fsmo_roleowner(samdb, naming_dn, role) - m["becomeDomainMaster"]= ldb.MessageElement( + m["becomeDomainMaster"] = ldb.MessageElement( "1", ldb.FLAG_MOD_REPLACE, "becomeDomainMaster") elif role == "infrastructure": master_owner = get_fsmo_roleowner(samdb, infrastructure_dn, role) - m["becomeInfrastructureMaster"]= ldb.MessageElement( + m["becomeInfrastructureMaster"] = ldb.MessageElement( "1", ldb.FLAG_MOD_REPLACE, "becomeInfrastructureMaster") elif role == "schema": master_owner = get_fsmo_roleowner(samdb, schema_dn, role) - m["becomeSchemaMaster"]= ldb.MessageElement( + m["becomeSchemaMaster"] = ldb.MessageElement( "1", ldb.FLAG_MOD_REPLACE, "becomeSchemaMaster") else: @@ -297,7 +297,7 @@ You must provide an Admin user and password."""), if force is not None or seize == True: self.message("Seizing %s FSMO role..." % role) - m["fSMORoleOwner"]= ldb.MessageElement( + m["fSMORoleOwner"] = ldb.MessageElement( serviceName, ldb.FLAG_MOD_REPLACE, "fSMORoleOwner") @@ -380,7 +380,7 @@ You must provide an Admin user and password."""), if force is not None or seize == True: self.message("Seizing %s FSMO role..." % role) - m["fSMORoleOwner"]= ldb.MessageElement( + m["fSMORoleOwner"] = ldb.MessageElement( serviceName, ldb.FLAG_MOD_REPLACE, "fSMORoleOwner") try: diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py index bbe4834e135..75a6ca77d53 100644 --- a/python/samba/netcmd/gpo.py +++ b/python/samba/netcmd/gpo.py @@ -471,7 +471,7 @@ class cmd_list(Command): continue try: - sd_flags=security.SECINFO_OWNER|security.SECINFO_GROUP|security.SECINFO_DACL + sd_flags = security.SECINFO_OWNER|security.SECINFO_GROUP|security.SECINFO_DACL gmsg = self.samdb.search(base=g['dn'], scope=ldb.SCOPE_BASE, attrs=['name', 'displayName', 'flags', 'nTSecurityDescriptor'], @@ -1250,7 +1250,7 @@ class cmd_create(Command): m['a05'] = ldb.MessageElement("0", ldb.FLAG_MOD_REPLACE, "versionNumber") m['a07'] = ldb.MessageElement("2", ldb.FLAG_MOD_REPLACE, "gpcFunctionalityVersion") m['a04'] = ldb.MessageElement("0", ldb.FLAG_MOD_REPLACE, "flags") - controls=["permissive_modify:0"] + controls = ["permissive_modify:0"] self.samdb.modify(m, controls=controls) except Exception: self.samdb.transaction_cancel() diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py index 88fe857c825..0a00c452d98 100644 --- a/python/samba/netcmd/ldapcmp.py +++ b/python/samba/netcmd/ldapcmp.py @@ -748,7 +748,7 @@ class LDAPBundel(object): # It does not matter if they are in the same DC, in two DC in one domain or in two # different domains. if self.search_scope != SCOPE_BASE: - title= "\n* DNs found only in %s:" % self.con.host + title = "\n* DNs found only in %s:" % self.con.host for x in self.dn_list: if not x.upper() in [q.upper() for q in other.dn_list]: if title and not self.skip_missing_dn: @@ -759,7 +759,7 @@ class LDAPBundel(object): self.dn_list[self.dn_list.index(x)] = "" self.dn_list = [x for x in self.dn_list if x] # - title= "\n* DNs found only in %s:" % other.con.host + title = "\n* DNs found only in %s:" % other.con.host for x in other.dn_list: if not x.upper() in [q.upper() for q in self.dn_list]: if title and not self.skip_missing_dn: diff --git a/python/samba/netcmd/ntacl.py b/python/samba/netcmd/ntacl.py index d2a232d8a63..30410b16bf1 100644 --- a/python/samba/netcmd/ntacl.py +++ b/python/samba/netcmd/ntacl.py @@ -215,7 +215,7 @@ class cmd_ntacl_sysvolreset(Command): s3conf.set("passdb backend", "samba_dsdb:%s" % samdb.url) LA_sid = security.dom_sid(str(domain_sid) - +"-"+str(security.DOMAIN_RID_ADMINISTRATOR)) + + "-"+str(security.DOMAIN_RID_ADMINISTRATOR)) BA_sid = security.dom_sid(security.SID_BUILTIN_ADMINISTRATORS) s4_passdb = passdb.PDB(s3conf.get("passdb backend")) diff --git a/python/samba/netcmd/spn.py b/python/samba/netcmd/spn.py index b4125e18d90..86d73f451df 100644 --- a/python/samba/netcmd/spn.py +++ b/python/samba/netcmd/spn.py @@ -56,7 +56,7 @@ class cmd_spn_list(Command): res = sam.search( expression="samaccountname=%s" % ldb.binary_encode(cleaneduser), scope=ldb.SCOPE_SUBTREE, attrs=["servicePrincipalName"]) - if len(res) >0: + if len(res) > 0: spns = res[0].get("servicePrincipalName") found = False flag = ldb.FLAG_MOD_ADD @@ -107,7 +107,7 @@ class cmd_spn_add(Command): res = sam.search( expression="samaccountname=%s" % ldb.binary_encode(cleaneduser), scope=ldb.SCOPE_SUBTREE, attrs=["servicePrincipalName"]) - if len(res) >0: + if len(res) > 0: res[0].dn msg = ldb.Message() spns = res[0].get("servicePrincipalName") @@ -157,7 +157,7 @@ class cmd_spn_delete(Command): expression="servicePrincipalName=%s" % ldb.binary_encode(name), scope=ldb.SCOPE_SUBTREE, attrs=["servicePrincipalName", "samAccountName"]) - if len(res) >0: + if len(res) > 0: result = None if user is not None: (cleaneduser, realm, domain) = _get_user_realm_domain(user) @@ -176,7 +176,7 @@ class cmd_spn_delete(Command): "and no specific user was specified, list of users" " with this spn:%s" % (name, listUser)) else: - result=res[0] + result = res[0] msg = ldb.Message() diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index 868f23c63b1..c2af4923adb 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -1065,7 +1065,7 @@ class GetPasswordCommand(Command): domain, dns_domain): if i == 1: user = account_name - realm= domain + realm = domain elif i == 2: user = account_name.lower() realm = domain.lower() @@ -1950,7 +1950,7 @@ samba-tool user syncpasswords --terminate \\ del dirsync_obj[a] dirsync_obj["# %s::" % a] = ["REDACTED SECRET ATTRIBUTE"] dirsync_ldif = self.samdb.write_ldif(dirsync_obj, ldb.CHANGETYPE_NONE) - log_msg("# Dirsync[%d] %s %s\n%s" %(idx, guid, sid, dirsync_ldif)) + log_msg("# Dirsync[%d] %s %s\n%s" % (idx, guid, sid, dirsync_ldif)) obj = self.get_account_attributes(self.samdb, username="%s" % sid, basedn="<GUID=%s>" % guid, @@ -2401,19 +2401,19 @@ LDAP server using the 'nano' editor. line = line[2:] plus_lines.append(line) - user_ldif="dn: %s\n" % user_dn + user_ldif = "dn: %s\n" % user_dn user_ldif += "changetype: modify\n" for line in minus_lines: attr, val = line.split(':', 1) - search_attr="%s:" % attr + search_attr = "%s:" % attr if not re.search(r'^' + search_attr, str(plus_lines)): user_ldif += "delete: %s\n" % attr user_ldif += "%s: %s\n" % (attr, val) for line in plus_lines: attr, val = line.split(':', 1) - search_attr="%s:" % attr + search_attr = "%s:" % attr if re.search(r'^' + search_attr, str(minus_lines)): user_ldif += "replace: %s\n" % attr user_ldif += "%s: %s\n" % (attr, val) diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index 664c170fcae..4dc6a5a75d9 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -227,9 +227,9 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf, str(current[0]["defaultNamingContext"][0].decode('utf8')), paths.smbconf, basedn))) - names.domaindn=current[0]["defaultNamingContext"][0] - names.rootdn=current[0]["rootDomainNamingContext"][0] - names.ncs=current[0]["namingContexts"] + names.domaindn = current[0]["defaultNamingContext"][0] + names.rootdn = current[0]["rootDomainNamingContext"][0] + names.ncs = current[0]["namingContexts"] names.dnsforestdn = None names.dnsdomaindn = None @@ -1580,7 +1580,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid, SYSVOL_ACL = "O:LAG:BAD:P(A;OICI;0x001f01ff;;;BA)(A;OICI;0x001200a9;;;SO)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)" POLICIES_ACL = "O:LAG:BAD:P(A;OICI;0x001f01ff;;;BA)(A;OICI;0x001200a9;;;SO)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)(A;OICI;0x001301bf;;;PA)" -SYSVOL_SERVICE="sysvol" +SYSVOL_SERVICE = "sysvol" def set_dir_acl(path, acl, lp, domsid, use_ntvfs, passdb, service=SYSVOL_SERVICE): setntacl(lp, path, acl, domsid, use_ntvfs=use_ntvfs, skip_invalid_chown=True, passdb=passdb, service=service) diff --git a/python/samba/samba3/__init__.py b/python/samba/samba3/__init__.py index 053c113715d..950b3c28479 100644 --- a/python/samba/samba3/__init__.py +++ b/python/samba/samba3/__init__.py @@ -333,7 +333,7 @@ class WinsDatabase(object): ips = [] while "." in entries[i]: ips.append(entries[i]) - i+=1 + i += 1 nb_flags = int(entries[i][:-1], 16) assert not name in self.entries, "Name %s exists twice" % name self.entries[name] = (ttl, ips, nb_flags) diff --git a/python/samba/samdb.py b/python/samba/samdb.py index 0cf595345ac..ae758ac9d4d 100644 --- a/python/samba/samdb.py +++ b/python/samba/samdb.py @@ -867,7 +867,7 @@ schemaUpdateNow: 1 o.originating_usn = seq o.local_usn = seq - if not found and addifnotexist and len(ctr.array) >0: + if not found and addifnotexist and len(ctr.array) > 0: o2 = drsblobs.replPropertyMetaData1() o2.attid = 589914 att_oid = self.get_oid_from_attid(o2.attid) diff --git a/python/samba/schema.py b/python/samba/schema.py index 08c77c04e52..61561f199f6 100644 --- a/python/samba/schema.py +++ b/python/samba/schema.py @@ -214,7 +214,7 @@ def get_linked_attributes(schemadn, schemaldb): attribute="lDAPDisplayName", scope=SCOPE_SUBTREE) if target is not None: - attributes[str(res[i]["lDAPDisplayName"])]=str(target) + attributes[str(res[i]["lDAPDisplayName"])] = str(target) return attributes diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index a3caba6472c..60c18c73234 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -56,7 +56,7 @@ except ImportError: class SkipTest(Exception): """Test skipped.""" -HEXDUMP_FILTER=bytearray([x if ((len(repr(chr(x)))==3) and (x < 127)) else ord('.') for x in range(256)]) +HEXDUMP_FILTER = bytearray([x if ((len(repr(chr(x))) == 3) and (x < 127)) else ord('.') for x in range(256)]) class TestCase(unittest.TestCase): """A Samba test case.""" @@ -498,6 +498,6 @@ def create_test_ou(samdb, name): # objects can be slow to replicate out. So the OU created by a previous # testenv may still exist at the point that tests start on another testenv. rand = randint(1, 10000000) - dn = ldb.Dn(samdb, "OU=%s%d,%s" %(name, rand, samdb.get_default_basedn())) + dn = ldb.Dn(samdb, "OU=%s%d,%s" % (name, rand, samdb.get_default_basedn())) samdb.add({"dn": dn, "objectclass": "organizationalUnit"}) return dn diff --git a/python/samba/tests/credentials.py b/python/samba/tests/credentials.py index bddbc46b94e..7c89da54ee3 100644 --- a/python/samba/tests/credentials.py +++ b/python/samba/tests/credentials.py @@ -124,19 +124,19 @@ class CredentialsTests(samba.tests.TestCaseInTempDir): self.creds.get_secure_channel_type()) def test_get_nt_hash(self): - password="geheim" - hex_nthash="c2ae1fe6e648846352453e816f2aeb93" + password = "geheim" + hex_nthash = "c2ae1fe6e648846352453e816f2aeb93" self.creds.set_password(password) self.assertEqual(password, self.creds.get_password()) self.assertEqual(binascii.a2b_hex(hex_nthash), self.creds.get_nt_hash()) def test_get_ntlm_response(self): - password="SecREt01" - hex_challenge="0123456789abcdef" - hex_nthash="cd06ca7c7e10c99b1d33b7485a2ed808" - hex_session_key="3f373ea8e4af954f14faa506f8eebdc4" - hex_ntlm_response="25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6" + password = "SecREt01" + hex_challenge = "0123456789abcdef" + hex_nthash = "cd06ca7c7e10c99b1d33b7485a2ed808" + hex_session_key = "3f373ea8e4af954f14faa506f8eebdc4" + hex_ntlm_response = "25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6" self.creds.set_username("fred") self.creds.set_domain("nurk") self.creds.set_password(password) @@ -154,7 +154,7 @@ class CredentialsTests(samba.tests.TestCaseInTempDir): def test_get_nt_hash_string(self): self.creds.set_password_will_be_nt_hash(True) - hex_nthash="c2ae1fe6e648846352453e816f2aeb93" + hex_nthash = "c2ae1fe6e648846352453e816f2aeb93" self.creds.set_password(hex_nthash) self.assertEqual(None, self.creds.get_password()) self.assertEqual(binascii.a2b_hex(hex_nthash), @@ -198,10 +198,10 @@ class CredentialsTests(samba.tests.TestCaseInTempDir): self.assertEqual(creds.authentication_requested(), False) def test_parse_file_1(self): - realm="realm.example.com" - domain="dom" - password="pass" - username="user" + realm = "realm.example.com" + domain = "dom" + password = "pass" + username = "user" passwd_file_name = os.path.join(self.tempdir, "parse_file") passwd_file_fd = open(passwd_file_name, self.open_mode) @@ -221,10 +221,10 @@ class CredentialsTests(samba.tests.TestCaseInTempDir): os.unlink(passwd_file_name) def test_parse_file_2(self): - realm="realm.example.com" - domain="dom" - password="pass" - username="user" + realm = "realm.example.com" + domain = "dom" + password = "pass" + username = "user" passwd_file_name = os.path.join(self.tempdir, "parse_file") passwd_file_fd = open(passwd_file_name, self.open_mode) @@ -244,12 +244,12 @@ class CredentialsTests(samba.tests.TestCaseInTempDir): os.unlink(passwd_file_name) def test_parse_file_3(self): - realm="realm.example.com" - domain="domain" - password="password" - username="username" + realm = "realm.example.com" + domain = "domain" + password = "password" + username = "username" - userdom="userdom" + userdom = "userdom" passwd_file_name = os.path.join(self.tempdir, "parse_file") passwd_file_fd = open(passwd_file_name, self.open_mode) @@ -269,12 +269,12 @@ class CredentialsTests(samba.tests.TestCaseInTempDir): os.unlink(passwd_file_name) def test_parse_file_4(self): - realm="realm.example.com" - domain="domain" - password="password" - username="username" + realm = "realm.example.com" + domain = "domain" + password = "password" + username = "username" - userdom="userdom" + userdom = "userdom" passwd_file_name = os.path.join(self.tempdir, "parse_file") passwd_file_fd = open(passwd_file_name, self.open_mode) @@ -294,12 +294,12 @@ class CredentialsTests(samba.tests.TestCaseInTempDir): os.unlink(passwd_file_name) def test_parse_file_5(self): - realm="realm.example.com" - domain="domain" - password="password" - username="username" + realm = "realm.example.com" + domain = "domain" + password = "password" + username = "username" - userdom="userdom" + userdom = "userdom" passwd_file_name = os.path.join(self.tempdir, "parse_file") passwd_file_fd = open(passwd_file_name, self.open_mode) diff --git a/python/samba/tests/dcerpc/raw_testcase.py b/python/samba/tests/dcerpc/raw_testcase.py index 7726f9b3f7b..7c99f8d807d 100644 --- a/python/samba/tests/dcerpc/raw_testcase.py +++ b/python/samba/tests/dcerpc/raw_testcase.py @@ -338,7 +338,7 @@ class RawDCERPCTest(TestCase): auth_context_id=auth_context["auth_context_id"], auth_blob=zero_sig) else: - auth_info="" + auth_info = "" pfc_flags = samba.dcerpc.dcerpc.DCERPC_PFC_FLAG_FIRST pfc_flags |= samba.dcerpc.dcerpc.DCERPC_PFC_FLAG_LAST @@ -604,7 +604,7 @@ class RawDCERPCTest(TestCase): a.auth_type = auth_type a.auth_level = auth_level a.auth_pad_length = auth_pad_length - a.auth_context_id= auth_context_id + a.auth_context_id = auth_context_id a.credentials = auth_blob ai = ndr_pack(a) diff --git a/python/samba/tests/ntacls_backup.py b/python/samba/tests/ntacls_backup.py index 9ab264a27fd..bb1bc97ef43 100644 --- a/python/samba/tests/ntacls_backup.py +++ b/python/samba/tests/ntacls_backup.py @@ -39,7 +39,7 @@ class NtaclsBackupRestoreTests(TestCaseInTempDir): super(NtaclsBackupRestoreTests, self).setUp() self.server = os.environ["SERVER"] # addc - samdb_url='ldap://' + self.server + samdb_url = 'ldap://' + self.server self.service = 'test1' # service/share to test # root path for service diff --git a/python/samba/tests/samba3sam.py b/python/samba/tests/samba3sam.py index c8f4fb026a8..a5e39eebe59 100644 --- a/python/samba/tests/samba3sam.py +++ b/python/samba/tests/samba3sam.py @@ -329,7 +329,7 @@ class MapTestCase(MapBaseTestCase): # Add a set of split records self.ldb.add_ldif(""" -dn: """+ self.samba4.dn("cn=Domain Users") + """ +dn: """ + self.samba4.dn("cn=Domain Users") + """ objectClass: group cn: Domain Users objectSid: S-1-5-21-4231626423-2410014848-2360679739-513 @@ -337,7 +337,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-513 # Add a set of split records self.ldb.add_ldif(""" -dn: """+ self.samba4.dn("cn=X") + """ +dn: """ + self.samba4.dn("cn=X") + """ objectClass: user cn: X codePage: x diff --git a/python/samba/tests/samba_tool/base.py b/python/samba/tests/samba_tool/base.py index 06e19c19087..8e2e2457e12 100644 --- a/python/samba/tests/samba_tool/base.py +++ b/python/samba/tests/samba_tool/base.py @@ -122,14 +122,14 @@ class SambaToolCmdTest(samba.tests.BlackboxTestCase): def randomName(self, count=8): """Create a random name, cap letters and numbers, and always starting with a letter""" name = random.choice(string.ascii_uppercase) - name += ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase+ string.digits) for x in range(count - 1)) + name += ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(count - 1)) return name def randomPass(self, count=16): name = random.choice(string.ascii_uppercase) name += random.choice(string.digits) name += random.choice(string.ascii_lowercase) - name += ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase+ string.digits) for x in range(count - 3)) + name += ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(count - 3)) return name def randomXid(self): diff --git a/python/samba/tests/samba_tool/user_virtualCryptSHA.py b/python/samba/tests/samba_tool/user_virtualCryptSHA.py index a25bf5e6eb8..be3316bd3bf 100644 --- a/python/samba/tests/samba_tool/user_virtualCryptSHA.py +++ b/python/samba/tests/samba_tool/user_virtualCryptSHA.py @@ -478,7 +478,7 @@ class UserCmdCryptShaTestCase(SambaToolCmdTest): "virtualCryptSHA512;rounds=5129", True) self.assertFalse(sha256 == _get_attribute(out, "virtualCryptSHA256")) - self.assertFalse(sha512 ==_get_attribute(out, "virtualCryptSHA512")) + self.assertFalse(sha512 == _get_attribute(out, "virtualCryptSHA512")) # The returned hashes should specify the correct number of rounds self.assertTrue(sha256.startswith("{CRYPT}$5$rounds=2561")) diff --git a/python/samba/tests/source.py b/python/samba/tests/source.py index 378c6a2e9fd..5a62dbf8a33 100644 --- a/python/samba/tests/source.py +++ b/python/samba/tests/source.py @@ -196,7 +196,7 @@ class TestSource(TestCase): def test_shebang_lines(self): """Check that files with shebang lines and only those are executable.""" files_with_shebang = {} - files_without_shebang= {} + files_without_shebang = {} for fname, line_no, line in self._iter_source_files_lines(): if line_no >= 1: continue diff --git a/python/samba/upgradehelpers.py b/python/samba/upgradehelpers.py index 90c65377d40..1dda2915be1 100644 --- a/python/samba/upgradehelpers.py +++ b/python/samba/upgradehelpers.py @@ -177,7 +177,7 @@ def usn_in_range(usn, range): cont = False continue if usn < int(range[idx]): - if idx %2 == 1: + if idx % 2 == 1: ok = True cont = False if usn == int(range[idx]): @@ -290,7 +290,7 @@ def dn_sort(x, y): return ret else: if i == minimum-1: - assert len1!=len2,"PB PB PB" + " ".join(tab1)+" / " + " ".join(tab2) + assert len1 != len2,"PB PB PB" + " ".join(tab1)+" / " + " ".join(tab2) if len1 > len2: return 1 else: @@ -725,7 +725,7 @@ def findprovisionrange(samdb, basedn): for o in obj.array: # like a timestamp but with the resolution of 1 minute - minutestamp =_glue.nttime2unix(o.originating_change_time) // 60 + minutestamp = _glue.nttime2unix(o.originating_change_time) // 60 hash_ts = hash_id.get(str(o.originating_invocation_id)) if hash_ts is None: diff --git a/script/autobuild.py b/script/autobuild.py index dc5af0f0dca..0847df2643f 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -597,7 +597,7 @@ def cleanup(): def find_git_root(): '''get to the top of the git repo''' - p=os.getcwd() + p = os.getcwd() while p != '/': if os.path.isdir(os.path.join(p, ".git")): return p diff --git a/script/bisect-test.py b/script/bisect-test.py index e6ac8126abb..71c68b0d727 100755 --- a/script/bisect-test.py +++ b/script/bisect-test.py @@ -43,7 +43,7 @@ def run_cmd(cmd, dir=".", show=True, output=False, checkfail=True): def find_git_root(): '''get to the top of the git repo''' - p=os.getcwd() + p = os.getcwd() while p != '/': if os.path.isdir(os.path.join(p, ".git")): return p diff --git a/script/generate_param.py b/script/generate_param.py index 3ef40038774..908bd885cf3 100644 --- a/script/generate_param.py +++ b/script/generate_param.py @@ -142,7 +142,7 @@ def generate_functions(path_in, path_out): if temp is None: raise Exception(parameter['name'] + " has an invalid param type " + parameter['type']) output_string += temp - f.write(output_string + "(" + parameter['function'] +", " + parameter['function'] + ')\n') + f.write(output_string + "(" + parameter['function'] + ", " + parameter['function'] + ')\n') finally: f.close() diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py index ab2342c9530..25135940c39 100644 --- a/selftest/subunithelper.py +++ b/selftest/subunithelper.py @@ -93,7 +93,7 @@ def parse_results(msg_ops, statistics, fh): remote_error = subunit.RemoteError(reason.decode("utf-8")) if not terminated: - statistics['TESTS_ERROR']+=1 + statistics['TESTS_ERROR'] += 1 msg_ops.addError(subunit.RemotedTestCase(testname), subunit.RemoteError(u"reason (%s) interrupted" % result)) return 1 else: @@ -103,46 +103,46 @@ def parse_results(msg_ops, statistics, fh): try: test = open_tests.pop(testname) except KeyError: - statistics['TESTS_ERROR']+=1 + statistics['TESTS_ERROR'] += 1 exitcode = 1 msg_ops.addError(subunit.RemotedTestCase(testname), subunit.RemoteError(u"Test was never started")) else: - statistics['TESTS_EXPECTED_OK']+=1 + statistics['TESTS_EXPECTED_OK'] += 1 msg_ops.addSuccess(test) elif result in ("xfail", "knownfail"): try: test = open_tests.pop(testname) except KeyError: - statistics['TESTS_ERROR']+=1 + statistics['TESTS_ERROR'] += 1 exitcode = 1 msg_ops.addError(subunit.RemotedTestCase(testname), subunit.RemoteError(u"Test was never started")) else: - statistics['TESTS_EXPECTED_FAIL']+=1 + statistics['TESTS_EXPECTED_FAIL'] += 1 msg_ops.addExpectedFailure(test, remote_error) elif result in ("uxsuccess", ): try: test = open_tests.pop(testname) except KeyError: - statistics['TESTS_ERROR']+=1 + statistics['TESTS_ERROR'] += 1 exitcode = 1 msg_ops.addError(subunit.RemotedTestCase(testname), subunit.RemoteError(u"Test was never started")) else: - statistics['TESTS_UNEXPECTED_OK']+=1 + statistics['TESTS_UNEXPECTED_OK'] += 1 msg_ops.addUnexpectedSuccess(test) exitcode = 1 elif result in ("failure", "fail"): try: test = open_tests.pop(testname) except KeyError: - statistics['TESTS_ERROR']+=1 + statistics['TESTS_ERROR'] += 1 exitcode = 1 msg_ops.addError(subunit.RemotedTestCase(testname), subunit.RemoteError(u"Test was never started")) else: - statistics['TESTS_UNEXPECTED_FAIL']+=1 + statistics['TESTS_UNEXPECTED_FAIL'] += 1 exitcode = 1 msg_ops.addFailure(test, remote_error) elif result == "skip": - statistics['TESTS_SKIP']+=1 + statistics['TESTS_SKIP'] += 1 # Allow tests to be skipped without prior announcement of test try: test = open_tests.pop(testname) @@ -150,7 +150,7 @@ def parse_results(msg_ops, statistics, fh): test = subunit.RemotedTestCase(testname) msg_ops.addSkip(test, reason) elif result == "error": - statistics['TESTS_ERROR']+=1 + statistics['TESTS_ERROR'] += 1 exitcode = 1 try: test = open_tests.pop(testname) @@ -193,7 +193,7 @@ def parse_results(msg_ops, statistics, fh): while open_tests: test = subunit.RemotedTestCase(open_tests.popitem()[1]) msg_ops.addError(test, subunit.RemoteError(u"was started but never finished!")) - statistics['TESTS_ERROR']+=1 + statistics['TESTS_ERROR'] += 1 exitcode = 1 return exitcode @@ -292,7 +292,7 @@ class FilterOps(unittest.TestResult): if self.output is None: sys.stdout.write(msg) else: - self.output+=msg + self.output += msg def startTest(self, test): self.seen_output = True @@ -307,8 +307,8 @@ class FilterOps(unittest.TestResult): def addError(self, test, err=None): test = self._add_prefix(test) - self.error_added+=1 - self.total_error+=1 + self.error_added += 1 + self.total_error += 1 self._ops.addError(test, err) self.output = None if self.fail_immediately: @@ -327,8 +327,8 @@ class FilterOps(unittest.TestResult): def addUnexpectedSuccess(self, test): test = self._add_prefix(test) - self.uxsuccess_added+=1 - self.total_uxsuccess+=1 + self.uxsuccess_added += 1 + self.total_uxsuccess += 1 self._ops.addUnexpectedSuccess(test) if self.output: self._ops.output_msg(self.output) @@ -342,12 +342,12 @@ class FilterOps(unittest.TestResult): if xfail_reason is None: xfail_reason = find_in_list(self.flapping, test.id()) if xfail_reason is not None: - self.xfail_added+=1 - self.total_xfail+=1 + self.xfail_added += 1 + self.total_xfail += 1 self._ops.addExpectedFailure(test, err) else: - self.fail_added+=1 - self.total_fail+=1 + self.fail_added += 1 + self.total_fail += 1 self._ops.addFailure(test, err) if self.output: self._ops.output_msg(self.output) @@ -604,7 +604,7 @@ class PlainFormatter(TestsuiteEnabledTestResult): print("no output for name[%s]" % name) if result in ("success", "xfail"): - self.suites_ok+=1 + self.suites_ok += 1 else: self.output_msg("ERROR: Testsuite[%s]\n" % name) if reason is not None: @@ -718,4 +718,4 @@ class PlainFormatter(TestsuiteEnabledTestResult): def skip_testsuite(self, name, reason="UNKNOWN"): self.skips.setdefault(reason, []).append(name) if self.totalsuites: - self.totalsuites-=1 + self.totalsuites -= 1 diff --git a/selftest/tests.py b/selftest/tests.py index 1fe842aff05..a883a390bf4 100644 --- a/selftest/tests.py +++ b/selftest/tests.py @@ -39,7 +39,7 @@ finally: have_man_pages_support = ("XSLTPROC_MANPAGES" in config_hash) with_pam = ("WITH_PAM" in config_hash) -pam_wrapper_so_path=config_hash["LIBPAM_WRAPPER_SO_PATH"] +pam_wrapper_so_path = config_hash["LIBPAM_WRAPPER_SO_PATH"] planpythontestsuite("none", "samba.tests.source", py3_compatible=True) if have_man_pages_support: diff --git a/source3/build/charset.py b/source3/build/charset.py index 75981379577..1a23405448f 100644 --- a/source3/build/charset.py +++ b/source3/build/charset.py @@ -7,19 +7,19 @@ def CHECK_SAMBA3_CHARSET(conf, crossbuild=False): '''Check for default charsets for Samba3 ''' if conf.CHECK_ICONV(define='HAVE_NATIVE_ICONV'): - default_dos_charset=False - default_unix_charset=False + default_dos_charset = False + default_unix_charset = False # check for default dos charset name for charset in ['CP850', 'IBM850']: if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'): - default_dos_charset=charset + default_dos_charset = charset break # check for default unix charset name for charset in ['UTF-8', 'UTF8']: if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'): - default_unix_charset=charset + default_unix_charset = charset break # At this point, we have a libiconv candidate. We know that @@ -29,8 +29,8 @@ def CHECK_SAMBA3_CHARSET(conf, crossbuild=False): # deal, since we can't guarantee that the results we get now will # match the results we get at runtime anyway. if crossbuild: - default_dos_charset="CP850" - default_unix_charset="UTF-8" + default_dos_charset = "CP850" + default_unix_charset = "UTF-8" # TODO: this used to warn about the set charset on cross builds if default_dos_charset is False or default_unix_charset is False: diff --git a/source3/script/tests/test_wbinfo_sids2xids_int.py b/source3/script/tests/test_wbinfo_sids2xids_int.py index a460d8abce6..8e2be886c97 100755 --- a/source3/script/tests/test_wbinfo_sids2xids_int.py +++ b/source3/script/tests/test_wbinfo_sids2xids_int.py @@ -35,15 +35,15 @@ domsid = domsid.split(' ')[0] #print domain #print domsid -sids=[domsid + '-512', 'S-1-5-32-545', domsid + '-513', 'S-1-1-0', 'S-1-3-1', 'S-1-5-1'] +sids = [domsid + '-512', 'S-1-5-32-545', domsid + '-513', 'S-1-1-0', 'S-1-3-1', 'S-1-5-1'] flush_cache(sids=sids) sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' + ','.join(sids)], stdout=subprocess.PIPE).communicate()[0].strip() -gids=[] -uids=[] +gids = [] +uids = [] idtypes = [] for line in sids2xids.split('\n'): diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 393b0d9f60a..889d49dd405 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -209,13 +209,13 @@ for options in ["--option=clientntlmv2auth=no", "--option=clientusespnego=no --o plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) %s" % (env, options), env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, options]) plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) %s member creds" % (env, options), env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$SERVER/$USERNAME', '$PASSWORD', smbclient3, configuration, options]) -env="ad_dc" +env = "ad_dc" plantestsuite("samba3.blackbox.smbspool", env, [os.path.join(samba3srcdir, "script/tests/test_smbspool.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', env]) for env in ["ad_member:local", "nt4_dc:local"]: plantestsuite("samba3.blackbox.smbpasswd", env, [os.path.join(samba3srcdir, "script/tests/test_smbpasswd.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD']) -env="nt4_dc" +env = "nt4_dc" plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) ipv6" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IPV6', '$SERVER/$USERNAME', '$PASSWORD', smbclient3, configuration]) for env in ["nt4_member", "ad_member"]: @@ -432,7 +432,7 @@ libsmbclient = ["libsmbclient"] vfs = ["vfs.fruit", "vfs.acl_xattr", "vfs.fruit_netatalk", "vfs.fruit_file_id", "vfs.fruit_timemachine"] -tests= base + raw + smb2 + rpc + unix + local + rap + nbt + libsmbclient + idmap + vfs +tests = base + raw + smb2 + rpc + unix + local + rap + nbt + libsmbclient + idmap + vfs for t in tests: if t == "base.delaywrite" or t == "base.deny1" or t == "base.deny2": diff --git a/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py b/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py index 27b3ad59d5b..24dcb1c321a 100755 --- a/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py +++ b/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py @@ -81,7 +81,7 @@ def possible_inferiors_search(db, oc): expression=("ldapDisplayName=%s" % oc), attrs=["possibleInferiors"]) - poss=[] + poss = [] if len(res) == 0 or res[0].get("possibleInferiors") is None: return poss for item in res[0]["possibleInferiors"]: @@ -240,7 +240,7 @@ def test_class(db, classinfo, oc): def get_object_classes(db): """return a list of all object classes""" - list=[] + list = [] for item in classinfo: list.append(item) return list diff --git a/source4/dsdb/tests/python/acl.py b/source4/dsdb/tests/python/acl.py index f2f87bc765e..4e479ce8b17 100755 --- a/source4/dsdb/tests/python/acl.py +++ b/source4/dsdb/tests/python/acl.py @@ -1774,7 +1774,7 @@ class AclUndeleteTests(AclTests): self.testuser5 = "to_be_undeleted5" self.testuser6 = "to_be_undeleted6" - self.new_dn_ou = "CN="+ self.testuser4 + "," + self.ou1 + self.base_dn + self.new_dn_ou = "CN=" + self.testuser4 + "," + self.ou1 + self.base_dn # Create regular user self.testuser1_dn = self.get_user_dn(self.testuser1) diff --git a/source4/dsdb/tests/python/deletetest.py b/source4/dsdb/tests/python/deletetest.py index 4cf3da7c430..9edeb2f782f 100755 --- a/source4/dsdb/tests/python/deletetest.py +++ b/source4/dsdb/tests/python/deletetest.py @@ -104,11 +104,11 @@ class BasicDeleteTests(BaseDeleteTests): def check_rdn(self, liveObj, delObj, rdnName): print("Checking for correct rDN") - rdn=liveObj[rdnName][0] - rdn2=delObj[rdnName][0] - name2=delObj["name"][0] - dn_rdn=delObj.dn.get_rdn_value() - guid=liveObj["objectGUID"][0] + rdn = liveObj[rdnName][0] + rdn2 = delObj[rdnName][0] + name2 = delObj["name"][0] + dn_rdn = delObj.dn.get_rdn_value() + guid = liveObj["objectGUID"][0] self.assertEquals(rdn2, rdn + "\nDEL:" + self.GUID_string(guid)) self.assertEquals(name2, rdn + "\nDEL:" + self.GUID_string(guid)) self.assertEquals(name2, dn_rdn) @@ -336,25 +336,25 @@ class BasicTreeDeleteTests(BasicDeleteTests): "objectClass": "server"}) self.objLive1 = self.search_dn(self.usr1) - self.guid1=self.objLive1["objectGUID"][0] + self.guid1 = self.objLive1["objectGUID"][0] self.objLive2 = self.search_dn(self.usr2) - self.guid2=self.objLive2["objectGUID"][0] + self.guid2 = self.objLive2["objectGUID"][0] self.objLive3 = self.search_dn(self.grp1) - self.guid3=self.objLive3["objectGUID"][0] + self.guid3 = self.objLive3["objectGUID"][0] self.objLive4 = self.search_dn(self.sit1) - self.guid4=self.objLive4["objectGUID"][0] + self.guid4 = self.objLive4["objectGUID"][0] self.objLive5 = self.search_dn(self.ss1) - self.guid5=self.objLive5["objectGUID"][0] + self.guid5 = self.objLive5["objectGUID"][0] self.objLive6 = self.search_dn(self.srv1) - self.guid6=self.objLive6["objectGUID"][0] + self.guid6 = self.objLive6["objectGUID"][0] self.objLive7 = self.search_dn(self.srv2) - self.guid7=self.objLive7["objectGUID"][0] + self.guid7 = self.objLive7["objectGUID"][0] self.deleted_objects_config_dn \ = self.ldb.get_wellknown_dn(self.ldb.get_config_basedn(), diff --git a/source4/dsdb/tests/python/dirsync.py b/source4/dsdb/tests/python/dirsync.py index ae36a5157c7..54ede529d96 100755 --- a/source4/dsdb/tests/python/dirsync.py +++ b/source4/dsdb/tests/python/dirsync.py @@ -295,7 +295,7 @@ class SimpleDirsyncTests(DirsyncBaseTests): attrs=["parentGUID"], controls=["dirsync:1:0:1"]) self.assertEqual(len(res.msgs), 0) - ouname="OU=testou,%s" % self.base_dn + ouname = "OU=testou,%s" % self.base_dn self.ouname = ouname self.ldb_admin.create_ou(ouname) delta = Message() @@ -399,7 +399,7 @@ class SimpleDirsyncTests(DirsyncBaseTests): control2 = str(":".join(ctl)) # Let's create an OU - ouname="OU=testou2,%s" % self.base_dn + ouname = "OU=testou2,%s" % self.base_dn self.ouname = ouname self.ldb_admin.create_ou(ouname) res = self.ldb_admin.search(self.base_dn, @@ -545,7 +545,7 @@ class SimpleDirsyncTests(DirsyncBaseTests): def test_dirsync_deleted_items(self): """Check that dirsync returnd deleted objects too""" # Let's create an OU - ouname="OU=testou3,%s" % self.base_dn + ouname = "OU=testou3,%s" % self.base_dn self.ouname = ouname self.ldb_admin.create_ou(ouname) res = self.ldb_admin.search(self.base_dn, @@ -582,7 +582,7 @@ class SimpleDirsyncTests(DirsyncBaseTests): ctl = str(res.controls[0]).split(":") cookie = ndr_unpack(drsblobs.ldapControlDirSyncCookie, base64.b64decode(str(ctl[4]))) cookie.blob.guid1 = misc.GUID("128a99bf-abcd-1234-abcd-1fb625e530db") - controls=["dirsync:1:0:0:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] + controls = ["dirsync:1:0:0:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] res = self.ldb_admin.search(self.base_dn, expression="(&(objectClass=organizationalUnit)(!(isDeleted=*)))", controls=controls) @@ -662,7 +662,7 @@ class ExtendedDirsyncTests(SimpleDirsyncTests): """Check that dirsync returnd deleted objects too""" # Let's create an OU self.ldb_simple = self.get_ldb_connection(self.simple_user, self.user_pass) - ouname="OU=testou3,%s" % self.base_dn + ouname = "OU=testou3,%s" % self.base_dn self.ouname = ouname self.ldb_admin.create_ou(ouname) diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index e50eb5c03b1..62f00547019 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -2788,19 +2788,19 @@ gidNumber: 10126 homeDirectory: /home/posixuser loginShell: /bin/bash gecos: Posix User;;; -description: A POSIX user"""% (self.base_dn)) +description: A POSIX user""" % (self.base_dn)) # Testing removing the posixAccount objectClass from an existing user" self.ldb.modify_ldif("""dn: cn=posixuser,CN=Users,%s changetype: modify delete: objectClass -objectClass: posixAccount"""% (self.base_dn)) +objectClass: posixAccount""" % (self.base_dn)) # Testing adding the posixAccount objectClass to an existing user" self.ldb.modify_ldif("""dn: cn=posixuser,CN=Users,%s changetype: modify add: objectClass -objectClass: posixAccount"""% (self.base_dn)) +objectClass: posixAccount""" % (self.base_dn)) delete_force(self.ldb, "cn=posixuser,cn=users," + self.base_dn) delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn) diff --git a/source4/dsdb/tests/python/ldap_schema.py b/source4/dsdb/tests/python/ldap_schema.py index f60f36d3e00..bd889325ad3 100755 --- a/source4/dsdb/tests/python/ldap_schema.py +++ b/source4/dsdb/tests/python/ldap_schema.py @@ -210,15 +210,15 @@ schemaUpdateNow: 1 object_name = "obj" + time.strftime("%s", time.gmtime()) ldif = """ -dn: CN=%s,CN=Users,%s"""% (object_name, self.base_dn) + """ +dn: CN=%s,CN=Users,%s""" % (object_name, self.base_dn) + """ objectClass: organizationalPerson objectClass: person objectClass: """ + class_ldap_display_name + """ objectClass: top cn: """ + object_name + """ instanceType: 4 -objectCategory: CN=%s,%s"""% (class_name, self.schema_dn) + """ -distinguishedName: CN=%s,CN=Users,%s"""% (object_name, self.base_dn) + """ +objectCategory: CN=%s,%s""" % (class_name, self.schema_dn) + """ +distinguishedName: CN=%s,CN=Users,%s""" % (object_name, self.base_dn) + """ name: """ + object_name + """ """ + attr_ldap_display_name + """: test """ diff --git a/source4/dsdb/tests/python/ldap_syntaxes.py b/source4/dsdb/tests/python/ldap_syntaxes.py index 2877f1cfd25..ab6bc7c9b60 100755 --- a/source4/dsdb/tests/python/ldap_syntaxes.py +++ b/source4/dsdb/tests/python/ldap_syntaxes.py @@ -177,15 +177,15 @@ systemOnly: FALSE def _get_object_ldif(self, object_name, class_name, class_ldap_display_name, attr_name, attr_value): # add object with correct syntax ldif = """ -dn: CN=%s,CN=Users,%s"""% (object_name, self.base_dn) + """ +dn: CN=%s,CN=Users,%s""" % (object_name, self.base_dn) + """ objectClass: organizationalPerson objectClass: person objectClass: """ + class_ldap_display_name + """ objectClass: top cn: """ + object_name + """ instanceType: 4 -objectCategory: CN=%s,%s"""% (class_name, self.schema_dn) + """ -distinguishedName: CN=%s,CN=Users,%s"""% (object_name, self.base_dn) + """ +objectCategory: CN=%s,%s""" % (class_name, self.schema_dn) + """ +distinguishedName: CN=%s,CN=Users,%s""" % (object_name, self.base_dn) + """ name: """ + object_name + """ """ + attr_name + attr_value + """ """ diff --git a/source4/dsdb/tests/python/rodc_rwdc.py b/source4/dsdb/tests/python/rodc_rwdc.py index 4b6c68486ad..5840dd6d6d9 100644 --- a/source4/dsdb/tests/python/rodc_rwdc.py +++ b/source4/dsdb/tests/python/rodc_rwdc.py @@ -350,7 +350,7 @@ class RodcRwdcCachedTests(password_lockout_base.BasePasswordTestCase): badPasswordTime = 0 logonCount = 0 lastLogon = 0 - lastLogonTimestamp=0 + lastLogonTimestamp = 0 logoncount_relation = '' lastlogon_relation = '' @@ -412,7 +412,7 @@ class RodcRwdcCachedTests(password_lockout_base.BasePasswordTestCase): badPasswordTime = 0 logonCount = 0 lastLogon = 0 - lastLogonTimestamp=0 + lastLogonTimestamp = 0 logoncount_relation = '' lastlogon_relation = '' diff --git a/source4/dsdb/tests/python/sec_descriptor.py b/source4/dsdb/tests/python/sec_descriptor.py index 926c422a7e7..b35529bd9b5 100755 --- a/source4/dsdb/tests/python/sec_descriptor.py +++ b/source4/dsdb/tests/python/sec_descriptor.py @@ -1368,7 +1368,7 @@ class DaclDescriptorTests(DescriptorTests): desc_sddl = self.sd_utils.get_sd_as_sddl(group_dn) mod = mod.replace(";OI;", ";OIIOID;") # change it how it's gonna look like self.assertTrue(mod in desc_sddl) - self.sd_utils.modify_sd_on_dn(group_dn, "D:" +moded) + self.sd_utils.modify_sd_on_dn(group_dn, "D:" + moded) desc_sddl = self.sd_utils.get_sd_as_sddl(group_dn) self.assertTrue(moded in desc_sddl) self.assertTrue(mod in desc_sddl) @@ -2076,7 +2076,7 @@ class SdAutoInheritTests(DescriptorTests): See that only the owner has been changed. """ attrs = ["nTSecurityDescriptor", "replPropertyMetaData", "uSNChanged"] - controls=["sd_flags:1:%d" % (SECINFO_DACL)] + controls = ["sd_flags:1:%d" % (SECINFO_DACL)] ace = "(A;CI;CC;;;NU)" sub_ace = "(A;CIID;CC;;;NU)" sd_sddl = "O:BAG:BAD:P(A;CI;0x000f01ff;;;AU)" diff --git a/source4/dsdb/tests/python/token_group.py b/source4/dsdb/tests/python/token_group.py index f0ef51a5c0b..47ed46d7578 100755 --- a/source4/dsdb/tests/python/token_group.py +++ b/source4/dsdb/tests/python/token_group.py @@ -566,7 +566,7 @@ class DynamicTokenTest(samba.tests.TestCase): rids = samr_conn.GetGroupsForUser(user_handle) samr_dns = set() for rid in rids.rids: - self.assertEqual(rid.attributes, samr.SE_GROUP_MANDATORY | samr.SE_GROUP_ENABLED_BY_DEFAULT| samr.SE_GROUP_ENABLED) + self.assertEqual(rid.attributes, samr.SE_GROUP_MANDATORY | samr.SE_GROUP_ENABLED_BY_DEFAULT | samr.SE_GROUP_ENABLED) sid = "%s-%d" % (domain_sid, rid.rid) res = self.admin_ldb.search(base="<SID=%s>" % sid, scope=ldb.SCOPE_BASE, attrs=[]) diff --git a/source4/dsdb/tests/python/urgent_replication.py b/source4/dsdb/tests/python/urgent_replication.py index 893c35eca22..5d41b1aa23c 100755 --- a/source4/dsdb/tests/python/urgent_replication.py +++ b/source4/dsdb/tests/python/urgent_replication.py @@ -117,7 +117,7 @@ systemFlags: 33554432""", ["relax:0"]) def test_crossRef_object(self): """Test if the urgent replication is activated when handling a crossRef object.""" self.ldb.add({ - "dn": "CN=test crossRef,CN=Partitions,CN=Configuration,"+ self.base_dn, + "dn": "CN=test crossRef,CN=Partitions,CN=Configuration," + self.base_dn, "objectClass": "crossRef", "cn": "test crossRef", "dnsRoot": self.get_loadparm().get("realm").lower(), diff --git a/source4/dsdb/tests/python/user_account_control.py b/source4/dsdb/tests/python/user_account_control.py index 38353508e87..242462ad57f 100755 --- a/source4/dsdb/tests/python/user_account_control.py +++ b/source4/dsdb/tests/python/user_account_control.py @@ -196,7 +196,7 @@ class UserAccountControlTests(samba.tests.TestCase): self.sd_utils.dacl_add_ace("OU=test_computer_ou1," + self.base_dn, mod) - computername=self.computernames[0] + computername = self.computernames[0] sd = ldb.MessageElement((ndr_pack(self.sd_reference_modify)), ldb.FLAG_MOD_ADD, "nTSecurityDescriptor") @@ -216,7 +216,7 @@ class UserAccountControlTests(samba.tests.TestCase): m = ldb.Message() m.dn = res[0].dn - m["description"]= ldb.MessageElement( + m["description"] = ldb.MessageElement( ("A description"), ldb.FLAG_MOD_REPLACE, "description") self.samdb.modify(m) @@ -280,7 +280,7 @@ class UserAccountControlTests(samba.tests.TestCase): self.sd_utils.dacl_add_ace("OU=test_computer_ou1," + self.base_dn, mod) - computername=self.computernames[0] + computername = self.computernames[0] self.add_computer_ldap(computername) res = self.admin_samdb.search("%s" % self.base_dn, @@ -290,7 +290,7 @@ class UserAccountControlTests(samba.tests.TestCase): m = ldb.Message() m.dn = res[0].dn - m["description"]= ldb.MessageElement( + m["description"] = ldb.MessageElement( ("A description"), ldb.FLAG_MOD_REPLACE, "description") self.samdb.modify(m) @@ -336,7 +336,7 @@ class UserAccountControlTests(samba.tests.TestCase): def test_admin_mod_uac(self): - computername=self.computernames[0] + computername = self.computernames[0] self.add_computer_ldap(computername, samdb=self.admin_samdb) res = self.admin_samdb.search("%s" % self.base_dn, @@ -380,7 +380,7 @@ class UserAccountControlTests(samba.tests.TestCase): scope=SCOPE_SUBTREE, attrs=["userAccountControl"]) - self.assertEqual(int(res[0]["userAccountControl"][0]), UF_NORMAL_ACCOUNT| UF_ACCOUNTDISABLE) + self.assertEqual(int(res[0]["userAccountControl"][0]), UF_NORMAL_ACCOUNT | UF_ACCOUNTDISABLE) def test_uac_bits_set(self): @@ -391,7 +391,7 @@ class UserAccountControlTests(samba.tests.TestCase): self.sd_utils.dacl_add_ace("OU=test_computer_ou1," + self.base_dn, mod) - computername=self.computernames[0] + computername = self.computernames[0] self.add_computer_ldap(computername) res = self.admin_samdb.search("%s" % self.base_dn, @@ -401,7 +401,7 @@ class UserAccountControlTests(samba.tests.TestCase): m = ldb.Message() m.dn = res[0].dn - m["description"]= ldb.MessageElement( + m["description"] = ldb.MessageElement( ("A description"), ldb.FLAG_MOD_REPLACE, "description") self.samdb.modify(m) @@ -446,7 +446,7 @@ class UserAccountControlTests(samba.tests.TestCase): self.sd_utils.dacl_add_ace("OU=test_computer_ou1," + self.base_dn, mod) - computername=self.computernames[0] + computername = self.computernames[0] self.add_computer_ldap(computername, others={"userAccountControl": [str(account_type)]}) res = self.admin_samdb.search("%s" % self.base_dn, @@ -457,7 +457,7 @@ class UserAccountControlTests(samba.tests.TestCase): m = ldb.Message() m.dn = res[0].dn - m["description"]= ldb.MessageElement( + m["description"] = ldb.MessageElement( ("A description"), ldb.FLAG_MOD_REPLACE, "description") self.samdb.modify(m) @@ -606,7 +606,7 @@ class UserAccountControlTests(samba.tests.TestCase): self.uac_bits_unrelated_modify_helper(UF_WORKSTATION_TRUST_ACCOUNT) def test_uac_bits_add(self): - computername=self.computernames[0] + computername = self.computernames[0] user_sid = self.sd_utils.get_object_sid(self.unpriv_user_dn) mod = "(OA;;CC;bf967a86-0de6-11d0-a285-00aa003049e2;;%s)" % str(user_sid) @@ -644,7 +644,7 @@ class UserAccountControlTests(samba.tests.TestCase): self.fail("Unable to set userAccountControl bit 0x%08X on %s: %s" % (bit, computername, estr)) def test_primarygroupID_cc_add(self): - computername=self.computernames[0] + computername = self.computernames[0] user_sid = self.sd_utils.get_object_sid(self.unpriv_user_dn) mod = "(OA;;CC;bf967a86-0de6-11d0-a285-00aa003049e2;;%s)" % str(user_sid) @@ -662,7 +662,7 @@ class UserAccountControlTests(samba.tests.TestCase): def test_primarygroupID_priv_DC_modify(self): - computername=self.computernames[0] + computername = self.computernames[0] self.add_computer_ldap(computername, others={"userAccountControl": [str(UF_SERVER_TRUST_ACCOUNT)]}, @@ -676,14 +676,14 @@ class UserAccountControlTests(samba.tests.TestCase): m = ldb.Message() m.dn = ldb.Dn(self.admin_samdb, "<SID=%s-%d>" % (str(self.domain_sid), security.DOMAIN_RID_USERS)) - m["member"]= ldb.MessageElement( + m["member"] = ldb.MessageElement( [str(res[0].dn)], ldb.FLAG_MOD_ADD, "member") self.admin_samdb.modify(m) m = ldb.Message() m.dn = res[0].dn - m["primaryGroupID"]= ldb.MessageElement( + m["primaryGroupID"] = ldb.MessageElement( [str(security.DOMAIN_RID_USERS)], ldb.FLAG_MOD_REPLACE, "primaryGroupID") try: @@ -696,7 +696,7 @@ class UserAccountControlTests(samba.tests.TestCase): self.assertEqual(enum, ldb.ERR_UNWILLING_TO_PERFORM) def test_primarygroupID_priv_member_modify(self): - computername=self.computernames[0] + computername = self.computernames[0] self.add_computer_ldap(computername, others={"userAccountControl": [str(UF_WORKSTATION_TRUST_ACCOUNT|UF_PARTIAL_SECRETS_ACCOUNT)]}, @@ -710,14 +710,14 @@ class UserAccountControlTests(samba.tests.TestCase): m = ldb.Message() m.dn = ldb.Dn(self.admin_samdb, "<SID=%s-%d>" % (str(self.domain_sid), security.DOMAIN_RID_USERS)) - m["member"]= ldb.MessageElement( + m["member"] = ldb.MessageElement( [str(res[0].dn)], ldb.FLAG_MOD_ADD, "member") self.admin_samdb.modify(m) m = ldb.Message() m.dn = res[0].dn - m["primaryGroupID"]= ldb.MessageElement( + m["primaryGroupID"] = ldb.MessageElement( [str(security.DOMAIN_RID_USERS)], ldb.FLAG_MOD_REPLACE, "primaryGroupID") try: @@ -731,7 +731,7 @@ class UserAccountControlTests(samba.tests.TestCase): def test_primarygroupID_priv_user_modify(self): - computername=self.computernames[0] + computername = self.computernames[0] self.add_computer_ldap(computername, others={"userAccountControl": [str(UF_WORKSTATION_TRUST_ACCOUNT)]}, @@ -745,14 +745,14 @@ class UserAccountControlTests(samba.tests.TestCase): m = ldb.Message() m.dn = ldb.Dn(self.admin_samdb, "<SID=%s-%d>" % (str(self.domain_sid), security.DOMAIN_RID_ADMINS)) - m["member"]= ldb.MessageElement( + m["member"] = ldb.MessageElement( [str(res[0].dn)], ldb.FLAG_MOD_ADD, "member") self.admin_samdb.modify(m) m = ldb.Message() m.dn = res[0].dn - m["primaryGroupID"]= ldb.MessageElement( + m["primaryGroupID"] = ldb.MessageElement( [str(security.DOMAIN_RID_ADMINS)], ldb.FLAG_MOD_REPLACE, "primaryGroupID") self.admin_samdb.modify(m) diff --git a/source4/scripting/devel/demodirsync.py b/source4/scripting/devel/demodirsync.py index 01c31729068..83263ea9f03 100755 --- a/source4/scripting/devel/demodirsync.py +++ b/source4/scripting/devel/demodirsync.py @@ -37,11 +37,11 @@ def printdirsync(ctl): print("highest usn %s" % cookie.blob.highwatermark.highest_usn) print("tmp higest usn %s" % cookie.blob.highwatermark.tmp_highest_usn) print("reserved usn %s" % cookie.blob.highwatermark.reserved_usn) - if cookie.blob.extra_length >0: + if cookie.blob.extra_length > 0: print("highest usn in extra %s" % cookie.blob.extra.ctr.cursors[0].highest_usn) return cookie -remote_ldb= Ldb("ldap://" + opts.host + ":389", credentials=creds, lp=lp) +remote_ldb = Ldb("ldap://" + opts.host + ":389", credentials=creds, lp=lp) tab = [] if opts.b: base = opts.b @@ -74,7 +74,7 @@ savedcookie = cookie print("") print("Getting allusers with cookie") -controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] +controls = ["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] (msgs, ctrls) = remote_ldb.searchex(expression="(samaccountname=*)", base=base, attrs=["objectClass"], controls=controls) if (len(ctrls)): for ctl in ctrls: @@ -88,7 +88,7 @@ if cookie.blob.extra_length > 0: print("") print("Getting all the entries") -controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] +controls = ["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] (msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls) cont = 0 if (len(ctrls)): @@ -105,7 +105,7 @@ else: bigusn = usn + 1000 while (cont == "1"): print("") - controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] + controls = ["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] (msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls) if (len(ctrls)): for ctl in ctrls: @@ -121,7 +121,7 @@ cookie.blob.highwatermark.tmp_highest_usn = usn - 2 if cookie.blob.extra_length > 0: print("here") cookie.blob.extra.ctr.cursors[0].highest_usn = bigusn - 1 -controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] +controls = ["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] (msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls) if (len(ctrls)): for ctl in ctrls: @@ -136,7 +136,7 @@ cookie.blob.highwatermark.tmp_highest_usn = usn - 2 if cookie.blob.extra_length > 0: cookie.blob.extra.ctr.cursors[0].source_dsa_invocation_id = misc.GUID("128a99bf-e2df-4832-ac0a-1fb625e530db") cookie.blob.extra.ctr.cursors[0].highest_usn = bigusn - 1 -controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')) +controls = ["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')) (msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls) if (len(ctrls)): for ctl in ctrls: @@ -149,7 +149,7 @@ cookie.blob.highwatermark.highest_usn = 0 cookie.blob.highwatermark.tmp_highest_usn = (usn - 2) if cookie.blob.extra_length > 0: cookie.blob.extra.ctr.cursors[0].highest_usn = (usn - 2) -controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] +controls = ["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')] (msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls) if (len(ctrls)): for ctl in ctrls: diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index 4efcf77e590..89acae305e0 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -172,7 +172,7 @@ for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]: elif transport == "ncacn_ip_tcp": tests = ncacn_ip_tcp_tests else: - raise AssertionError("invalid transport %r"% transport) + raise AssertionError("invalid transport %r" % transport) for t in tests: plansmbtorture4testsuite(t, env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.%s on %s with %s" % (t, transport, bindoptions)) plansmbtorture4testsuite('rpc.samba3-sharesec', env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--option=torture:share=tmp'], "samba4.rpc.samba3.sharesec on %s with %s" % (transport, bindoptions)) @@ -1058,7 +1058,7 @@ plansmbtorture4testsuite('krb5.kdc', "rodc", ['ncacn_np:$SERVER_IP', "-k", "yes" "samba4.krb5.kdc with account ALLOWED permission to replicate to an RODC") # This ensures we have correct behaviour on a server that is not not the PDC emulator -env="promoted_dc" +env = "promoted_dc" plansmbtorture4testsuite('krb5.kdc', env, ['ncacn_np:$SERVER_IP', "-k", "yes", '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--realm=$REALM'], "samba4.krb5.kdc with specified account") diff --git a/source4/torture/drs/python/drs_base.py b/source4/torture/drs/python/drs_base.py index 85bb1f75f75..c84e819fc21 100644 --- a/source4/torture/drs/python/drs_base.py +++ b/source4/torture/drs/python/drs_base.py @@ -252,7 +252,7 @@ class DrsBaseTestCase(SambaToolCmdTest): next_object = ctr6.first_object for i in range(0, ctr6.object_count): - print("Obj %d: %s %s" %(i, next_object.object.identifier.dn[:25], + print("Obj %d: %s %s" % (i, next_object.object.identifier.dn[:25], next_object.object.identifier.guid)) next_object = next_object.next_object @@ -267,16 +267,16 @@ class DrsBaseTestCase(SambaToolCmdTest): l.value.blob) print("Link Tgt %s... <-- Src %s" - %(target.dn[:25], l.identifier.guid)) + % (target.dn[:25], l.identifier.guid)) state = "Del" if l.flags & drsuapi.DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE: state = "Act" - print(" v%u %s changed %u" %(l.meta_data.version, state, + print(" v%u %s changed %u" % (l.meta_data.version, state, l.meta_data.originating_change_time)) - print("HWM: %d" %(ctr6.new_highwatermark.highest_usn)) - print("Tmp HWM: %d" %(ctr6.new_highwatermark.tmp_highest_usn)) - print("More data: %d" %(ctr6.more_data)) + print("HWM: %d" % (ctr6.new_highwatermark.highest_usn)) + print("Tmp HWM: %d" % (ctr6.new_highwatermark.tmp_highest_usn)) + print("More data: %d" % (ctr6.more_data)) def _get_replication(self, replica_flags, drs_error=drsuapi.DRSUAPI_EXOP_ERR_NONE, drs=None, drs_handle=None, diff --git a/source4/torture/drs/python/getnc_exop.py b/source4/torture/drs/python/getnc_exop.py index d88a87e81ed..a7492aa33d2 100644 --- a/source4/torture/drs/python/getnc_exop.py +++ b/source4/torture/drs/python/getnc_exop.py @@ -267,14 +267,14 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): drsuapi.DRSUAPI_DRS_WRIT_REP) self._check_replication([ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC) self._check_replication([dc3], drsuapi.DRSUAPI_DRS_CRITICAL_ONLY) self._check_replication([ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC) m = ldb.Message() @@ -286,14 +286,14 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): drsuapi.DRSUAPI_DRS_WRIT_REP) self._check_replication([ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC) self._check_replication([dc3], drsuapi.DRSUAPI_DRS_CRITICAL_ONLY) self._check_replication([ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC) self._check_replication([ou1], @@ -301,12 +301,12 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): highwatermark=hwm1) self._check_replication([ou1], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC, highwatermark=hwm1) self._check_replication([ou1], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC, uptodateness_vector=utdv1) @@ -319,14 +319,14 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): drsuapi.DRSUAPI_DRS_WRIT_REP) self._check_replication([ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC) self._check_replication([dc3], drsuapi.DRSUAPI_DRS_CRITICAL_ONLY) self._check_replication([ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC) self._check_replication([ou1,ou2], @@ -334,12 +334,12 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): highwatermark=hwm1) self._check_replication([ou1,ou2], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC, highwatermark=hwm1) self._check_replication([ou1,ou2], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC, uptodateness_vector=utdv1) @@ -352,18 +352,18 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): drsuapi.DRSUAPI_DRS_WRIT_REP) self._check_replication([self.ou,ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC) self._check_replication([dc3], drsuapi.DRSUAPI_DRS_CRITICAL_ONLY) self._check_replication([self.ou,ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC) self._check_replication([self.ou,ou2], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC, uptodateness_vector=utdv2) @@ -378,14 +378,14 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): drsuapi.DRSUAPI_DRS_WRIT_REP) self._check_replication([self.ou,ou1,ou2,dc3,cn3], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC) self._check_replication([dc3], drsuapi.DRSUAPI_DRS_CRITICAL_ONLY) self._check_replication([self.ou,ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC) m = ldb.Message() @@ -402,7 +402,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): # Can fail against Windows due to equal precedence of dc3, cn3 self._check_replication([self.ou,ou1,ou2,dc3,cn3], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC, expected_links=[ou2_managedBy_dc3]) @@ -410,7 +410,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): drsuapi.DRSUAPI_DRS_CRITICAL_ONLY) self._check_replication([self.ou,ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC) self._check_replication([], @@ -453,7 +453,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): expected_links=[dc3_managedBy_ou1]) self._check_replication([self.ou,ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC, expected_links=[dc3_managedBy_ou1]) @@ -491,7 +491,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2]) self._check_replication([self.ou,ou1,ou2,dc3], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC, expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2]) @@ -511,7 +511,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): highwatermark=hwm7) self._check_replication([], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC, expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2], highwatermark=hwm7) @@ -522,7 +522,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): highwatermark=hwm7) self._check_replication([], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC, expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2], highwatermark=hwm7) @@ -541,7 +541,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): uptodateness_vector=utdv7) self._check_replication([], - drsuapi.DRSUAPI_DRS_WRIT_REP| + drsuapi.DRSUAPI_DRS_WRIT_REP | drsuapi.DRSUAPI_DRS_GET_ANC, expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2], uptodateness_vector=utdv7) @@ -552,7 +552,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): uptodateness_vector=utdv7) self._check_replication([], - drsuapi.DRSUAPI_DRS_CRITICAL_ONLY| + drsuapi.DRSUAPI_DRS_CRITICAL_ONLY | drsuapi.DRSUAPI_DRS_GET_ANC, expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2], uptodateness_vector=utdv7) diff --git a/source4/torture/drs/python/getnc_unpriv.py b/source4/torture/drs/python/getnc_unpriv.py index dcdde0c3311..17ad175b1f3 100644 --- a/source4/torture/drs/python/getnc_unpriv.py +++ b/source4/torture/drs/python/getnc_unpriv.py @@ -58,8 +58,8 @@ class DrsReplicaSyncUnprivTestCase(drs_base.DrsBaseTestCase): # objects can be slow to replicate out. So the OU created by a previous # testenv may still exist at this point). rand = random.randint(1, 10000000) - test_ou = "OU=test_getnc_unpriv%d" %rand - self.ou = "%s,%s" %(test_ou, self.base_dn) + test_ou = "OU=test_getnc_unpriv%d" % rand + self.ou = "%s,%s" % (test_ou, self.base_dn) self.ldb_dc1.add({ "dn": self.ou, "objectclass": "organizationalUnit"}) diff --git a/wintest/test-s4-howto.py b/wintest/test-s4-howto.py index 694f8c549e0..5a27c0edb86 100755 --- a/wintest/test-s4-howto.py +++ b/wintest/test-s4-howto.py @@ -25,7 +25,7 @@ def provision_s4(t, func_level="2008"): t.chdir('${PREFIX}') t.del_files(["var", "private"]) t.run_cmd("rm -f etc/smb.conf") - provision=['bin/samba-tool', + provision = ['bin/samba-tool', 'domain', 'provision', '--realm=${LCREALM}', @@ -256,7 +256,7 @@ def test_dcpromo(t, vm): time.sleep(2) child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test") i = child.expect(["The command completed successfully", "The network path was not found"]) - retries -=1 + retries -= 1 t.run_net_time(child) @@ -447,7 +447,7 @@ def test_join_as_dc(t, vm): child.expect("C:") if i == 1: time.sleep(2) - retries -=1 + retries -= 1 t.info("Checking if showrepl is happy") child.sendline("repadmin /showrepl") @@ -520,7 +520,7 @@ def test_join_as_rodc(t, vm): child.expect("C:") if i == 1: time.sleep(2) - retries -=1 + retries -= 1 t.info("Checking if showrepl is happy") child.sendline("repadmin /showrepl") diff --git a/wintest/wintest.py b/wintest/wintest.py index ad177cdb77d..8eb4600a41c 100644 --- a/wintest/wintest.py +++ b/wintest/wintest.py @@ -174,9 +174,9 @@ class wintest(): if output: return subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=dir).communicate()[0] if isinstance(cmd, list): - shell=False + shell = False else: - shell=True + shell = True if checkfail: return subprocess.check_call(cmd, shell=shell, cwd=dir) else: @@ -192,9 +192,9 @@ class wintest(): else: self.info('$ ' + cmd) if isinstance(cmd, list): - shell=False + shell = False else: - shell=True + shell = True os.chdir(dir) ret = subprocess.Popen(cmd, shell=shell, stderr=subprocess.STDOUT) os.chdir(cwd) @@ -495,7 +495,7 @@ options { def ping_wait(self, hostname): '''wait for a hostname to come up on the network''' hostname = self.substitute(hostname) - loops=10 + loops = 10 while loops > 0: try: self.run_cmd("ping -c 1 -w 10 %s" % hostname) |