From 3395c3162ace12663dfeb8a12bf76960bd74e688 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Fri, 10 Mar 2017 11:14:48 +1300 Subject: [PATCH 01/13] perftests/ad_dc_search: do less work in expensive member searches Signed-off-by: Douglas Bagnall --- source4/dsdb/tests/python/ad_dc_search_performance.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source4/dsdb/tests/python/ad_dc_search_performance.py b/source4/dsdb/tests/python/ad_dc_search_performance.py index ec4a02f..151fb69 100644 --- a/source4/dsdb/tests/python/ad_dc_search_performance.py +++ b/source4/dsdb/tests/python/ad_dc_search_performance.py @@ -202,7 +202,7 @@ class UserTests(samba.tests.TestCase): scope=SCOPE_SUBTREE, attrs=['cn']) - def _test_member_search(self): + def _test_member_search(self, rounds=10): expressions = [] for d in range(50): expressions.append('(member=cn=u%d,%s)' % (d + 500, self.ou_users)) @@ -214,7 +214,7 @@ class UserTests(samba.tests.TestCase): for expression in expressions: t = time.time() - for i in range(10): + for i in range(rounds): self.ldb.search(self.ou, expression=expression, scope=SCOPE_SUBTREE, @@ -266,7 +266,8 @@ class UserTests(samba.tests.TestCase): test_01_10_complex_search_3k_users = _test_complex_search test_01_11_unindexed_search_3k_users = _test_unindexed_search test_01_12_indexed_search_3k_users = _test_indexed_search - test_01_13_member_search_3k_users = _test_member_search + def test_01_13_member_search_3k_users(self): + self._test_member_search(rounds=5) test_02_01_link_users_1000 = _test_link_many_users test_02_02_link_users_2000 = _test_link_many_users @@ -275,7 +276,8 @@ class UserTests(samba.tests.TestCase): test_03_10_complex_search_linked_users = _test_complex_search test_03_11_unindexed_search_linked_users = _test_unindexed_search test_03_12_indexed_search_linked_users = _test_indexed_search - test_03_12_member_search_linked_users = _test_member_search + def test_03_13_member_search_linked_users(self): + self._test_member_search(rounds=2) if "://" not in host: if os.path.isfile(host): -- 2.7.4 From 7b6e790d499d3c57d80d7d1588659dde2d6eb404 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 8 Mar 2017 17:04:55 +1300 Subject: [PATCH 02/13] gitignore: add some hidden files .gdb_history is generated by gdb, .emacs* are generated by emacs, and .clang* by clang. Signed-off-by: Douglas Bagnall --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 46c01af..1a43d43 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,6 @@ semantic.cache .testrepository /bin/.confcache/*/* /bin/.conf_check_*/* +/.emacs.desktop* +/.gdb_history +.clang-format -- 2.7.4 From 0b75d6d1b820db810c18fa03388251524f2298b3 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 14:47:50 +1300 Subject: [PATCH 03/13] selftest: remove unused broken client.py Nothing uses this, and pyflakes points out it is unusable: ./selftest/client.py:60: undefined name 'prefix_abs' ./selftest/client.py:69: undefined name 'opts' ./selftest/client.py:70: undefined name 'interfaces' Signed-off-by: Douglas Bagnall --- selftest/client.py | 80 ------------------------------------------------------ 1 file changed, 80 deletions(-) delete mode 100644 selftest/client.py diff --git a/selftest/client.py b/selftest/client.py deleted file mode 100644 index 81a9889..0000000 --- a/selftest/client.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/python -u -# Bootstrap Samba and run a number of tests against it. -# Copyright (C) 2012 Jelmer Vernooij - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os -import shutil - -def write_clientconf(conffile, clientdir, vars): - if not os.path.isdir(clientdir): - os.mkdir(clientdir, 0777) - - for n in ["private", "lockdir", "statedir", "cachedir"]: - p = os.path.join(clientdir, n) - if os.path.isdir(p): - shutil.rmtree(p) - os.mkdir(p, 0777) - - # this is ugly, but the ncalrpcdir needs exactly 0755 - # otherwise tests fail. - mask = os.umask(0022) - - for n in ["ncalrpcdir", "ncalrpcdir/np"]: - p = os.path.join(clientdir, n) - if os.path.isdir(p): - shutil.rmtree(p) - os.mkdir(p, 0777) - os.umask(mask) - - settings = { - "netbios name": "client", - "private dir": os.path.join(clientdir, "private"), - "lock dir": os.path.join(clientdir, "lockdir"), - "state directory": os.path.join(clientdir, "statedir"), - "cache directory": os.path.join(clientdir, "cachedir"), - "ncalrpc dir": os.path.join(clientdir, "ncalrpcdir"), - "name resolve order": "file bcast", - "panic action": os.path.join(os.path.dirname(__file__), "gdb_backtrace \%d"), - "max xmit": "32K", - "notify:inotify": "false", - "ldb:nosync": "true", - "system:anonymous": "true", - "client lanman auth": "Yes", - "log level": "1", - "torture:basedir": clientdir, - # We don't want to pass our self-tests if the PAC code is wrong - "gensec:require_pac": "true", - "resolv:host file": os.path.join(prefix_abs, "dns_host_file"), - # We don't want to run 'speed' tests for very long - "torture:timelimit": "1", - } - - if "DOMAIN" in vars: - settings["workgroup"] = vars["DOMAIN"] - if "REALM" in vars: - settings["realm"] = vars["REALM"] - if opts.socket_wrapper: - settings["interfaces"] = interfaces - - f = open(conffile, 'w') - try: - f.write("[global]\n") - for item in settings.iteritems(): - f.write("\t%s = %s\n" % item) - finally: - f.close() - - -- 2.7.4 From a0e157287d644b95cf35d9e7a673fbedb71385ca Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 14:50:14 +1300 Subject: [PATCH 04/13] python/join: correct spelling of "ctx.del_noerror" Signed-off-by: Douglas Bagnall --- python/samba/join.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samba/join.py b/python/samba/join.py index 9b211ac..88b8d4b 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -228,7 +228,7 @@ class dc_join(object): if "msDS-Krbtgtlink" in res[0]: new_krbtgt_dn = res[0]["msDS-Krbtgtlink"][0] - del_noerror(ctx.new_krbtgt_dn) + ctx.del_noerror(ctx.new_krbtgt_dn) res = ctx.samdb.search(base=ctx.samdb.get_default_basedn(), expression='(&(sAMAccountName=%s)(servicePrincipalName=%s))' % -- 2.7.4 From ae41b00aa0b090b4946fb79b8fc31c107813183b Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 14:51:27 +1300 Subject: [PATCH 05/13] samba-tool domain: correctly spell variable name Signed-off-by: Douglas Bagnall --- python/samba/netcmd/domain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index de8d537..e039724 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -3169,7 +3169,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): if len(enable_nb) > 0: raise CommandError("--enable-nb not allowed together with --enable-all") - if len(enable_sid) > 0: + if len(enable_sid_str) > 0: raise CommandError("--enable-sid not allowed together with --enable-all") if len(enable_tln) > 0: -- 2.7.4 From f400635a74094736a1e0ea33ece223e0fc46fe34 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 14:53:46 +1300 Subject: [PATCH 06/13] python/remove_dc: avoid using non-existent variable Signed-off-by: Douglas Bagnall Signed-off-by: Andrew Bartlett --- python/samba/remove_dc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/samba/remove_dc.py b/python/samba/remove_dc.py index eb4cbe0..61b5937 100644 --- a/python/samba/remove_dc.py +++ b/python/samba/remove_dc.py @@ -70,8 +70,8 @@ def remove_sysvol_references(samdb, logger, dc_name): raise DemoteException("Failed constructing DN %s by adding base" % \ (dn, samdb.get_default_basedn())) if dn.add_child("CN=X") == False: - raise DemoteException("Failed constructing DN %s by adding child %s"\ - % (dn, rdn)) + raise DemoteException("Failed constructing DN %s by adding child " + "CN=X (soon to be CN=%s)" % (dn, dc_name)) dn.set_component(0, "CN", dc_name) try: -- 2.7.4 From 9106a2260a96e1065a0edc88366d7d3089aa1596 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 14:54:58 +1300 Subject: [PATCH 07/13] python provision: FDSBackend takes forced uri Signed-off-by: Douglas Bagnall --- python/samba/provision/backend.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/samba/provision/backend.py b/python/samba/provision/backend.py index 17572ef..512e7b7 100644 --- a/python/samba/provision/backend.py +++ b/python/samba/provision/backend.py @@ -609,10 +609,11 @@ class OpenLDAPBackend(LDAPBackend): class FDSBackend(LDAPBackend): def __init__(self, backend_type, paths=None, lp=None, - names=None, logger=None, domainsid=None, - schema=None, hostname=None, ldapadminpass=None, slapd_path=None, - ldap_backend_extra_port=None, ldap_dryrun_mode=False, root=None, - setup_ds_path=None): + names=None, logger=None, domainsid=None, + schema=None, hostname=None, ldapadminpass=None, + slapd_path=None, ldap_backend_extra_port=None, + ldap_backend_forced_uri=None, ldap_dryrun_mode=False, + root=None, setup_ds_path=None): from samba.provision import setup_path -- 2.7.4 From 5efd11dcea5bf62dd257a8f7335b0339d68ef2f9 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 14:55:32 +1300 Subject: [PATCH 08/13] python sites/subnets: correctly spell variable name Signed-off-by: Douglas Bagnall --- python/samba/netcmd/sites.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samba/netcmd/sites.py b/python/samba/netcmd/sites.py index f0c792d..d0b7b9f 100644 --- a/python/samba/netcmd/sites.py +++ b/python/samba/netcmd/sites.py @@ -209,7 +209,7 @@ class cmd_sites_subnet_set_site(Command): (subnetname, site_of_subnet, e)) print >> self.outf, ("Subnet %s shifted to site %s" % - (subnet_name, site_of_subnet)) + (subnetname, site_of_subnet)) class cmd_sites_subnet(SuperCommand): -- 2.7.4 From 3e22f186e1207b7ebf16ee60f648f9004fa8e706 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 14:56:24 +1300 Subject: [PATCH 09/13] waf/wafadmin/3rdparty: fix paranoid.py variable names Signed-off-by: Douglas Bagnall --- third_party/waf/wafadmin/3rdparty/paranoid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/waf/wafadmin/3rdparty/paranoid.py b/third_party/waf/wafadmin/3rdparty/paranoid.py index ba6d752..13dfb68 100644 --- a/third_party/waf/wafadmin/3rdparty/paranoid.py +++ b/third_party/waf/wafadmin/3rdparty/paranoid.py @@ -21,9 +21,9 @@ say('you make the errors, we detect them') def check_task_classes(self): for x in Task.TaskBase.classes: if isinstance(x, Task.Task): - if not getattr(cls, 'ext_in', None) or getattr(cls, 'before', None): + if not getattr(x, 'ext_in', None) or getattr(x, 'before', None): say('class %s has no precedence constraints (ext_in/before)') - if not getattr(cls, 'ext_out', None) or getattr(cls, 'after', None): + if not getattr(x, 'ext_out', None) or getattr(x, 'after', None): say('class %s has no precedence constraints (ext_out/after)') comp = Build.BuildContext.compile -- 2.7.4 From 9f6ab75ab94c4a4816fc5e2a25901bfebfa752a8 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 15:08:19 +1300 Subject: [PATCH 10/13] third_party/dnspython: fix variable name in dnssec This appears to have been fixed upstream (along with significant other changes) Signed-off-by: Douglas Bagnall --- third_party/dnspython/dns/dnssec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/dnspython/dns/dnssec.py b/third_party/dnspython/dns/dnssec.py index dd6a27a..85ea170 100644 --- a/third_party/dnspython/dns/dnssec.py +++ b/third_party/dnspython/dns/dnssec.py @@ -132,8 +132,8 @@ def _find_key(keys, rrsig): return None if isinstance(value, dns.node.Node): try: - rdataset = node.find_rdataset(dns.rdataclass.IN, - dns.rdatatype.DNSKEY) + rdataset = value.find_rdataset(dns.rdataclass.IN, + dns.rdatatype.DNSKEY) except KeyError: return None else: -- 2.7.4 From 8d80970e553538d27dd9d3522c8f9d16e9a8158b Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 15:11:08 +1300 Subject: [PATCH 11/13] python/examples/winreg: two variable name typos on a single line Signed-off-by: Douglas Bagnall --- python/examples/winreg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/examples/winreg.py b/python/examples/winreg.py index 484a69b..442ee54 100755 --- a/python/examples/winreg.py +++ b/python/examples/winreg.py @@ -73,7 +73,7 @@ else: root = "HKLM" if opts.createkey: - reg.create_key("HKLM\\SOFTWARE", opt.createkey) + winreg.create_key("HKLM\\SOFTWARE", opts.createkey) else: print "Listing registry tree '%s'" % root try: -- 2.7.4 From 401953a4a644cae0088dc98658660685be263154 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 9 Mar 2017 15:13:32 +1300 Subject: [PATCH 12/13] ./examples/scripts/SambaConfig.py: fix typo in "continue" Signed-off-by: Douglas Bagnall --- examples/scripts/shares/python/SambaConfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/scripts/shares/python/SambaConfig.py b/examples/scripts/shares/python/SambaConfig.py index 3d4a473..6ceec8a 100644 --- a/examples/scripts/shares/python/SambaConfig.py +++ b/examples/scripts/shares/python/SambaConfig.py @@ -124,7 +124,7 @@ class SambaConf: if input_str[-1] == "\\" : result += input_str[0:-1] - contine + continue ## otherwise we have a complete line result += input_str -- 2.7.4 From 385cdfa394fbe9e1d52e7ef4d485ca2757d04d80 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 1 Mar 2017 17:33:09 +1300 Subject: [PATCH 13/13] scripts/traffic_summary: documentation typo Signed-off-by: Douglas Bagnall --- script/traffic_summary.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/traffic_summary.pl b/script/traffic_summary.pl index 942f168..5c69ca1 100755 --- a/script/traffic_summary.pl +++ b/script/traffic_summary.pl @@ -552,7 +552,7 @@ To process encrypted kerberos traffic To display more detailed documentation, including details of the output format - perldoc traffic_summnary.pl + perldoc traffic_summary.pl NOTE: tshark pdml output is very verbose, so it's better to pipe the tshark output directly to traffic_summary, rather than generating -- 2.7.4