From: Joe Guo Date: Mon, 30 Jul 2018 06:21:29 +0000 (+1200) Subject: PEP8: fix E305: expected 2 blank lines after class or function definition, found 1 X-Git-Tag: tdb-1.3.17~2055 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=115f2a71b883567dcf324da5cd02cfc3c86431b4;p=thirdparty%2Fsamba.git PEP8: fix E305: expected 2 blank lines after class or function definition, found 1 Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/auth/credentials/tests/bind.py b/auth/credentials/tests/bind.py index c5f79211185..7e0e19fbff8 100755 --- a/auth/credentials/tests/bind.py +++ b/auth/credentials/tests/bind.py @@ -165,4 +165,5 @@ unicodePwd:: """ + base64.b64encode(u"\"P@ssw0rd\"".encode('utf-16-le')).decode( res = ldb_user4.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"]) + TestProgram(module=__name__, opts=subunitopts) diff --git a/lib/ldb-samba/tests/match_rules.py b/lib/ldb-samba/tests/match_rules.py index 58658a0a9ea..aaa9675c196 100755 --- a/lib/ldb-samba/tests/match_rules.py +++ b/lib/ldb-samba/tests/match_rules.py @@ -1752,6 +1752,7 @@ class MatchRuleConditionTests(samba.tests.TestCase): self.ou_groups, self.ou_computers)) self.assertEqual(len(res1), 0) + parser = optparse.OptionParser("match_rules.py [options] ") sambaopts = options.SambaOptions(parser) parser.add_option_group(sambaopts) diff --git a/lib/ldb/_ldb_text.py b/lib/ldb/_ldb_text.py index f6f1ac06fa7..65d603bf2de 100644 --- a/lib/ldb/_ldb_text.py +++ b/lib/ldb/_ldb_text.py @@ -92,6 +92,7 @@ class MessageElementTextWrapper(_WrapBase): def set_flags(self): return self._wrapped.set_flags + _wrap_element = MessageElementTextWrapper._wrap diff --git a/lib/ldb/tests/python/index.py b/lib/ldb/tests/python/index.py index 72b99551a9b..5d0b7527e5b 100755 --- a/lib/ldb/tests/python/index.py +++ b/lib/ldb/tests/python/index.py @@ -1324,6 +1324,7 @@ class RejectSubDBIndex(LdbBaseTest): self.assertEqual(ldb.ERR_OPERATIONS_ERROR, code) self.assertIn("sub-database index", string) + if __name__ == '__main__': import unittest unittest.TestProgram() diff --git a/lib/tevent/bindings.py b/lib/tevent/bindings.py index 6bea4771b9b..28e404dac4e 100644 --- a/lib/tevent/bindings.py +++ b/lib/tevent/bindings.py @@ -109,5 +109,6 @@ class ContextTests(TestCase): self.ctx.loop_once() self.assertEqual(collecting_list, [1, 2]) + if __name__ == '__main__': TestProgram() diff --git a/python/examples/samr.py b/python/examples/samr.py index 521ea641610..c1af82105aa 100755 --- a/python/examples/samr.py +++ b/python/examples/samr.py @@ -106,6 +106,7 @@ def test_EnumDomains(samr, handle): test_domain_ops(samr, dom_handle) samr.Close(dom_handle) + if len(sys.argv) != 2: print "Usage: samr.js " sys.exit(1) diff --git a/python/examples/winreg.py b/python/examples/winreg.py index e419320b16f..eff9f5a6dc8 100755 --- a/python/examples/winreg.py +++ b/python/examples/winreg.py @@ -69,6 +69,7 @@ def list_path(key, path): list_values(subkey) return count + if len(args) > 1: root = args[1] else: diff --git a/python/samba/__init__.py b/python/samba/__init__.py index 90f85851256..c95b2fe3e26 100644 --- a/python/samba/__init__.py +++ b/python/samba/__init__.py @@ -304,6 +304,7 @@ def setup_file(template, fname, subst_vars=None): finally: f.close() + MAX_NETBIOS_NAME_LEN = 15 @@ -384,6 +385,7 @@ def arcfour_encrypt(key, data): from samba.crypto import arcfour_crypt_blob return arcfour_crypt_blob(data, key) + version = _glue.version interface_ips = _glue.interface_ips fault_setup = _glue.fault_setup diff --git a/python/samba/gpclass.py b/python/samba/gpclass.py index 751d0ad4aae..a5e611fc0e5 100644 --- a/python/samba/gpclass.py +++ b/python/samba/gpclass.py @@ -402,6 +402,7 @@ class gp_inf_ext(gp_ext): def __str__(self): pass + ''' Fetch the hostname of a writable DC ''' @@ -411,6 +412,7 @@ def get_dc_hostname(creds, lp): nbt.NBT_SERVER_DS)) return cldap_ret.pdc_dns_name + ''' Fetch a list of GUIDs for applicable GPOs ''' diff --git a/python/samba/kcc/debug.py b/python/samba/kcc/debug.py index 24c70d0de3a..8a69bde43a7 100644 --- a/python/samba/kcc/debug.py +++ b/python/samba/kcc/debug.py @@ -43,6 +43,7 @@ from samba.colour import GREY, WHITE def _color_debug(*args, **kwargs): DEBUG('%s%s%s' % (kwargs['color'], args[0], C_NORMAL), *args[1:]) + _globals = globals() for _color in ('DARK_RED', 'RED', 'DARK_GREEN', 'GREEN', 'YELLOW', 'DARK_YELLOW', 'DARK_BLUE', 'BLUE', 'PURPLE', 'MAGENTA', diff --git a/python/samba/kcc/kcc_utils.py b/python/samba/kcc/kcc_utils.py index b19cc109c51..a1dda6b5e02 100644 --- a/python/samba/kcc/kcc_utils.py +++ b/python/samba/kcc/kcc_utils.py @@ -41,6 +41,7 @@ class KCCError(Exception): class NCType(object): (unknown, schema, domain, config, application) = range(0, 5) + # map the NCType enum to strings for debugging nctype_lut = dict((v, k) for k, v in NCType.__dict__.items() if k[:2] != '__') diff --git a/python/samba/ms_display_specifiers.py b/python/samba/ms_display_specifiers.py index 0eeeb88dc87..fd125806ca1 100644 --- a/python/samba/ms_display_specifiers.py +++ b/python/samba/ms_display_specifiers.py @@ -54,6 +54,7 @@ def __read_folded_line(f, buffer): return (line, buffer) + # Only compile regexp once. # Will not match options after the attribute type. attr_type_re = re.compile("^([A-Za-z][A-Za-z0-9-]*):") @@ -181,6 +182,7 @@ def read_ms_ldif(filename): return "\n\n".join(out) + "\n\n" + if __name__ == '__main__': import sys diff --git a/python/samba/ms_forest_updates_markdown.py b/python/samba/ms_forest_updates_markdown.py index bd992474967..3afe2ecb838 100644 --- a/python/samba/ms_forest_updates_markdown.py +++ b/python/samba/ms_forest_updates_markdown.py @@ -259,6 +259,7 @@ def read_ms_markdown(in_file, out_folder=None, out_dict={}): # print ET.tostring(node, method='text') + if __name__ == '__main__': import sys diff --git a/python/samba/ms_schema.py b/python/samba/ms_schema.py index 7310eafe61a..52abe74057a 100644 --- a/python/samba/ms_schema.py +++ b/python/samba/ms_schema.py @@ -315,6 +315,7 @@ def read_ms_schema(attr_file, classes_file, dump_attributes=True, dump_classes=T return attr_ldif + "\n\n" + classes_ldif + "\n\n" + if __name__ == '__main__': import sys diff --git a/python/samba/ms_schema_markdown.py b/python/samba/ms_schema_markdown.py index 5283e24d858..ff1afb1a588 100644 --- a/python/samba/ms_schema_markdown.py +++ b/python/samba/ms_schema_markdown.py @@ -58,6 +58,7 @@ def read_ms_markdown(in_file, out_folder): if ldf is not None: ldf.close() + if __name__ == '__main__': import sys diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index 87536526cca..84ed5a51111 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -156,6 +156,7 @@ def get_testparm_var(testparm, smbconf, varname): return lines[0].strip() return "" + try: import samba.dckeytab except ImportError: diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index 5f90807e367..a7b3b988652 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -158,6 +158,7 @@ def get_rounds(options): return 0 return 0 + try: random_reason = check_random() if random_reason is not None: diff --git a/python/samba/tests/dcerpc/raw_protocol.py b/python/samba/tests/dcerpc/raw_protocol.py index 6cc6718ba4b..e7576994f72 100755 --- a/python/samba/tests/dcerpc/raw_protocol.py +++ b/python/samba/tests/dcerpc/raw_protocol.py @@ -4980,6 +4980,7 @@ class TestDCERPC_BIND(RawDCERPCTest): conn2.do_single_request(call_id=1, ctx=ctx2, io=inq_if_ids) return + if __name__ == "__main__": global_ndr_print = True global_hexdump = True diff --git a/python/samba/tests/dcerpc/testrpc.py b/python/samba/tests/dcerpc/testrpc.py index 1560df647c3..045a8cfade9 100644 --- a/python/samba/tests/dcerpc/testrpc.py +++ b/python/samba/tests/dcerpc/testrpc.py @@ -134,6 +134,7 @@ class RpcTests(object): self.check_all_interfaces() return self.errcount + tests = RpcTests() errcount = tests.run() if errcount == 0: diff --git a/python/samba/tests/dns.py b/python/samba/tests/dns.py index 78768ce3ef0..50486f0591b 100644 --- a/python/samba/tests/dns.py +++ b/python/samba/tests/dns.py @@ -1909,4 +1909,5 @@ class TestRPCRoundtrip(DNSTest): None, add_rec_buf) + TestProgram(module=__name__, opts=subunitopts) diff --git a/python/samba/tests/dns_forwarder.py b/python/samba/tests/dns_forwarder.py index 5c7a70e7051..6d8efa5edd3 100644 --- a/python/samba/tests/dns_forwarder.py +++ b/python/samba/tests/dns_forwarder.py @@ -603,4 +603,5 @@ class TestDnsForwarding(DNSTest): except socket.timeout: self.fail("DNS server is too slow (timeout %s)" % timeout) + TestProgram(module=__name__, opts=subunitopts) diff --git a/python/samba/tests/dns_forwarder_helpers/server.py b/python/samba/tests/dns_forwarder_helpers/server.py index 4d6e57d325d..a300f0fc823 100644 --- a/python/samba/tests/dns_forwarder_helpers/server.py +++ b/python/samba/tests/dns_forwarder_helpers/server.py @@ -36,6 +36,7 @@ def debug(msg): print("\033[00;36m%s\033[00m" % msg) sys.stdout.flush() + timeout = 0 @@ -93,4 +94,5 @@ def main(): server = SocketServer.UDPServer((host, int(port)), DnsHandler) server.serve_forever() + main() diff --git a/python/samba/tests/dns_tkey.py b/python/samba/tests/dns_tkey.py index 4afa7fefba5..fff433eb600 100644 --- a/python/samba/tests/dns_tkey.py +++ b/python/samba/tests/dns_tkey.py @@ -211,4 +211,5 @@ class TestDNSUpdates(DNSTKeyTest): rcode = self.search_record(self.newrecname) self.assert_rcode_equals(rcode, dns.DNS_RCODE_NXDOMAIN) + TestProgram(module=__name__, opts=subunitopts) diff --git a/python/samba/tests/libsmb_samba_internal.py b/python/samba/tests/libsmb_samba_internal.py index ec277230d81..c88095c8bc2 100644 --- a/python/samba/tests/libsmb_samba_internal.py +++ b/python/samba/tests/libsmb_samba_internal.py @@ -75,6 +75,7 @@ class LibsmbTestCase(samba.tests.TestCase): if t.exc: raise t.exc[0](t.exc[1]) + if __name__ == "__main__": import unittest unittest.main() diff --git a/python/samba/tests/samba_tool/visualize.py b/python/samba/tests/samba_tool/visualize.py index abb6c49b3ad..bc1c91c9b56 100644 --- a/python/samba/tests/samba_tool/visualize.py +++ b/python/samba/tests/samba_tool/visualize.py @@ -403,6 +403,7 @@ class SambaToolVisualizeLdif(SambaToolCmdTest): self.remove_files(dbfile, dot_file) + EXPECTED_DOT_MULTISITE_NO_KEY = r"""/* generated by samba */ digraph A_samba_tool_production { label="NTDS Connections known to CN=WIN01,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=samba,DC=example,DC=com"; diff --git a/python/samba/tests/upgradeprovisionneeddc.py b/python/samba/tests/upgradeprovisionneeddc.py index c4d3604d98b..c6d4de3af6e 100644 --- a/python/samba/tests/upgradeprovisionneeddc.py +++ b/python/samba/tests/upgradeprovisionneeddc.py @@ -40,6 +40,7 @@ import ldb def dummymessage(a=None, b=None): pass + smb_conf_path = "%s/%s/%s" % (os.environ["SELFTEST_PREFIX"], "ad_dc_ntvfs", "etc/smb.conf") diff --git a/script/autobuild.py b/script/autobuild.py index fb08af47ec0..4f895e97f3a 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -685,6 +685,7 @@ def push_to(push_url, push_branch="master"): (push_remote, push_branch), show=True, dir=test_master) + def_testbase = os.getenv("AUTOBUILD_TESTBASE", "/memdisk/%s" % os.getenv('USER')) gitroot = find_git_root() diff --git a/script/bisect-test.py b/script/bisect-test.py index 84496fe253a..cdfc93bdb8a 100755 --- a/script/bisect-test.py +++ b/script/bisect-test.py @@ -51,6 +51,7 @@ def find_git_root(): p = os.path.abspath(os.path.join(p, '..')) return None + cwd = os.getcwd() gitroot = find_git_root() @@ -79,6 +80,7 @@ def cleanup(): os.unlink(f.name) sys.exit(-1) + # run bisect ret = -1 try: diff --git a/script/generate_param.py b/script/generate_param.py index 34930494ba3..c9f18b1cdd1 100644 --- a/script/generate_param.py +++ b/script/generate_param.py @@ -101,6 +101,7 @@ def iterate_all(path): 'deprecated' : deprecated, 'synonyms' : synonyms } + # map doc attributes to a section of the generated function context_dict = {"G": "_GLOBAL", "S": "_LOCAL"} param_type_dict = { @@ -148,6 +149,7 @@ def generate_functions(path_in, path_out): finally: f.close() + mapping = { 'boolean' : 'bool ', 'string' : 'char *', @@ -313,6 +315,7 @@ def make_param_defs(path_in, path_out, scope): finally: file_out.close() + type_dict = { "boolean" : "P_BOOL", "boolean-rev" : "P_BOOLREV", @@ -400,6 +403,7 @@ def make_param_table(path_in, path_out): finally: file_out.close() + if options.mode == 'FUNCTIONS': generate_functions(options.filename, options.output) elif options.mode == 'S3PROTO': diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py index 490bc64ebda..a393b70cc90 100644 --- a/selftest/selftesthelpers.py +++ b/selftest/selftesthelpers.py @@ -43,6 +43,7 @@ def bindir(): def binpath(name): return os.path.join(bindir(), name) + # Split perl variable to allow $PERL to be set to e.g. "perl -W" perl = os.getenv("PERL", "perl").split() diff --git a/source3/script/tests/test_wbinfo_sids2xids_int.py b/source3/script/tests/test_wbinfo_sids2xids_int.py index f0f51429273..6c2b552f62c 100755 --- a/source3/script/tests/test_wbinfo_sids2xids_int.py +++ b/source3/script/tests/test_wbinfo_sids2xids_int.py @@ -28,6 +28,7 @@ def fill_cache(inids, idtype='gid'): subprocess.Popen([wbinfo, '--%s-to-sid=%s' % (idtype, inid)], stdout=subprocess.PIPE).communicate() + domain = subprocess.Popen([wbinfo, "--own-domain"], stdout=subprocess.PIPE).communicate()[0].strip() domsid = subprocess.Popen([wbinfo, "-n", domain + "/"], @@ -106,6 +107,7 @@ def check_multiple(sids, idtypes): sys.exit(1) i += 1 + # first round: with filled cache via sid-to-id check_singular(sids, gids, 'gid') check_singular(sids, uids, 'uid') diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 34a2f31246b..2a05212103a 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -37,6 +37,7 @@ def plansmbtorture4testsuite(name, env, options, description=''): selftesthelpers.plansmbtorture4testsuite( name, env, options, target='samba3', modname=modname) + # find config.h try: config_h = os.environ["CONFIG_H"] diff --git a/source3/torture/test_ntlm_auth.py b/source3/torture/test_ntlm_auth.py index d133527aa28..28b83f8cde7 100755 --- a/source3/torture/test_ntlm_auth.py +++ b/source3/torture/test_ntlm_auth.py @@ -331,6 +331,7 @@ def main(): os.waitpid(client_pid, 0) sys.exit(0) + if __name__ == "__main__": main() diff --git a/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py b/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py index 9e72a8358a7..0dffddeeb36 100755 --- a/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py +++ b/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py @@ -254,6 +254,7 @@ def get_object_classes(db): list.append(item) return list + classinfo = pull_classinfo(db) if objectclass is None: diff --git a/source4/dsdb/tests/python/ad_dc_search_performance.py b/source4/dsdb/tests/python/ad_dc_search_performance.py index 335ba9ba77f..905572a2d3f 100644 --- a/source4/dsdb/tests/python/ad_dc_search_performance.py +++ b/source4/dsdb/tests/python/ad_dc_search_performance.py @@ -283,6 +283,7 @@ class UserTests(samba.tests.TestCase): def test_03_13_member_search_linked_users(self): self._test_member_search(rounds=2) + if "://" not in host: if os.path.isfile(host): host = "tdb://%s" % host diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index 5c243af100c..b2ef01b9420 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -3270,6 +3270,7 @@ class BaseDnTests(samba.tests.TestCase): expected = "%s:%s$@%s" % (dns_domainname.lower(), hostname.lower(), dns_domainname.upper()) self.assertEquals(given, expected) + if not "://" in host: if os.path.isfile(host): host = "tdb://%s" % host diff --git a/source4/dsdb/tests/python/ldap_schema.py b/source4/dsdb/tests/python/ldap_schema.py index 2ce7b79441d..9a4003ae612 100755 --- a/source4/dsdb/tests/python/ldap_schema.py +++ b/source4/dsdb/tests/python/ldap_schema.py @@ -1645,6 +1645,7 @@ class SchemaTests_msDS_isRODC(samba.tests.TestCase): else: self.assertTrue("msDS-isRODC" in ldb_msg) + if not "://" in host: if os.path.isfile(host): host = "tdb://%s" % host diff --git a/source4/dsdb/tests/python/ldap_syntaxes.py b/source4/dsdb/tests/python/ldap_syntaxes.py index 932d3d8d00c..9af3ee45444 100755 --- a/source4/dsdb/tests/python/ldap_syntaxes.py +++ b/source4/dsdb/tests/python/ldap_syntaxes.py @@ -384,4 +384,5 @@ name: """ + object_name + """ (num, _) = e14.args self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) + TestProgram(module=__name__, opts=subunitopts) diff --git a/source4/dsdb/tests/python/linked_attributes.py b/source4/dsdb/tests/python/linked_attributes.py index f297ac9c16b..ee96278bfe6 100644 --- a/source4/dsdb/tests/python/linked_attributes.py +++ b/source4/dsdb/tests/python/linked_attributes.py @@ -720,6 +720,7 @@ class LATests(samba.tests.TestCase): self.assert_forward_links(e1, [], attr='addressBookRoots2', show_deactivated_link=0) + if "://" not in host: if os.path.isfile(host): host = "tdb://%s" % host diff --git a/source4/dsdb/tests/python/login_basics.py b/source4/dsdb/tests/python/login_basics.py index d1627881fa6..39406fc36a2 100755 --- a/source4/dsdb/tests/python/login_basics.py +++ b/source4/dsdb/tests/python/login_basics.py @@ -179,6 +179,7 @@ userPassword: %s def test_login_basics_ntlm(self): self._test_login_basics(self.lockout1ntlm_creds) + host_url = "ldap://%s" % host TestProgram(module=__name__, opts=subunitopts) diff --git a/source4/dsdb/tests/python/ndr_pack_performance.py b/source4/dsdb/tests/python/ndr_pack_performance.py index 0ae9f825d2a..935bcb6f345 100644 --- a/source4/dsdb/tests/python/ndr_pack_performance.py +++ b/source4/dsdb/tests/python/ndr_pack_performance.py @@ -212,6 +212,7 @@ class UserTests(samba.tests.TestCase): desc = ndr_unpack(drsuapi.DsGetNCChangesCtr6, blob) self._test_pack(desc, cycles=20) + if "://" not in host: if os.path.isfile(host): host = "tdb://%s" % host diff --git a/source4/dsdb/tests/python/notification.py b/source4/dsdb/tests/python/notification.py index 20fe7c5d8a3..bb3280aaece 100755 --- a/source4/dsdb/tests/python/notification.py +++ b/source4/dsdb/tests/python/notification.py @@ -364,6 +364,7 @@ delete: otherLoginWorkstations print("va[%s]" % va) self.assertEquals(num, ERR_UNWILLING_TO_PERFORM) + if not "://" in url: if os.path.isfile(url): url = "tdb://%s" % url diff --git a/source4/dsdb/tests/python/password_lockout.py b/source4/dsdb/tests/python/password_lockout.py index d60e55f6358..9197d9aa266 100755 --- a/source4/dsdb/tests/python/password_lockout.py +++ b/source4/dsdb/tests/python/password_lockout.py @@ -1357,6 +1357,7 @@ userPassword: """ + userpass + """ self._test_samr_password_change(self.lockout1ntlm_creds, other_creds=self.lockout2ntlm_creds) + host_url = "ldap://%s" % host TestProgram(module=__name__, opts=subunitopts) diff --git a/source4/dsdb/tests/python/passwords.py b/source4/dsdb/tests/python/passwords.py index 0509612ff95..44b04943027 100755 --- a/source4/dsdb/tests/python/passwords.py +++ b/source4/dsdb/tests/python/passwords.py @@ -1133,6 +1133,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')). # Close the second LDB connection (with the user credentials) self.ldb2 = None + if not "://" in host: if os.path.isfile(host): host = "tdb://%s" % host diff --git a/source4/dsdb/tests/python/rodc.py b/source4/dsdb/tests/python/rodc.py index 790259ce5a9..ec2c55d7957 100755 --- a/source4/dsdb/tests/python/rodc.py +++ b/source4/dsdb/tests/python/rodc.py @@ -255,4 +255,5 @@ def main(): TestProgram(module=__name__, opts=subunitopts) + main() diff --git a/source4/dsdb/tests/python/rodc_rwdc.py b/source4/dsdb/tests/python/rodc_rwdc.py index 20d4df69929..e4b3c583452 100644 --- a/source4/dsdb/tests/python/rodc_rwdc.py +++ b/source4/dsdb/tests/python/rodc_rwdc.py @@ -1296,4 +1296,5 @@ def main(): finally: set_auto_replication(RWDC, True) + main() diff --git a/source4/dsdb/tests/python/sec_descriptor.py b/source4/dsdb/tests/python/sec_descriptor.py index ca1c616b168..3fc99f73762 100755 --- a/source4/dsdb/tests/python/sec_descriptor.py +++ b/source4/dsdb/tests/python/sec_descriptor.py @@ -2145,6 +2145,7 @@ class SdAutoInheritTests(DescriptorTests): sub_usn2 = int(sub_res2[0]["uSNChanged"][0]) self.assertTrue(sub_usn2 == sub_usn0) + if not "://" in host: if os.path.isfile(host): host = "tdb://%s" % host diff --git a/source4/dsdb/tests/python/sort.py b/source4/dsdb/tests/python/sort.py index 6eef4c03689..b89a8c67dc0 100644 --- a/source4/dsdb/tests/python/sort.py +++ b/source4/dsdb/tests/python/sort.py @@ -50,6 +50,7 @@ def norm(x): x = x.decode('utf-8') return normalize('NFKC', x).upper().encode('utf-8') + # Python, Windows, and Samba all sort the following sequence in # drastically different ways. The order here is what you get from # Windows2012R2. diff --git a/source4/dsdb/tests/python/token_group.py b/source4/dsdb/tests/python/token_group.py index 826deb01a06..9769d2c03da 100755 --- a/source4/dsdb/tests/python/token_group.py +++ b/source4/dsdb/tests/python/token_group.py @@ -648,6 +648,7 @@ class DynamicTokenTest(samba.tests.TestCase): self.assertEqual(len(rids.rids), 1) self.assertEqual(rids.rids[0].rid, user_info.primary_gid) + if not "://" in url: if os.path.isfile(url): url = "tdb://%s" % url diff --git a/source4/lib/wmi/wmi.py b/source4/lib/wmi/wmi.py index 9d1871f5288..f227e399e16 100644 --- a/source4/lib/wmi/wmi.py +++ b/source4/lib/wmi/wmi.py @@ -42,6 +42,7 @@ def _swig_repr(self): except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + import types try: _object = types.ObjectType @@ -72,6 +73,8 @@ class IUnknown(object): def __init__(self, *args, **kwargs): _wmi.IUnknown_swiginit(self, _wmi.new_IUnknown(*args, **kwargs)) __swig_destroy__ = _wmi.delete_IUnknown + + IUnknown.Release = new_instancemethod(_wmi.IUnknown_Release, None, IUnknown) IUnknown_swigregister = _wmi.IUnknown_swigregister IUnknown_swigregister(IUnknown) @@ -84,6 +87,8 @@ class IWbemServices(object): def __init__(self, *args, **kwargs): _wmi.IWbemServices_swiginit(self, _wmi.new_IWbemServices(*args, **kwargs)) __swig_destroy__ = _wmi.delete_IWbemServices + + IWbemServices.ExecQuery = new_instancemethod(_wmi.IWbemServices_ExecQuery, None, IWbemServices) IWbemServices.ExecNotificationQuery = new_instancemethod(_wmi.IWbemServices_ExecNotificationQuery, None, IWbemServices) IWbemServices.CreateInstanceEnum = new_instancemethod(_wmi.IWbemServices_CreateInstanceEnum, None, IWbemServices) @@ -98,6 +103,8 @@ class IEnumWbemClassObject(object): def __init__(self, *args, **kwargs): _wmi.IEnumWbemClassObject_swiginit(self, _wmi.new_IEnumWbemClassObject(*args, **kwargs)) __swig_destroy__ = _wmi.delete_IEnumWbemClassObject + + IEnumWbemClassObject.Reset = new_instancemethod(_wmi.IEnumWbemClassObject_Reset, None, IEnumWbemClassObject) IEnumWbemClassObject_swigregister = _wmi.IEnumWbemClassObject_swigregister IEnumWbemClassObject_swigregister(IEnumWbemClassObject) diff --git a/source4/script/depfilter.py b/source4/script/depfilter.py index e4f0d0aba44..5af26a6eb00 100755 --- a/source4/script/depfilter.py +++ b/source4/script/depfilter.py @@ -39,6 +39,7 @@ def add_deps(node): for n in graph[node]: add_deps(n) + add_deps(top) # Generate output diff --git a/source4/scripting/devel/demodirsync.py b/source4/scripting/devel/demodirsync.py index 8f1e7d7c451..67e361b1eb0 100755 --- a/source4/scripting/devel/demodirsync.py +++ b/source4/scripting/devel/demodirsync.py @@ -42,6 +42,7 @@ def printdirsync(ctl): 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) tab = [] if opts.b: diff --git a/source4/scripting/devel/pfm_verify.py b/source4/scripting/devel/pfm_verify.py index 53f61dec67a..95288df56d3 100755 --- a/source4/scripting/devel/pfm_verify.py +++ b/source4/scripting/devel/pfm_verify.py @@ -146,6 +146,7 @@ def _pfm_schi_verify(drs_schi, ldb_schi): % (drs_schi.invocation_id, ldb_schi.invocation_id)) return errors + ########### main code ########### if __name__ == "__main__": # command line parsing diff --git a/source4/scripting/devel/repl_cleartext_pwd.py b/source4/scripting/devel/repl_cleartext_pwd.py index a31c1287a71..4141cee1381 100755 --- a/source4/scripting/devel/repl_cleartext_pwd.py +++ b/source4/scripting/devel/repl_cleartext_pwd.py @@ -77,6 +77,7 @@ class globals: def attid_equal(a1, a2): return (a1 & 0xffffffff) == (a2 & 0xffffffff) + ########### main code ########### if __name__ == "__main__": parser = OptionParser("repl_cleartext_pwd.py [options] server dn cookie_file clear_utf8_name [attid attname attmode] [clear_utf16_name") diff --git a/source4/scripting/devel/speedtest.py b/source4/scripting/devel/speedtest.py index 581529047cd..969edb08192 100755 --- a/source4/scripting/devel/speedtest.py +++ b/source4/scripting/devel/speedtest.py @@ -226,6 +226,7 @@ class AclSearchSpeedTest(SpeedTest): # Important unit running information + if not "://" in host: host = "ldap://%s" % host diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index 1fac4073f02..ca2f358989c 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -31,6 +31,7 @@ def plansmbtorture4testsuite(name, env, options, modname=None): return selftesthelpers.plansmbtorture4testsuite(name, env, options, target='samba4', modname=modname) + samba4srcdir = source4dir() samba4bindir = bindir() validate = os.getenv("VALIDATE", "")