From: Joe Guo Date: Mon, 30 Jul 2018 06:17:14 +0000 (+1200) Subject: PEP8: fix E203: whitespace before ':' X-Git-Tag: tdb-1.3.17~2070 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=ba0827b560c8165bcbb4017a6377778934ad9bb9 PEP8: fix E203: whitespace before ':' Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py index 1f78c87cc73..0654c2fb971 100755 --- a/lib/ldb/tests/python/api.py +++ b/lib/ldb/tests/python/api.py @@ -670,12 +670,12 @@ class SimpleLdb(LdbBaseTest): """Testing we do not get trapped in the \0 byte in a property string.""" l = ldb.Ldb(self.url(), flags=self.flags()) l.add({ - "dn" : b"dc=somedn", - "objectclass" : b"user", - "cN" : b"LDAPtestUSER", - "givenname" : b"ldap", - "displayname" : b"foo\0bar", - "objectUUID" : b"0123456789abcdef" + "dn": b"dc=somedn", + "objectclass": b"user", + "cN": b"LDAPtestUSER", + "givenname": b"ldap", + "displayname": b"foo\0bar", + "objectUUID": b"0123456789abcdef" }) res = l.search(expression="(dn=dc=somedn)") self.assertEqual(b"foo\0bar", res[0]["displayname"][0]) diff --git a/python/samba/gp_sec_ext.py b/python/samba/gp_sec_ext.py index 68e3a0081e5..40999758e0e 100644 --- a/python/samba/gp_sec_ext.py +++ b/python/samba/gp_sec_ext.py @@ -93,12 +93,12 @@ class inf_to_ldb(gp_ext_setter): def mapper(self): '''ldap value : samba setter''' - return {"minPwdAge" : (self.ch_minPwdAge, self.days2rel_nttime), - "maxPwdAge" : (self.ch_maxPwdAge, self.days2rel_nttime), + return {"minPwdAge": (self.ch_minPwdAge, self.days2rel_nttime), + "maxPwdAge": (self.ch_maxPwdAge, self.days2rel_nttime), # Could be none, but I like the method assignment in # update_samba - "minPwdLength" : (self.ch_minPwdLength, self.explicit), - "pwdProperties" : (self.ch_pwdProperties, self.explicit), + "minPwdLength": (self.ch_minPwdLength, self.explicit), + "pwdProperties": (self.ch_pwdProperties, self.explicit), } diff --git a/python/samba/join.py b/python/samba/join.py index 92061c38b23..68b2bfc1c68 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -415,12 +415,12 @@ class DCJoinContext(object): '''RODCs need a special krbtgt account''' print("Adding %s" % ctx.krbtgt_dn) rec = { - "dn" : ctx.krbtgt_dn, - "objectclass" : "user", - "useraccountcontrol" : str(samba.dsdb.UF_NORMAL_ACCOUNT | + "dn": ctx.krbtgt_dn, + "objectclass": "user", + "useraccountcontrol": str(samba.dsdb.UF_NORMAL_ACCOUNT | samba.dsdb.UF_ACCOUNTDISABLE), - "showinadvancedviewonly" : "TRUE", - "description" : "krbtgt for %s" % ctx.samname} + "showinadvancedviewonly": "TRUE", + "description": "krbtgt for %s" % ctx.samname} ctx.samdb.add(rec, ["rodc_join:1:1"]) # now we need to search for the samAccountName attribute on the krbtgt DN, @@ -536,10 +536,10 @@ class DCJoinContext(object): print("Adding %s" % ctx.ntds_dn) rec = { - "dn" : ctx.ntds_dn, - "objectclass" : "nTDSDSA", - "systemFlags" : str(samba.dsdb.SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE), - "dMDLocation" : ctx.schema_dn} + "dn": ctx.ntds_dn, + "objectclass": "nTDSDSA", + "systemFlags": str(samba.dsdb.SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE), + "dMDLocation": ctx.schema_dn} nc_list = [ctx.base_dn, ctx.config_dn, ctx.schema_dn] @@ -586,12 +586,12 @@ class DCJoinContext(object): if ctx.acct_dn: print("Adding %s" % ctx.acct_dn) rec = { - "dn" : ctx.acct_dn, + "dn": ctx.acct_dn, "objectClass": "computer", "displayname": ctx.samname, - "samaccountname" : ctx.samname, - "userAccountControl" : str(ctx.userAccountControl | samba.dsdb.UF_ACCOUNTDISABLE), - "dnshostname" : ctx.dnshostname} + "samaccountname": ctx.samname, + "userAccountControl": str(ctx.userAccountControl | samba.dsdb.UF_ACCOUNTDISABLE), + "dnshostname": ctx.dnshostname} if ctx.behavior_version >= samba.dsdb.DS_DOMAIN_FUNCTION_2008: rec['msDS-SupportedEncryptionTypes'] = str(samba.dsdb.ENC_ALL_TYPES) elif ctx.promote_existing: @@ -631,13 +631,13 @@ class DCJoinContext(object): print("Adding %s" % ctx.server_dn) rec = { "dn": ctx.server_dn, - "objectclass" : "server", + "objectclass": "server", # windows uses 50000000 decimal for systemFlags. A windows hex/decimal mixup bug? - "systemFlags" : str(samba.dsdb.SYSTEM_FLAG_CONFIG_ALLOW_RENAME | + "systemFlags": str(samba.dsdb.SYSTEM_FLAG_CONFIG_ALLOW_RENAME | samba.dsdb.SYSTEM_FLAG_CONFIG_ALLOW_LIMITED_MOVE | samba.dsdb.SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE), # windows seems to add the dnsHostName later - "dnsHostName" : ctx.dnshostname} + "dnsHostName": ctx.dnshostname} if ctx.acct_dn: rec["serverReference"] = ctx.acct_dn @@ -684,11 +684,11 @@ class DCJoinContext(object): if ctx.connection_dn is not None: print("Adding %s" % ctx.connection_dn) rec = { - "dn" : ctx.connection_dn, - "objectclass" : "nTDSConnection", - "enabledconnection" : "TRUE", - "options" : "65", - "fromServer" : ctx.dc_ntds_dn} + "dn": ctx.connection_dn, + "objectclass": "nTDSConnection", + "enabledconnection": "TRUE", + "options": "65", + "fromServer": ctx.dc_ntds_dn} ctx.samdb.add(rec) if ctx.acct_dn: @@ -747,9 +747,9 @@ class DCJoinContext(object): recs = ctx.samdb.parse_ldif(read_and_sub_file(setup_path("provision_dns_add_samba.ldif"), {"DNSDOMAIN": ctx.dnsdomain, "DOMAINDN": ctx.base_dn, - "HOSTNAME" : ctx.myname, + "HOSTNAME": ctx.myname, "DNSPASS_B64": b64encode(ctx.dnspass.encode('utf-16-le')).decode('utf8'), - "DNSNAME" : ctx.dnshostname})) + "DNSNAME": ctx.dnshostname})) for changetype, msg in recs: assert changetype == ldb.CHANGETYPE_NONE dns_acct_dn = msg["dn"] @@ -803,15 +803,15 @@ class DCJoinContext(object): name_map = {'SubdomainAdmins': "%s-%s" % (str(ctx.domsid), security.DOMAIN_RID_ADMINS)} sd_binary = descriptor.get_paritions_crossref_subdomain_descriptor(ctx.forestsid, name_map=name_map) rec = { - "dn" : ctx.partition_dn, - "objectclass" : "crossRef", - "objectCategory" : "CN=Cross-Ref,%s" % ctx.schema_dn, - "nCName" : ctx.base_dn, - "nETBIOSName" : ctx.domain_name, + "dn": ctx.partition_dn, + "objectclass": "crossRef", + "objectCategory": "CN=Cross-Ref,%s" % ctx.schema_dn, + "nCName": ctx.base_dn, + "nETBIOSName": ctx.domain_name, "dnsRoot": ctx.dnsdomain, - "trustParent" : ctx.parent_partition_dn, - "systemFlags" : str(samba.dsdb.SYSTEM_FLAG_CR_NTDS_NC|samba.dsdb.SYSTEM_FLAG_CR_NTDS_DOMAIN), - "ntSecurityDescriptor" : sd_binary, + "trustParent": ctx.parent_partition_dn, + "systemFlags": str(samba.dsdb.SYSTEM_FLAG_CR_NTDS_NC|samba.dsdb.SYSTEM_FLAG_CR_NTDS_DOMAIN), + "ntSecurityDescriptor": sd_binary, } if ctx.behavior_version >= samba.dsdb.DS_DOMAIN_FUNCTION_2003: @@ -1340,25 +1340,25 @@ class DCJoinContext(object): security.SEC_STD_DELETE) rec = { - "dn" : "cn=%s,cn=system,%s" % (ctx.dnsforest, ctx.base_dn), - "objectclass" : "trustedDomain", - "trustType" : str(info.trust_type), - "trustAttributes" : str(info.trust_attributes), - "trustDirection" : str(info.trust_direction), - "flatname" : ctx.forest_domain_name, - "trustPartner" : ctx.dnsforest, - "trustAuthIncoming" : ndr_pack(outgoing), - "trustAuthOutgoing" : ndr_pack(outgoing), - "securityIdentifier" : ndr_pack(ctx.forestsid) + "dn": "cn=%s,cn=system,%s" % (ctx.dnsforest, ctx.base_dn), + "objectclass": "trustedDomain", + "trustType": str(info.trust_type), + "trustAttributes": str(info.trust_attributes), + "trustDirection": str(info.trust_direction), + "flatname": ctx.forest_domain_name, + "trustPartner": ctx.dnsforest, + "trustAuthIncoming": ndr_pack(outgoing), + "trustAuthOutgoing": ndr_pack(outgoing), + "securityIdentifier": ndr_pack(ctx.forestsid) } ctx.local_samdb.add(rec) rec = { - "dn" : "cn=%s$,cn=users,%s" % (ctx.forest_domain_name, ctx.base_dn), - "objectclass" : "user", - "userAccountControl" : str(samba.dsdb.UF_INTERDOMAIN_TRUST_ACCOUNT), - "clearTextPassword" : ctx.trustdom_pass.encode('utf-16-le'), - "samAccountName" : "%s$" % ctx.forest_domain_name + "dn": "cn=%s$,cn=users,%s" % (ctx.forest_domain_name, ctx.base_dn), + "objectclass": "user", + "userAccountControl": str(samba.dsdb.UF_INTERDOMAIN_TRUST_ACCOUNT), + "clearTextPassword": ctx.trustdom_pass.encode('utf-16-le'), + "samAccountName": "%s$" % ctx.forest_domain_name } ctx.local_samdb.add(rec) diff --git a/python/samba/ms_schema.py b/python/samba/ms_schema.py index 06df7e3067c..61e2ade6950 100644 --- a/python/samba/ms_schema.py +++ b/python/samba/ms_schema.py @@ -73,13 +73,13 @@ bitFields["schemaflagsex"] = { # ADTS: 3.1.1.2.2.2 oMObjectClassBER = { - '1.3.12.2.1011.28.0.702' : base64.b64encode(b'\x2B\x0C\x02\x87\x73\x1C\x00\x85\x3E').decode('utf8'), + '1.3.12.2.1011.28.0.702': base64.b64encode(b'\x2B\x0C\x02\x87\x73\x1C\x00\x85\x3E').decode('utf8'), '1.2.840.113556.1.1.1.12': base64.b64encode(b'\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x0C').decode('utf8'), - '2.6.6.1.2.5.11.29' : base64.b64encode(b'\x56\x06\x01\x02\x05\x0B\x1D').decode('utf8'), + '2.6.6.1.2.5.11.29': base64.b64encode(b'\x56\x06\x01\x02\x05\x0B\x1D').decode('utf8'), '1.2.840.113556.1.1.1.11': base64.b64encode(b'\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x0B').decode('utf8'), - '1.3.12.2.1011.28.0.714' : base64.b64encode(b'\x2B\x0C\x02\x87\x73\x1C\x00\x85\x4A').decode('utf8'), - '1.3.12.2.1011.28.0.732' : base64.b64encode(b'\x2B\x0C\x02\x87\x73\x1C\x00\x85\x5C').decode('utf8'), - '1.2.840.113556.1.1.1.6' : base64.b64encode(b'\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x06').decode('utf8') + '1.3.12.2.1011.28.0.714': base64.b64encode(b'\x2B\x0C\x02\x87\x73\x1C\x00\x85\x4A').decode('utf8'), + '1.3.12.2.1011.28.0.732': base64.b64encode(b'\x2B\x0C\x02\x87\x73\x1C\x00\x85\x5C').decode('utf8'), + '1.2.840.113556.1.1.1.6': base64.b64encode(b'\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x06').decode('utf8') } # separated by commas in docs, and must be broken up diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index 09dd1733dc7..bcf5d4ddb08 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -103,7 +103,7 @@ from samba.netcmd.pso import cmd_domain_passwordsettings_pso from samba.netcmd.domain_backup import cmd_domain_backup string_version_to_constant = { - "2008_R2" : DS_DOMAIN_FUNCTION_2008_R2, + "2008_R2": DS_DOMAIN_FUNCTION_2008_R2, "2012": DS_DOMAIN_FUNCTION_2012, "2012_R2": DS_DOMAIN_FUNCTION_2012_R2, } @@ -1983,46 +1983,46 @@ class DomainTrustCommand(Command): def trustType_string(self, v): types = { - lsa.LSA_TRUST_TYPE_DOWNLEVEL : "DOWNLEVEL", - lsa.LSA_TRUST_TYPE_UPLEVEL : "UPLEVEL", - lsa.LSA_TRUST_TYPE_MIT : "MIT", - lsa.LSA_TRUST_TYPE_DCE : "DCE", + lsa.LSA_TRUST_TYPE_DOWNLEVEL: "DOWNLEVEL", + lsa.LSA_TRUST_TYPE_UPLEVEL: "UPLEVEL", + lsa.LSA_TRUST_TYPE_MIT: "MIT", + lsa.LSA_TRUST_TYPE_DCE: "DCE", } return self.generic_enum_to_string(types, v) def trustDirection_string(self, v): directions = { lsa.LSA_TRUST_DIRECTION_INBOUND | - lsa.LSA_TRUST_DIRECTION_OUTBOUND : "BOTH", - lsa.LSA_TRUST_DIRECTION_INBOUND : "INBOUND", - lsa.LSA_TRUST_DIRECTION_OUTBOUND : "OUTBOUND", + lsa.LSA_TRUST_DIRECTION_OUTBOUND: "BOTH", + lsa.LSA_TRUST_DIRECTION_INBOUND: "INBOUND", + lsa.LSA_TRUST_DIRECTION_OUTBOUND: "OUTBOUND", } return self.generic_enum_to_string(directions, v) def trustAttributes_string(self, v): attributes = { - lsa.LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE : "NON_TRANSITIVE", - lsa.LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY : "UPLEVEL_ONLY", - lsa.LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN : "QUARANTINED_DOMAIN", - lsa.LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE : "FOREST_TRANSITIVE", - lsa.LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION : "CROSS_ORGANIZATION", - lsa.LSA_TRUST_ATTRIBUTE_WITHIN_FOREST : "WITHIN_FOREST", - lsa.LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL : "TREAT_AS_EXTERNAL", - lsa.LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION : "USES_RC4_ENCRYPTION", + lsa.LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE: "NON_TRANSITIVE", + lsa.LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY: "UPLEVEL_ONLY", + lsa.LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN: "QUARANTINED_DOMAIN", + lsa.LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE: "FOREST_TRANSITIVE", + lsa.LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION: "CROSS_ORGANIZATION", + lsa.LSA_TRUST_ATTRIBUTE_WITHIN_FOREST: "WITHIN_FOREST", + lsa.LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL: "TREAT_AS_EXTERNAL", + lsa.LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION: "USES_RC4_ENCRYPTION", } return self.generic_bitmap_to_string(attributes, v) def kerb_EncTypes_string(self, v): enctypes = { - security.KERB_ENCTYPE_DES_CBC_CRC : "DES_CBC_CRC", - security.KERB_ENCTYPE_DES_CBC_MD5 : "DES_CBC_MD5", - security.KERB_ENCTYPE_RC4_HMAC_MD5 : "RC4_HMAC_MD5", - security.KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96 : "AES128_CTS_HMAC_SHA1_96", - security.KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 : "AES256_CTS_HMAC_SHA1_96", - security.KERB_ENCTYPE_FAST_SUPPORTED : "FAST_SUPPORTED", - security.KERB_ENCTYPE_COMPOUND_IDENTITY_SUPPORTED : "COMPOUND_IDENTITY_SUPPORTED", - security.KERB_ENCTYPE_CLAIMS_SUPPORTED : "CLAIMS_SUPPORTED", - security.KERB_ENCTYPE_RESOURCE_SID_COMPRESSION_DISABLED : "RESOURCE_SID_COMPRESSION_DISABLED", + security.KERB_ENCTYPE_DES_CBC_CRC: "DES_CBC_CRC", + security.KERB_ENCTYPE_DES_CBC_MD5: "DES_CBC_MD5", + security.KERB_ENCTYPE_RC4_HMAC_MD5: "RC4_HMAC_MD5", + security.KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96: "AES128_CTS_HMAC_SHA1_96", + security.KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96: "AES256_CTS_HMAC_SHA1_96", + security.KERB_ENCTYPE_FAST_SUPPORTED: "FAST_SUPPORTED", + security.KERB_ENCTYPE_COMPOUND_IDENTITY_SUPPORTED: "COMPOUND_IDENTITY_SUPPORTED", + security.KERB_ENCTYPE_CLAIMS_SUPPORTED: "CLAIMS_SUPPORTED", + security.KERB_ENCTYPE_RESOURCE_SID_COMPRESSION_DISABLED: "RESOURCE_SID_COMPRESSION_DISABLED", } return self.generic_bitmap_to_string(enctypes, v) @@ -2031,9 +2031,9 @@ class DomainTrustCommand(Command): return "Status[Enabled]" flags = { - lsa.LSA_TLN_DISABLED_NEW : "Disabled-New", - lsa.LSA_TLN_DISABLED_ADMIN : "Disabled", - lsa.LSA_TLN_DISABLED_CONFLICT : "Disabled-Conflicting", + lsa.LSA_TLN_DISABLED_NEW: "Disabled-New", + lsa.LSA_TLN_DISABLED_ADMIN: "Disabled", + lsa.LSA_TLN_DISABLED_CONFLICT: "Disabled-Conflicting", } return "Status[%s]" % self.generic_bitmap_to_string(flags, e_flags, names_only=True) @@ -2042,10 +2042,10 @@ class DomainTrustCommand(Command): return "Status[Enabled]" flags = { - lsa.LSA_SID_DISABLED_ADMIN : "Disabled-SID", - lsa.LSA_SID_DISABLED_CONFLICT : "Disabled-SID-Conflicting", - lsa.LSA_NB_DISABLED_ADMIN : "Disabled-NB", - lsa.LSA_NB_DISABLED_CONFLICT : "Disabled-NB-Conflicting", + lsa.LSA_SID_DISABLED_ADMIN: "Disabled-SID", + lsa.LSA_SID_DISABLED_CONFLICT: "Disabled-SID-Conflicting", + lsa.LSA_NB_DISABLED_ADMIN: "Disabled-NB", + lsa.LSA_NB_DISABLED_CONFLICT: "Disabled-NB-Conflicting", } return "Status[%s]" % self.generic_bitmap_to_string(flags, e_flags, names_only=True) diff --git a/python/samba/netcmd/dsacl.py b/python/samba/netcmd/dsacl.py index bc9a6942b08..7522736b125 100644 --- a/python/samba/netcmd/dsacl.py +++ b/python/samba/netcmd/dsacl.py @@ -146,19 +146,19 @@ class cmd_dsacl_set(Command): samdb = SamDB(url=H, session_info=system_session(), 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, - 'change-schema' : GUID_DRS_CHANGE_SCHEMA_MASTER, - 'change-naming' : GUID_DRS_CHANGE_DOMAIN_MASTER, - 'allocate_rids' : GUID_DRS_ALLOCATE_RIDS, - 'get-changes' : GUID_DRS_GET_CHANGES, - 'get-changes-all' : GUID_DRS_GET_ALL_CHANGES, - 'get-changes-filtered' : GUID_DRS_GET_FILTERED_ATTRIBUTES, - 'topology-manage' : GUID_DRS_MANAGE_TOPOLOGY, - 'topology-monitor' : GUID_DRS_MONITOR_TOPOLOGY, - 'repl-sync' : GUID_DRS_REPL_SYNCRONIZE, - 'ro-repl-secret-sync' : GUID_DRS_RO_REPL_SECRET_SYNC, + cars = {'change-rid': GUID_DRS_CHANGE_RID_MASTER, + 'change-pdc': GUID_DRS_CHANGE_PDC, + 'change-infrastructure': GUID_DRS_CHANGE_INFR_MASTER, + 'change-schema': GUID_DRS_CHANGE_SCHEMA_MASTER, + 'change-naming': GUID_DRS_CHANGE_DOMAIN_MASTER, + 'allocate_rids': GUID_DRS_ALLOCATE_RIDS, + 'get-changes': GUID_DRS_GET_CHANGES, + 'get-changes-all': GUID_DRS_GET_ALL_CHANGES, + 'get-changes-filtered': GUID_DRS_GET_FILTERED_ATTRIBUTES, + 'topology-manage': GUID_DRS_MANAGE_TOPOLOGY, + 'topology-monitor': GUID_DRS_MONITOR_TOPOLOGY, + 'repl-sync': GUID_DRS_REPL_SYNCRONIZE, + 'ro-repl-secret-sync': GUID_DRS_RO_REPL_SECRET_SYNC, } sid = self.find_trustee_sid(samdb, trusteedn) if sddl: diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py index f3e17610ead..bbe4834e135 100644 --- a/python/samba/netcmd/gpo.py +++ b/python/samba/netcmd/gpo.py @@ -108,7 +108,7 @@ def parse_gplink(gplink): d = g.split(';') if len(d) != 2 or not d[0].startswith("[LDAP://"): raise RuntimeError("Badly formed gPLink '%s'" % g) - ret.append({'dn' : d[0][8:], 'options' : int(d[1])}) + ret.append({'dn': d[0][8:], 'options': int(d[1])}) return ret @@ -680,10 +680,10 @@ class cmd_setlink(Command): if found: raise CommandError("GPO '%s' already linked to this container" % gpo) else: - gplist.insert(0, {'dn' : gpo_dn, 'options' : gplink_options}) + gplist.insert(0, {'dn': gpo_dn, 'options': gplink_options}) else: gplist = [] - gplist.append({'dn' : gpo_dn, 'options' : gplink_options}) + gplist.append({'dn': gpo_dn, 'options': gplink_options}) gplink_str = encode_gplink(gplist) diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index 6bad53eb2c4..0baffbcb1e5 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -168,7 +168,7 @@ except ImportError as e: reason += " and " + random_reason reason += " required" disabled_virtual_attributes["virtualSSHA"] = { - "reason" : reason, + "reason": reason, } for (alg, attr) in [("5", "virtualCryptSHA256"), ("6", "virtualCryptSHA512")]: @@ -187,12 +187,12 @@ for (alg, attr) in [("5", "virtualCryptSHA256"), ("6", "virtualCryptSHA512")]: reason += " and " + random_reason reason += " required" disabled_virtual_attributes[attr] = { - "reason" : reason, + "reason": reason, } except NotImplementedError as e: reason = "modern '$%s$' salt in crypt(3) required" % (alg) disabled_virtual_attributes[attr] = { - "reason" : reason, + "reason": reason, } # Add the wDigest virtual attributes, virtualWDigest01 to virtualWDigest29 diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index 815df774e18..664c170fcae 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -1127,7 +1127,7 @@ def setup_samdb_rootdse(samdb, names): setup_add_ldif(samdb, setup_path("provision_rootdse_add.ldif"), { "SCHEMADN": names.schemadn, "DOMAINDN": names.domaindn, - "ROOTDN" : names.rootdn, + "ROOTDN": names.rootdn, "CONFIGDN": names.configdn, "SERVERDN": names.serverdn, }) @@ -1220,8 +1220,8 @@ def setup_self_join(samdb, admin_session_info, names, fill, machinepass, "DNSDOMAIN": names.dnsdomain, "DOMAINDN": names.domaindn, "DNSPASS_B64": b64encode(dnspass.encode('utf-16-le')).decode('utf8'), - "HOSTNAME" : names.hostname, - "DNSNAME" : '%s.%s' % ( + "HOSTNAME": names.hostname, + "DNSNAME": '%s.%s' % ( names.netbiosname.lower(), names.dnsdomain.lower()) }) @@ -1422,7 +1422,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, + msg["subRefs"] = ldb.MessageElement(names.configdn, ldb.FLAG_MOD_ADD, "subRefs") samdb.invocation_id = invocationid @@ -1973,7 +1973,7 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths, logger.info("Setting up sam.ldb rootDSE marking as synchronized") setup_modify_ldif(samdb, setup_path("provision_rootdse_modify.ldif"), - {'NTDSGUID' : names.ntdsguid}) + {'NTDSGUID': names.ntdsguid}) # fix any dangling GUIDs from the provision logger.info("Fixing provision GUIDs") diff --git a/python/samba/provision/backend.py b/python/samba/provision/backend.py index b8b7e509773..35743355819 100644 --- a/python/samba/provision/backend.py +++ b/python/samba/provision/backend.py @@ -421,42 +421,42 @@ class OpenLDAPBackend(LDAPBackend): rid = serverid * 10 rid = rid + 1 mmr_syncrepl_schema_config += read_and_sub_file( - setup_path("mmr_syncrepl.conf"), { - "RID" : str(rid), - "MMRDN": self.names.schemadn, - "LDAPSERVER" : url, - "MMR_PASSWORD": mmr_pass}) + setup_path("mmr_syncrepl.conf"), { + "RID" : str(rid), + "MMRDN": self.names.schemadn, + "LDAPSERVER" : url, + "MMR_PASSWORD": mmr_pass}) rid = rid + 1 mmr_syncrepl_config_config += read_and_sub_file( setup_path("mmr_syncrepl.conf"), { - "RID" : str(rid), + "RID": str(rid), "MMRDN": self.names.configdn, - "LDAPSERVER" : url, + "LDAPSERVER": url, "MMR_PASSWORD": mmr_pass}) rid = rid + 1 mmr_syncrepl_domaindns_config += read_and_sub_file( setup_path("mmr_syncrepl.conf"), { - "RID" : str(rid), + "RID": str(rid), "MMRDN": "dc=DomainDNSZones," + self.names.domaindn, - "LDAPSERVER" : url, + "LDAPSERVER": url, "MMR_PASSWORD": mmr_pass}) rid = rid + 1 mmr_syncrepl_forestdns_config += read_and_sub_file( setup_path("mmr_syncrepl.conf"), { - "RID" : str(rid), + "RID": str(rid), "MMRDN": "dc=ForestDNSZones," + self.names.domaindn, - "LDAPSERVER" : url, + "LDAPSERVER": url, "MMR_PASSWORD": mmr_pass}) rid = rid + 1 mmr_syncrepl_user_config += read_and_sub_file( setup_path("mmr_syncrepl.conf"), { - "RID" : str(rid), + "RID": str(rid), "MMRDN": self.names.domaindn, - "LDAPSERVER" : url, + "LDAPSERVER": url, "MMR_PASSWORD": mmr_pass}) # OpenLDAP cn=config initialisation olc_syncrepl_config = "" @@ -474,17 +474,17 @@ class OpenLDAPBackend(LDAPBackend): serverid = serverid + 1 olc_serverids_config += read_and_sub_file( setup_path("olc_serverid.conf"), { - "SERVERID" : str(serverid), "LDAPSERVER" : url}) + "SERVERID": str(serverid), "LDAPSERVER": url}) rid = rid + 1 olc_syncrepl_config += read_and_sub_file( setup_path("olc_syncrepl.conf"), { - "RID" : str(rid), "LDAPSERVER" : url, + "RID": str(rid), "LDAPSERVER": url, "MMR_PASSWORD": mmr_pass}) olc_syncrepl_seed_config += read_and_sub_file( setup_path("olc_syncrepl_seed.conf"), { - "RID" : str(rid), "LDAPSERVER" : url}) + "RID": str(rid), "LDAPSERVER": url}) setup_file(setup_path("olc_seed.ldif"), self.olcseedldif, {"OLC_SERVER_ID_CONF": olc_serverids_config, @@ -717,14 +717,14 @@ class FDSBackend(LDAPBackend): if lnkattr[attr] is not None: refint_config += read_and_sub_file( setup_path("fedorads-refint-add.ldif"), - {"ARG_NUMBER" : str(argnum), - "LINK_ATTR" : attr}) + {"ARG_NUMBER": str(argnum), + "LINK_ATTR": attr}) memberof_config += read_and_sub_file( setup_path("fedorads-linked-attributes.ldif"), - {"MEMBER_ATTR" : attr, - "MEMBEROF_ATTR" : lnkattr[attr]}) + {"MEMBER_ATTR": attr, + "MEMBEROF_ATTR": lnkattr[attr]}) index_config += read_and_sub_file( - setup_path("fedorads-index.ldif"), {"ATTR" : attr}) + setup_path("fedorads-index.ldif"), {"ATTR": attr}) argnum += 1 f = open(self.refint_ldif, 'w') @@ -751,7 +751,7 @@ class FDSBackend(LDAPBackend): attr = "nsUniqueId" index_config += read_and_sub_file( - setup_path("fedorads-index.ldif"), {"ATTR" : attr}) + setup_path("fedorads-index.ldif"), {"ATTR": attr}) f = open(self.index_ldif, 'w') try: diff --git a/python/samba/provision/sambadns.py b/python/samba/provision/sambadns.py index 99372e364f8..c716df4d7dc 100644 --- a/python/samba/provision/sambadns.py +++ b/python/samba/provision/sambadns.py @@ -247,12 +247,12 @@ def setup_dns_partitions(samdb, domainsid, domaindn, forestdn, configdn, setup_add_ldif(samdb, setup_path("provision_dnszones_partitions.ldif"), { "ZONE_DN": domainzone_dn, - "SECDESC" : b64encode(descriptor).decode('utf8') + "SECDESC": b64encode(descriptor).decode('utf8') }) if fill_level != FILL_SUBDOMAIN: setup_add_ldif(samdb, setup_path("provision_dnszones_partitions.ldif"), { "ZONE_DN": forestzone_dn, - "SECDESC" : b64encode(descriptor).decode('utf8') + "SECDESC": b64encode(descriptor).decode('utf8') }) domainzone_guid = get_domainguid(samdb, domainzone_dn) @@ -681,7 +681,7 @@ def secretsdb_setup_dns(secretsdb, names, private_dir, binddns_dir, realm, "DNSPASS_B64": b64encode(dnspass.encode('utf-8')).decode('utf8'), "KEY_VERSION_NUMBER": str(key_version_number), "HOSTNAME": names.hostname, - "DNSNAME" : '%s.%s' % ( + "DNSNAME": '%s.%s' % ( names.netbiosname.lower(), names.dnsdomain.lower()) }) @@ -822,10 +822,10 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid): domainguid_line = "objectGUID: %s\n-" % domainguid descr = b64encode(get_domain_descriptor(domainsid)).decode('utf8') setup_add_ldif(dom_ldb, setup_path("provision_basedn.ldif"), { - "DOMAINDN" : names.domaindn, - "DOMAINGUID" : domainguid_line, - "DOMAINSID" : str(domainsid), - "DESCRIPTOR" : descr}) + "DOMAINDN": names.domaindn, + "DOMAINGUID": domainguid_line, + "DOMAINSID": str(domainsid), + "DESCRIPTOR": descr}) setup_add_ldif(dom_ldb, setup_path("provision_basedn_options.ldif"), None) diff --git a/python/samba/samdb.py b/python/samba/samdb.py index 073244ba7f7..0cf595345ac 100644 --- a/python/samba/samdb.py +++ b/python/samba/samdb.py @@ -883,7 +883,7 @@ schemaUpdateNow: 1 ctr.count = ctr.count + 1 ctr.array = tab - if found : + if found: replBlob = ndr_pack(repl) msg = ldb.Message() msg.dn = res[0].dn diff --git a/python/samba/schema.py b/python/samba/schema.py index 1e846329452..08c77c04e52 100644 --- a/python/samba/schema.py +++ b/python/samba/schema.py @@ -64,16 +64,16 @@ 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", + "2008_R2_old": ("MS-AD_Schema_2K8_R2_Attributes.txt", "MS-AD_Schema_2K8_R2_Classes.txt", 47), - "2008_R2" : ("Attributes_for_AD_DS__Windows_Server_2008_R2.ldf", + "2008_R2": ("Attributes_for_AD_DS__Windows_Server_2008_R2.ldf", "Classes_for_AD_DS__Windows_Server_2008_R2.ldf", 47), - "2012" : ("AD_DS_Attributes__Windows_Server_2012.ldf", + "2012": ("AD_DS_Attributes__Windows_Server_2012.ldf", "AD_DS_Classes__Windows_Server_2012.ldf", 56), - "2012_R2" : ("AD_DS_Attributes__Windows_Server_2012_R2.ldf", + "2012_R2": ("AD_DS_Attributes__Windows_Server_2012_R2.ldf", "AD_DS_Classes__Windows_Server_2012_R2.ldf", 69), } @@ -120,7 +120,7 @@ class Schema(object): schema_version = str(Schema.get_version(base_schema)) self.schema_dn_modify = read_and_sub_file( setup_path("provision_schema_basedn_modify.ldif"), - {"SCHEMADN": schemadn, "OBJVERSION" : schema_version}) + {"SCHEMADN": schemadn, "OBJVERSION": schema_version}) descr = b64encode(get_schema_descriptor(domain_sid)).decode('utf8') self.schema_dn_add = read_and_sub_file( diff --git a/python/samba/tests/kcc/__init__.py b/python/samba/tests/kcc/__init__.py index 2597388c167..ee09a78689a 100644 --- a/python/samba/tests/kcc/__init__.py +++ b/python/samba/tests/kcc/__init__.py @@ -38,7 +38,7 @@ unix_now = int(time.time()) unix_once_upon_a_time = 1000000000 #2001-09-09 ENV_DSAS = { - 'ad_dc_ntvfs' : ['CN=LOCALDC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=samba,DC=example,DC=com'], + 'ad_dc_ntvfs': ['CN=LOCALDC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=samba,DC=example,DC=com'], 'fl2000dc': ['CN=DC5,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=samba2000,DC=example,DC=com'], 'fl2003dc': ['CN=DC6,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=samba2003,DC=example,DC=com'], 'fl2008r2dc': ['CN=DC7,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=samba2008r2,DC=example,DC=com'], diff --git a/python/samba/upgradehelpers.py b/python/samba/upgradehelpers.py index c560f9ae31d..e8f0dba8cdc 100644 --- a/python/samba/upgradehelpers.py +++ b/python/samba/upgradehelpers.py @@ -778,7 +778,7 @@ def print_provision_ranges(dic, limit_print, dest, samdb_path, invocationid): obj = hash_ts[k] if obj["num"] > limit_print: dt = _glue.nttime2string(_glue.unix2nttime(k*60)) - print("%s # of modification: %d \tmin: %d max: %d" % (dt , obj["num"], + print("%s # of modification: %d \tmin: %d max: %d" % (dt, obj["num"], obj["min"], obj["max"])) if hash_ts[k]["num"] > 600: diff --git a/script/autobuild.py b/script/autobuild.py index f52821915cb..4a27e1b5255 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -24,30 +24,30 @@ os.environ['TDB_NO_FSYNC'] = '1' cleanup_list = [] builddirs = { - "ctdb" : "ctdb", - "samba" : ".", - "samba-nt4" : ".", - "samba-fileserver" : ".", - "samba-xc" : ".", - "samba-o3" : ".", - "samba-ctdb" : ".", - "samba-libs" : ".", - "samba-static" : ".", - "samba-test-only" : ".", - "samba-none-env" : ".", - "samba-ad-dc" : ".", - "samba-ad-dc-2" : ".", - "samba-systemkrb5" : ".", - "samba-nopython" : ".", - "ldb" : "lib/ldb", - "tdb" : "lib/tdb", - "talloc" : "lib/talloc", - "replace" : "lib/replace", - "tevent" : "lib/tevent", - "pidl" : "pidl", - "pass" : ".", - "fail" : ".", - "retry" : "." + "ctdb": "ctdb", + "samba": ".", + "samba-nt4": ".", + "samba-fileserver": ".", + "samba-xc": ".", + "samba-o3": ".", + "samba-ctdb": ".", + "samba-libs": ".", + "samba-static": ".", + "samba-test-only": ".", + "samba-none-env": ".", + "samba-ad-dc": ".", + "samba-ad-dc-2": ".", + "samba-systemkrb5": ".", + "samba-nopython": ".", + "ldb": "lib/ldb", + "tdb": "lib/tdb", + "talloc": "lib/talloc", + "replace": "lib/replace", + "tevent": "lib/tevent", + "pidl": "pidl", + "pass": ".", + "fail": ".", + "retry": "." } defaulttasks = ["ctdb", @@ -91,7 +91,7 @@ else: extra_python = "--extra-python=/usr/bin/python3" tasks = { - "ctdb" : [("random-sleep", "../script/random-sleep.sh 60 600", "text/plain"), + "ctdb": [("random-sleep", "../script/random-sleep.sh 60 600", "text/plain"), ("configure", "./configure " + ctdb_configure_params, "text/plain"), ("make", "make all", "text/plain"), ("install", "make install", "text/plain"), @@ -100,7 +100,7 @@ tasks = { ("clean", "make clean", "text/plain")], # We have 'test' before 'install' because, 'test' should work without 'install (runs ad_dc_ntvfs and all the other envs)' - "samba" : [("configure", "./configure.developer --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"), + "samba": [("configure", "./configure.developer --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"), ("make", "make -j", "text/plain"), ("test", "make test FAIL_IMMEDIATELY=1 " "TESTS='--exclude-env=none " @@ -122,7 +122,7 @@ tasks = { ("clean", "make clean", "text/plain")], # We split out this so the isolated nt4_dc tests do not wait for ad_dc or ad_dc_ntvfs tests (which are long) - "samba-nt4" : [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), + "samba-nt4": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), ("configure", "./configure.developer --without-ads --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"), ("make", "make -j", "text/plain"), ("test", "make test FAIL_IMMEDIATELY=1 TESTS='--include-env=nt4_dc --include-env=nt4_member'", "text/plain"), @@ -131,14 +131,14 @@ tasks = { ("clean", "make clean", "text/plain")], # We split out this so the isolated ad_dc tests do not wait for ad_dc_ntvfs tests (which are long) - "samba-fileserver" : [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), + "samba-fileserver": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), ("configure", "./configure.developer --without-ad-dc --without-ldap --without-ads --without-json-audit --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"), ("make", "make -j", "text/plain"), ("test", "make test FAIL_IMMEDIATELY=1 TESTS='--include-env=fileserver'", "text/plain"), ("check-clean-tree", "script/clean-source-tree.sh", "text/plain")], # We split out this so the isolated ad_dc tests do not wait for ad_dc_ntvfs tests (which are long) - "samba-ad-dc" : [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), + "samba-ad-dc": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), ("configure", "./configure.developer --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"), ("make", "make -j", "text/plain"), ("test", "make test FAIL_IMMEDIATELY=1 TESTS='" @@ -151,18 +151,18 @@ tasks = { ("check-clean-tree", "script/clean-source-tree.sh", "text/plain")], # We split out this so the isolated ad_dc tests do not wait for ad_dc_ntvfs tests (which are long) - "samba-ad-dc-2" : [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), + "samba-ad-dc-2": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), ("configure", "./configure.developer --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"), ("make", "make -j", "text/plain"), ("test", "make test FAIL_IMMEDIATELY=1 TESTS='--include-env=chgdcpass --include-env=vampire_2000_dc --include-env=fl2000dc'", "text/plain"), ("check-clean-tree", "script/clean-source-tree.sh", "text/plain")], - "samba-test-only" : [("configure", "./configure.developer --with-selftest-prefix=./bin/ab --abi-check-disable" + samba_configure_params, "text/plain"), + "samba-test-only": [("configure", "./configure.developer --with-selftest-prefix=./bin/ab --abi-check-disable" + samba_configure_params, "text/plain"), ("make", "make -j", "text/plain"), ("test", 'make test FAIL_IMMEDIATELY=1 TESTS="${TESTS}"',"text/plain")], # Test cross-compile infrastructure - "samba-xc" : [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), + "samba-xc": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), ("configure-native", "./configure.developer --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"), ("configure-cross-execute", "./configure.developer -b ./bin-xe --cross-compile --cross-execute=script/identity_cc.sh" \ " --cross-answers=./bin-xe/cross-answers.txt --with-selftest-prefix=./bin-xe/ab" + samba_configure_params, "text/plain"), @@ -171,7 +171,7 @@ tasks = { ("compare-results", "script/compare_cc_results.py ./bin/c4che/default.cache.py ./bin-xe/c4che/default.cache.py ./bin-xa/c4che/default.cache.py", "text/plain")], # test build with -O3 -- catches extra warnings and bugs, tests the ad_dc environments - "samba-o3" : [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), + "samba-o3": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), ("configure", "ADDITIONAL_CFLAGS='-O3' ./configure.developer --with-selftest-prefix=./bin/ab --abi-check-disable" + samba_configure_params, "text/plain"), ("make", "make -j", "text/plain"), ("test", "make quicktest FAIL_IMMEDIATELY=1 TESTS='--include-env=ad_dc'", "text/plain"), @@ -179,7 +179,7 @@ tasks = { ("check-clean-tree", "script/clean-source-tree.sh", "text/plain"), ("clean", "make clean", "text/plain")], - "samba-ctdb" : [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), + "samba-ctdb": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), # make sure we have tdb around: ("tdb-configure", "cd lib/tdb && PYTHONPATH=${PYTHON_PREFIX}/site-packages:$PYTHONPATH PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${PREFIX_DIR}/lib/pkgconfig ./configure --bundled-libraries=NONE --abi-check --enable-debug -C ${PREFIX}", "text/plain"), @@ -362,7 +362,7 @@ tasks = { ("distcheck", "make distcheck", "text/plain"), ("clean", "make clean", "text/plain")], - "pidl" : [ + "pidl": [ ("random-sleep", "../script/random-sleep.sh 60 600", "text/plain"), ("configure", "perl Makefile.PL PREFIX=${PREFIX_DIR}", "text/plain"), ("touch", "touch *.yp", "text/plain"), @@ -374,8 +374,8 @@ tasks = { ("clean", "make clean", "text/plain")], # these are useful for debugging autobuild - 'pass' : [("pass", 'echo passing && /bin/true', "text/plain")], - 'fail' : [("fail", 'echo failing && /bin/false', "text/plain")] + 'pass': [("pass", 'echo passing && /bin/true', "text/plain")], + 'fail': [("fail", 'echo failing && /bin/false', "text/plain")] } def do_print(msg): diff --git a/script/generate_param.py b/script/generate_param.py index b610f6fb5e8..3ef40038774 100644 --- a/script/generate_param.py +++ b/script/generate_param.py @@ -98,7 +98,7 @@ def iterate_all(path): 'enumlist' : enumlist, 'handler' : handler, 'deprecated' : deprecated, - 'synonyms' : synonyms} + 'synonyms' : synonyms } # map doc attributes to a section of the generated function context_dict = {"G": "_GLOBAL", "S": "_LOCAL"} diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index 8a15daee04f..e50eb5c03b1 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -660,7 +660,7 @@ class BasicTests(samba.tests.TestCase): "dn": "cn=ldaptestobject," + self.base_dn, "objectclass": "ipProtocol", "ipProtocolNumber": "1", - "uid" : "0"}) + "uid": "0"}) self.fail() except LdbError as e29: (num, _) = e29.args @@ -1667,8 +1667,8 @@ objectGUID: bd3480c9-58af-4cd8-92df-bc4a18b6e44d self.ldb.add({ "dn": "cn=ldaptestcontainer," + self.base_dn, "objectclass": "container", - "uSNCreated" : "1", - "uSNChanged" : "1", + "uSNCreated": "1", + "uSNChanged": "1", "whenCreated": timestring(long(time.time())), "whenChanged": timestring(long(time.time()))}) @@ -2224,7 +2224,7 @@ servicePrincipalName: host/ldaptest2computer29 self.assertEquals(len(res_user), 1, "Could not find (&(cn=ldaptestUSer2)(objectClass=user))") # Check rename works with extended/alternate DN forms - ldb.rename("" , "cn=ldaptestUSER3,cn=users," + self.base_dn) + ldb.rename("", "cn=ldaptestUSER3,cn=users," + self.base_dn) # Testing ldb.search for (&(cn=ldaptestuser3)(objectClass=user)) res = ldb.search(expression="(&(cn=ldaptestuser3)(objectClass=user))") diff --git a/source4/dsdb/tests/python/sec_descriptor.py b/source4/dsdb/tests/python/sec_descriptor.py index 1b7c84e2c07..926c422a7e7 100755 --- a/source4/dsdb/tests/python/sec_descriptor.py +++ b/source4/dsdb/tests/python/sec_descriptor.py @@ -220,106 +220,106 @@ class OwnerGroupDescriptorTests(DescriptorTests): self.results = { # msDS-Behavior-Version < DS_DOMAIN_FUNCTION_2008 - "ds_behavior_win2003" : { - "100" : "O:EAG:DU", - "101" : "O:DAG:DU", - "102" : "O:%sG:DU", - "103" : "O:%sG:DU", - "104" : "O:DAG:DU", - "105" : "O:DAG:DU", - "106" : "O:DAG:DU", - "107" : "O:EAG:DU", - "108" : "O:DAG:DA", - "109" : "O:DAG:DA", - "110" : "O:%sG:DA", - "111" : "O:%sG:DA", - "112" : "O:DAG:DA", - "113" : "O:DAG:DA", - "114" : "O:DAG:DA", - "115" : "O:DAG:DA", - "130" : "O:EAG:DU", - "131" : "O:DAG:DU", - "132" : "O:SAG:DU", - "133" : "O:%sG:DU", - "134" : "O:EAG:DU", - "135" : "O:SAG:DU", - "136" : "O:SAG:DU", - "137" : "O:SAG:DU", - "138" : "O:DAG:DA", - "139" : "O:DAG:DA", - "140" : "O:%sG:DA", - "141" : "O:%sG:DA", - "142" : "O:DAG:DA", - "143" : "O:DAG:DA", - "144" : "O:DAG:DA", - "145" : "O:DAG:DA", - "160" : "O:EAG:DU", - "161" : "O:DAG:DU", - "162" : "O:%sG:DU", - "163" : "O:%sG:DU", - "164" : "O:EAG:DU", - "165" : "O:EAG:DU", - "166" : "O:DAG:DU", - "167" : "O:EAG:DU", - "168" : "O:DAG:DA", - "169" : "O:DAG:DA", - "170" : "O:%sG:DA", - "171" : "O:%sG:DA", - "172" : "O:DAG:DA", - "173" : "O:DAG:DA", - "174" : "O:DAG:DA", - "175" : "O:DAG:DA", + "ds_behavior_win2003": { + "100": "O:EAG:DU", + "101": "O:DAG:DU", + "102": "O:%sG:DU", + "103": "O:%sG:DU", + "104": "O:DAG:DU", + "105": "O:DAG:DU", + "106": "O:DAG:DU", + "107": "O:EAG:DU", + "108": "O:DAG:DA", + "109": "O:DAG:DA", + "110": "O:%sG:DA", + "111": "O:%sG:DA", + "112": "O:DAG:DA", + "113": "O:DAG:DA", + "114": "O:DAG:DA", + "115": "O:DAG:DA", + "130": "O:EAG:DU", + "131": "O:DAG:DU", + "132": "O:SAG:DU", + "133": "O:%sG:DU", + "134": "O:EAG:DU", + "135": "O:SAG:DU", + "136": "O:SAG:DU", + "137": "O:SAG:DU", + "138": "O:DAG:DA", + "139": "O:DAG:DA", + "140": "O:%sG:DA", + "141": "O:%sG:DA", + "142": "O:DAG:DA", + "143": "O:DAG:DA", + "144": "O:DAG:DA", + "145": "O:DAG:DA", + "160": "O:EAG:DU", + "161": "O:DAG:DU", + "162": "O:%sG:DU", + "163": "O:%sG:DU", + "164": "O:EAG:DU", + "165": "O:EAG:DU", + "166": "O:DAG:DU", + "167": "O:EAG:DU", + "168": "O:DAG:DA", + "169": "O:DAG:DA", + "170": "O:%sG:DA", + "171": "O:%sG:DA", + "172": "O:DAG:DA", + "173": "O:DAG:DA", + "174": "O:DAG:DA", + "175": "O:DAG:DA", }, # msDS-Behavior-Version >= DS_DOMAIN_FUNCTION_2008 - "ds_behavior_win2008" : { - "100" : "O:EAG:EA", - "101" : "O:DAG:DA", - "102" : "O:%sG:DU", - "103" : "O:%sG:DU", - "104" : "O:DAG:DA", - "105" : "O:DAG:DA", - "106" : "O:DAG:DA", - "107" : "O:EAG:EA", - "108" : "O:DAG:DA", - "109" : "O:DAG:DA", - "110" : "O:%sG:DA", - "111" : "O:%sG:DA", - "112" : "O:DAG:DA", - "113" : "O:DAG:DA", - "114" : "O:DAG:DA", - "115" : "O:DAG:DA", - "130" : "O:EAG:EA", - "131" : "O:DAG:DA", - "132" : "O:SAG:SA", - "133" : "O:%sG:DU", - "134" : "O:EAG:EA", - "135" : "O:SAG:SA", - "136" : "O:SAG:SA", - "137" : "O:SAG:SA", - "138" : "", - "139" : "", - "140" : "O:%sG:DA", - "141" : "O:%sG:DA", - "142" : "", - "143" : "", - "144" : "", - "145" : "", - "160" : "O:EAG:EA", - "161" : "O:DAG:DA", - "162" : "O:%sG:DU", - "163" : "O:%sG:DU", - "164" : "O:EAG:EA", - "165" : "O:EAG:EA", - "166" : "O:DAG:DA", - "167" : "O:EAG:EA", - "168" : "O:DAG:DA", - "169" : "O:DAG:DA", - "170" : "O:%sG:DA", - "171" : "O:%sG:DA", - "172" : "O:DAG:DA", - "173" : "O:DAG:DA", - "174" : "O:DAG:DA", - "175" : "O:DAG:DA", + "ds_behavior_win2008": { + "100": "O:EAG:EA", + "101": "O:DAG:DA", + "102": "O:%sG:DU", + "103": "O:%sG:DU", + "104": "O:DAG:DA", + "105": "O:DAG:DA", + "106": "O:DAG:DA", + "107": "O:EAG:EA", + "108": "O:DAG:DA", + "109": "O:DAG:DA", + "110": "O:%sG:DA", + "111": "O:%sG:DA", + "112": "O:DAG:DA", + "113": "O:DAG:DA", + "114": "O:DAG:DA", + "115": "O:DAG:DA", + "130": "O:EAG:EA", + "131": "O:DAG:DA", + "132": "O:SAG:SA", + "133": "O:%sG:DU", + "134": "O:EAG:EA", + "135": "O:SAG:SA", + "136": "O:SAG:SA", + "137": "O:SAG:SA", + "138": "", + "139": "", + "140": "O:%sG:DA", + "141": "O:%sG:DA", + "142": "", + "143": "", + "144": "", + "145": "", + "160": "O:EAG:EA", + "161": "O:DAG:DA", + "162": "O:%sG:DU", + "163": "O:%sG:DU", + "164": "O:EAG:EA", + "165": "O:EAG:EA", + "166": "O:DAG:DA", + "167": "O:EAG:EA", + "168": "O:DAG:DA", + "169": "O:DAG:DA", + "170": "O:%sG:DA", + "171": "O:%sG:DA", + "172": "O:DAG:DA", + "173": "O:DAG:DA", + "174": "O:DAG:DA", + "175": "O:DAG:DA", }, } # Discover 'domainControllerFunctionality' diff --git a/source4/lib/wmi/wmi.py b/source4/lib/wmi/wmi.py index ff7170eb586..c552c06ad57 100644 --- a/source4/lib/wmi/wmi.py +++ b/source4/lib/wmi/wmi.py @@ -42,7 +42,7 @@ try: _object = types.ObjectType _newclass = 1 except AttributeError: - class _object : pass + class _object: pass _newclass = 0 del types diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index 08116d5d3ef..4efcf77e590 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -1120,11 +1120,11 @@ for env in ['vampire_dc', 'promoted_dc', 'rodc']: for env in ["ad_dc_ntvfs", "ad_dc", "fl2000dc", "fl2003dc", "fl2008r2dc", 'vampire_dc', 'promoted_dc', 'backupfromdc', 'restoredc', 'renamedc', 'offlinebackupdc', 'labdc']: - plantestsuite("samba4.blackbox.dbcheck(%s)" % env, env + ":local" , ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck.sh"), '$PREFIX/provision', configuration]) + plantestsuite("samba4.blackbox.dbcheck(%s)" % env, env + ":local", ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck.sh"), '$PREFIX/provision', configuration]) # cmocka tests not requiring a specific environment # -plantestsuite("samba4.dsdb.samdb.ldb_modules.unique_object_sids" , "none", +plantestsuite("samba4.dsdb.samdb.ldb_modules.unique_object_sids", "none", [os.path.join(bindir(), "test_unique_object_sids")]) plantestsuite("samba4.dsdb.samdb.ldb_modules.encrypted_secrets", "none", [os.path.join(bindir(), "test_encrypted_secrets")]) diff --git a/source4/torture/drs/python/cracknames.py b/source4/torture/drs/python/cracknames.py index 9bf90f9c997..092f2046654 100644 --- a/source4/torture/drs/python/cracknames.py +++ b/source4/torture/drs/python/cracknames.py @@ -39,10 +39,10 @@ class DrsCracknamesTestCase(drs_base.DrsBaseTestCase): self.user_record = { "dn": self.user, "objectclass": "user", - "sAMAccountName" : self.username, - "userPrincipalName" : "test@test.com", - "servicePrincipalName" : "test/%s" % self.ldb_dc1.get_default_basedn(), - "displayName" : "test"} + "sAMAccountName": self.username, + "userPrincipalName": "test@test.com", + "servicePrincipalName": "test/%s" % self.ldb_dc1.get_default_basedn(), + "displayName": "test"} self.ldb_dc1.add(self.user_record) self.ldb_dc1.delete(self.user_record["dn"]) @@ -121,11 +121,11 @@ class DrsCracknamesTestCase(drs_base.DrsBaseTestCase): user_record = { "dn": user, "objectclass": "user", - "sAMAccountName" : username, - "userPrincipalName" : "test2@test.com", - "servicePrincipalName" : ["test2/%s" % self.ldb_dc1.get_default_basedn(), + "sAMAccountName": username, + "userPrincipalName": "test2@test.com", + "servicePrincipalName": ["test2/%s" % self.ldb_dc1.get_default_basedn(), "test3/%s" % self.ldb_dc1.get_default_basedn()], - "displayName" : "test2"} + "displayName": "test2"} self.ldb_dc1.add(user_record)