The branch, master has been updated via 29365195176 python: Use 'is' for identity when comparing against None via 6586ac03a55 kcc: Don't reuse outer loop variable for inner loop via 455c083ec37 python: Remove redundant assignments via 139f00c3941 source4/scripting/bin: Remove unnecessary global declarations via 79f591edc6c python/wscript: Remove unused format() argument via 6893e2c1d11 wintest: Remove unreachable return statement via 6c1142da642 selftest: Remove unreachable return statement via b481ceaa0db samba-tool: Don't try to delete local_tdo_handle twice. via ed9d415c08d wafsamba: Fix previously unreachable exception path via ba54c9cc067 python: Remove unnecessary 'pass' statements via 0eb3041bfa6 samba-tool gpo: Fix unintended string concatenations via 5104a791249 samba-tool gpo tests: Fix unintended string concatenations via b2c94d3e514 examples: Make samr.py work with Python 3 via 74c86aa587d examples: Make netbios.py work with Python 3 via b9d12c703ae examples: Remove unused imports via d303a0bee46 python/xattr: Properly process system.posix_acl_access via 2fb3658eda2 samba-tool processes: Remove unused loop from f9df57043e4 lib/smbconf: add python wrapper functions for transaction management
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 29365195176630952c65b461d25096f92fffa746 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:42:47 2022 +1200 python: Use 'is' for identity when comparing against None Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org> Autobuild-Date(master): Tue May 10 06:12:10 UTC 2022 on sn-devel-184 commit 6586ac03a5518f1d86786506de87c4e90abe29c3 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:40:34 2022 +1200 kcc: Don't reuse outer loop variable for inner loop Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 455c083ec375a58a648021543ac51faca02bc0b6 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:32:13 2022 +1200 python: Remove redundant assignments Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 139f00c3941f7dbbd646f878157e75aceeb445e0 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:23:10 2022 +1200 source4/scripting/bin: Remove unnecessary global declarations Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 79f591edc6cb7f9499914cd83e4c847942d86ee3 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:21:28 2022 +1200 python/wscript: Remove unused format() argument Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 6893e2c1d116d7bb23f08be341d5a0971dbc03e8 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:19:34 2022 +1200 wintest: Remove unreachable return statement Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 6c1142da64208dae37576f4cde6fb47ad14a18e2 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:18:49 2022 +1200 selftest: Remove unreachable return statement Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit b481ceaa0db83d9662bc5b7e737838d02f0941f1 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:16:17 2022 +1200 samba-tool: Don't try to delete local_tdo_handle twice. This code is unreachable, as local_tdo_handle has already been deleted and set to None earlier. Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit ed9d415c08d91d3c16ec7bd35fd8387fbe40df43 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:12:05 2022 +1200 wafsamba: Fix previously unreachable exception path Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit ba54c9cc067993aed21e97618cc0f1f58a5034e8 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:11:07 2022 +1200 python: Remove unnecessary 'pass' statements Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 0eb3041bfa6a8ba345796511e6acaf8ac40c486f Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:08:06 2022 +1200 samba-tool gpo: Fix unintended string concatenations Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 5104a791249ee2311828e4483e3e9ddabb05d45a Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Fri May 6 11:59:28 2022 +1200 samba-tool gpo tests: Fix unintended string concatenations Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit b2c94d3e514779bd40e848612fead89ac189691f Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:07:36 2022 +1200 examples: Make samr.py work with Python 3 Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 74c86aa587d67146cee17a938064ebd5916f3447 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:06:46 2022 +1200 examples: Make netbios.py work with Python 3 Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit b9d12c703ae692c6a09b0d2b4df40d56f0a0d84c Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 21:04:48 2022 +1200 examples: Remove unused imports Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit d303a0bee4635a950d21b72a2e27c8382a3585a9 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 20:42:18 2022 +1200 python/xattr: Properly process system.posix_acl_access Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 2fb3658eda27d5bb232e23b6e41f5fe859635e88 Author: Joseph Sutton <josephsut...@catalyst.net.nz> Date: Thu May 5 20:41:26 2022 +1200 samba-tool processes: Remove unused loop Signed-off-by: Joseph Sutton <josephsut...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> ----------------------------------------------------------------------- Summary of changes: buildtools/wafsamba/samba_deps.py | 2 +- buildtools/wafsamba/samba_perl.py | 1 - buildtools/wafsamba/wafsamba.py | 2 +- python/examples/dnsserver.py | 57 ++++++++++++++-------------- python/examples/netbios.py | 6 +-- python/examples/samr.py | 44 ++++++++++----------- python/samba/__init__.py | 1 - python/samba/dbchecker.py | 2 - python/samba/emulate/traffic.py | 2 - python/samba/join.py | 1 - python/samba/kcc/ldif_import_export.py | 6 +-- python/samba/netcmd/__init__.py | 1 - python/samba/netcmd/computer.py | 1 - python/samba/netcmd/dns.py | 12 +++--- python/samba/netcmd/domain.py | 9 ----- python/samba/netcmd/gpo.py | 18 ++++----- python/samba/netcmd/ldapcmp.py | 7 +--- python/samba/netcmd/processes.py | 29 +++++++------- python/samba/netcmd/user.py | 7 +--- python/samba/provision/sambadns.py | 2 - python/samba/remove_dc.py | 2 - python/samba/samdb.py | 3 +- python/samba/tests/samba_tool/gpo_exts.py | 2 +- python/samba/upgradehelpers.py | 2 - python/samba/vgp_sudoers_ext.py | 4 +- python/samba/xattr.py | 4 +- python/wscript | 2 +- script/attr_count_read | 1 - selftest/target/dns_hub.py | 1 - source4/scripting/bin/gen_error_common.py | 4 +- source4/scripting/bin/gen_hresult.py | 2 +- source4/scripting/bin/renamedc | 1 - source4/scripting/bin/samba_dnsupdate | 4 +- source4/scripting/bin/samba_upgradeprovision | 1 - source4/scripting/devel/demodirsync.py | 3 +- source4/scripting/devel/pfm_verify.py | 1 - wintest/wintest.py | 1 - 37 files changed, 104 insertions(+), 144 deletions(-) Changeset truncated at 500 lines: diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py index c0a330b1b5e..66adf40307e 100644 --- a/buildtools/wafsamba/samba_deps.py +++ b/buildtools/wafsamba/samba_deps.py @@ -1181,7 +1181,7 @@ def generate_clangdb(bld): lst = tg.tasks for task in lst: try: - cmd = task.last_cmd + task.last_cmd except AttributeError: continue if isinstance(task, task_classes): diff --git a/buildtools/wafsamba/samba_perl.py b/buildtools/wafsamba/samba_perl.py index e019acb0fa1..b4263137b59 100644 --- a/buildtools/wafsamba/samba_perl.py +++ b/buildtools/wafsamba/samba_perl.py @@ -28,7 +28,6 @@ def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)): return v except IndexError: conf.end_msg(False, 'YELLOW') - pass return None vendor_prefix = check_perl_config_var('vendorprefix') diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 710b82af663..4bd4e9f7fe3 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -856,7 +856,7 @@ def SAMBA_SUBSYSTEM(bld, modname, source, if provide_builtin_linking: - if use_hostcc or pyext or pyembed: + if use_hostcc: raise Errors.WafError("subsystem[%s] provide_builtin_linking=True " + "not allowed with use_hostcc=True" % modname) diff --git a/python/examples/dnsserver.py b/python/examples/dnsserver.py index ccb003f9212..caca9980b66 100755 --- a/python/examples/dnsserver.py +++ b/python/examples/dnsserver.py @@ -7,9 +7,8 @@ from optparse import OptionParser sys.path.insert(0, "bin/python") -import samba import samba.getopt as options -from samba.dcerpc import dnsserver, security, dnsp +from samba.dcerpc import dnsserver, dnsp ########### main code ########### @@ -40,16 +39,16 @@ if __name__ == "__main__": dns_conn = dnsserver.dnsserver(binding_str, lp, creds) print("querying a NS record") - res = dns_conn.DnssrvEnumRecords2(0x00070000, - 0, - server, - dnszone, - newname, - None, - dnsp.DNS_TYPE_NS, - 0x0f, - None, - None) + dns_conn.DnssrvEnumRecords2(0x00070000, + 0, + server, + dnszone, + newname, + None, + dnsp.DNS_TYPE_NS, + 0x0f, + None, + None) print("adding a NS glue record") name = dnsserver.DNS_RPC_NAME() @@ -67,22 +66,22 @@ if __name__ == "__main__": addrecbuf = dnsserver.DNS_RPC_RECORD_BUF() addrecbuf.rec = addrec - res = dns_conn.DnssrvUpdateRecord2(0x00070000, - 0, - server, - dnszone, - newname, - addrecbuf, - None) + dns_conn.DnssrvUpdateRecord2(0x00070000, + 0, + server, + dnszone, + newname, + addrecbuf, + None) print("querying the NS record") - res = dns_conn.DnssrvEnumRecords2(0x00070000, - 0, - server, - dnszone, - newname, - None, - dnsp.DNS_TYPE_NS, - 0x0f, - None, - None) + dns_conn.DnssrvEnumRecords2(0x00070000, + 0, + server, + dnszone, + newname, + None, + dnsp.DNS_TYPE_NS, + 0x0f, + None, + None) diff --git a/python/examples/netbios.py b/python/examples/netbios.py index 7a3a9da828f..740d8e32bb7 100644 --- a/python/examples/netbios.py +++ b/python/examples/netbios.py @@ -23,6 +23,6 @@ n = Node() (reply_from, names, addresses) = n.query_name("GANIEDA", "192.168.4.0", timeout=4) -print "Received reply from %s:" % (reply_from, ) -print "Names: %r" % (names, ) -print "Addresses: %r" % (addresses, ) +print("Received reply from %s:" % (reply_from, )) +print("Names: %r" % (names, )) +print("Addresses: %r" % (addresses, )) diff --git a/python/examples/samr.py b/python/examples/samr.py index 7cd70f5a110..cbfbb1af9ab 100755 --- a/python/examples/samr.py +++ b/python/examples/samr.py @@ -42,7 +42,7 @@ def FillUserInfo(samr, dom_handle, users, level): samr.Close(user_handle) -def toArray((handle, array, num_entries)): +def toArray(handle, array, num_entries): ret = [] for x in range(num_entries): ret.append((array.entries[x].idx, array.entries[x].name)) @@ -51,38 +51,38 @@ def toArray((handle, array, num_entries)): def test_Connect(samr): """test the samr_Connect interface""" - print "Testing samr_Connect" + print("Testing samr_Connect") return samr.Connect2(None, security.SEC_FLAG_MAXIMUM_ALLOWED) def test_LookupDomain(samr, handle, domain): """test the samr_LookupDomain interface""" - print "Testing samr_LookupDomain" + print("Testing samr_LookupDomain") return samr.LookupDomain(handle, domain) def test_OpenDomain(samr, handle, sid): """test the samr_OpenDomain interface""" - print "Testing samr_OpenDomain" + print("Testing samr_OpenDomain") return samr.OpenDomain(handle, security.SEC_FLAG_MAXIMUM_ALLOWED, sid) def test_EnumDomainUsers(samr, dom_handle): """test the samr_EnumDomainUsers interface""" - print "Testing samr_EnumDomainUsers" - users = toArray(samr.EnumDomainUsers(dom_handle, 0, 0, -1)) - print "Found %d users" % len(users) + print("Testing samr_EnumDomainUsers") + users = toArray(*samr.EnumDomainUsers(dom_handle, 0, 0, 0xffffffff)) + print("Found %d users" % len(users)) for idx, user in users: - print "\t%s\t(%d)" % (user.string, idx) + print("\t%s\t(%d)" % (user.string, idx)) def test_EnumDomainGroups(samr, dom_handle): """test the samr_EnumDomainGroups interface""" - print "Testing samr_EnumDomainGroups" - groups = toArray(samr.EnumDomainGroups(dom_handle, 0, 0)) - print "Found %d groups" % len(groups) + print("Testing samr_EnumDomainGroups") + groups = toArray(*samr.EnumDomainGroups(dom_handle, 0, 0)) + print("Found %d groups" % len(groups)) for idx, group in groups: - print "\t%s\t(%d)" % (group.string, idx) + print("\t%s\t(%d)" % (group.string, idx)) def test_domain_ops(samr, dom_handle): @@ -93,14 +93,14 @@ def test_domain_ops(samr, dom_handle): def test_EnumDomains(samr, handle): """test the samr_EnumDomains interface""" - print "Testing samr_EnumDomains" + print("Testing samr_EnumDomains") - domains = toArray(samr.EnumDomains(handle, 0, -1)) - print "Found %d domains" % len(domains) + domains = toArray(*samr.EnumDomains(handle, 0, 0xffffffff)) + print("Found %d domains" % len(domains)) for idx, domain in domains: - print "\t%s (%d)" % (display_lsa_string(domain), idx) + print("\t%s (%d)" % (display_lsa_string(domain), idx)) for idx, domain in domains: - print "Testing domain %s" % display_lsa_string(domain) + print("Testing domain %s" % display_lsa_string(domain)) sid = samr.LookupDomain(handle, domain) dom_handle = test_OpenDomain(samr, handle, sid) test_domain_ops(samr, dom_handle) @@ -108,20 +108,20 @@ def test_EnumDomains(samr, handle): if len(sys.argv) != 2: - print "Usage: samr.js <BINDING>" + print("Usage: samr.js <BINDING>") sys.exit(1) binding = sys.argv[1] -print "Connecting to %s" % binding +print("Connecting to %s" % binding) try: samr = samr.samr(binding) -except Exception, e: - print "Failed to connect to %s: %s" % (binding, e.message) +except Exception as e: + print("Failed to connect to %s: %s" % (binding, e.message)) sys.exit(1) handle = test_Connect(samr) test_EnumDomains(samr, handle) samr.Close(handle) -print "All OK" +print("All OK") diff --git a/python/samba/__init__.py b/python/samba/__init__.py index 0e6a33322f8..ec540a61521 100644 --- a/python/samba/__init__.py +++ b/python/samba/__init__.py @@ -369,7 +369,6 @@ interface_ips = _glue.interface_ips fault_setup = _glue.fault_setup set_debug_level = _glue.set_debug_level get_debug_level = _glue.get_debug_level -unix2nttime = _glue.unix2nttime float2nttime = _glue.float2nttime nttime2float = _glue.nttime2float nttime2string = _glue.nttime2string diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py index eb6dfe97cb0..449b0a7d985 100644 --- a/python/samba/dbchecker.py +++ b/python/samba/dbchecker.py @@ -135,7 +135,6 @@ class dbcheck(object): (enum, estr) = e5.args if enum != ldb.ERR_NO_SUCH_OBJECT: raise - pass self.system_session_info = system_session() self.admin_session_info = admin_session(None, samdb.get_domain_sid()) @@ -237,7 +236,6 @@ class dbcheck(object): (enum, estr) = e6.args if enum != ldb.ERR_NO_SUCH_OBJECT: raise - pass def check_database(self, DN=None, scope=ldb.SCOPE_SUBTREE, controls=None, attrs=None): diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py index e3f281f2327..c141e36b629 100644 --- a/python/samba/emulate/traffic.py +++ b/python/samba/emulate/traffic.py @@ -1588,7 +1588,6 @@ def replay_seq_in_fork(cs, start, context, account, client_id, server_id=1): os.close(1) except IOError as e: LOGGER.info("stdout closing failed with %s" % e) - pass sys.stdout = f now = time.time() - start @@ -1630,7 +1629,6 @@ def dnshammer_in_fork(dns_rate, duration, context, query_file=None): os.close(1) except IOError as e: LOGGER.warn("stdout closing failed with %s" % e) - pass filename = os.path.join(context.statsdir, 'stats-dns') sys.stdout = open(filename, 'w') diff --git a/python/samba/join.py b/python/samba/join.py index 91ed6da1147..97561323f21 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -1131,7 +1131,6 @@ class DCJoinContext(object): except WERRORError as e: if e.args[0] == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: name_found = False - pass if name_found: for rec in res.rec: diff --git a/python/samba/kcc/ldif_import_export.py b/python/samba/kcc/ldif_import_export.py index 7ec553edcb9..578330dda0e 100644 --- a/python/samba/kcc/ldif_import_export.py +++ b/python/samba/kcc/ldif_import_export.py @@ -226,10 +226,10 @@ def samdb_to_ldif_file(samdb, dburl, lp, creds, ldif_file): # Spin thru all the DSAs looking for NC replicas # and build a list of all possible Naming Contexts # for subsequent retrieval below - for msg in res: - for k in msg.keys(): + for res_msg in res: + for k in res_msg.keys(): if k in ncattrs: - for value in msg[k]: + for value in res_msg[k]: # Some of these have binary DNs so # use dsdb_Dn to split out relevent parts dsdn = dsdb_Dn(samdb, value.decode('utf8')) diff --git a/python/samba/netcmd/__init__.py b/python/samba/netcmd/__init__.py index 62fe1380d52..bb70f72449e 100644 --- a/python/samba/netcmd/__init__.py +++ b/python/samba/netcmd/__init__.py @@ -29,7 +29,6 @@ import textwrap class Option(SambaOption): SUPPRESS_HELP = optparse.SUPPRESS_HELP - pass # This help formatter does text wrapping and preserves newlines diff --git a/python/samba/netcmd/computer.py b/python/samba/netcmd/computer.py index 8fa0ab8d1e9..e4fbd671222 100644 --- a/python/samba/netcmd/computer.py +++ b/python/samba/netcmd/computer.py @@ -105,7 +105,6 @@ def add_dns_records( except WERRORError as e: if e.args[0] == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: name_found = False - pass if name_found: for rec in res.rec: diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py index c0f27808c46..7c4d3f9bc6a 100644 --- a/python/samba/netcmd/dns.py +++ b/python/samba/netcmd/dns.py @@ -878,9 +878,9 @@ class cmd_zonecreate(Command): zone_create_info.fLoadExisting = 1 zone_create_info.dwDpFlags = dnsserver.DNS_DP_DOMAIN_DEFAULT - res = dns_conn.DnssrvOperation2(client_version, 0, server, None, - 0, 'ZoneCreate', typeid, - zone_create_info) + dns_conn.DnssrvOperation2(client_version, 0, server, None, + 0, 'ZoneCreate', typeid, + zone_create_info) typeid = dnsserver.DNSSRV_TYPEID_NAME_AND_PARAM name_and_param = dnsserver.DNS_RPC_NAME_AND_PARAM() @@ -888,9 +888,9 @@ class cmd_zonecreate(Command): name_and_param.dwParam = dnsp.DNS_ZONE_UPDATE_SECURE try: - res = dns_conn.DnssrvOperation2(client_version, 0, server, zone, - 0, 'ResetDwordProperty', typeid, - name_and_param) + dns_conn.DnssrvOperation2(client_version, 0, server, zone, + 0, 'ResetDwordProperty', typeid, + name_and_param) except WERRORError as e: if e.args[0] == werror.WERR_DNS_ERROR_ZONE_ALREADY_EXISTS: self.outf.write('Zone already exists.') diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index 49e60625e44..2a548ed1ad4 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -2877,7 +2877,6 @@ class cmd_domain_trust_delete(DomainTrustCommand): if not self.check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND): raise self.RemoteRuntimeError(self, error, "QueryTrustedDomainInfoByName(%s)" % ( lsaString.string)) - pass if remote_tdo_info is not None: if local_lsa_info.sid != remote_tdo_info.sid or \ @@ -2921,14 +2920,6 @@ class cmd_domain_trust_delete(DomainTrustCommand): except RuntimeError as error: self.outf.write("%s\n" % self.RemoteRuntimeError(self, error, "DeleteObject() failed")) - if local_tdo_handle is not None: - try: - local_lsa.DeleteObject(local_tdo_handle) - local_tdo_handle = None - self.outf.write("LocalTDO deleted.\n") - except RuntimeError as error: - self.outf.write("%s\n" % self.LocalRuntimeError(self, error, "DeleteObject() failed")) - return diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py index 5d936e0e646..784c1676467 100644 --- a/python/samba/netcmd/gpo.py +++ b/python/samba/netcmd/gpo.py @@ -733,7 +733,7 @@ class cmd_setlink(GPOCommand): # Check if valid GPO DN try: - msg = get_gpo_info(self.samdb, gpo=gpo)[0] + get_gpo_info(self.samdb, gpo=gpo)[0] except Exception: raise CommandError("GPO '%s' does not exist" % gpo) gpo_dn = str(get_gpo_dn(self.samdb, gpo)) @@ -1867,7 +1867,7 @@ samba-tool gpo manage sudoers list {31B2F340-016D-11D2-945F-00C04FB984F9} else '%s%%' % u.text for u in principals]) else: uname = 'ALL' - nopassword = entry.find('password') == None + nopassword = entry.find('password') is None np_entry = ' NOPASSWD:' if nopassword else '' p = '%s ALL=(%s)%s %s' % (uname, user, np_entry, command) self.outf.write('%s\n' % p) @@ -1946,7 +1946,7 @@ samba-tool gpo manage sudoers remove {31B2F340-016D-11D2-945F-00C04FB984F9} 'fak else '%s%%' % u.text for u in principals]) else: uname = 'ALL' - nopassword = e.find('password') == None + nopassword = e.find('password') is None np_entry = ' NOPASSWD:' if nopassword else '' p = '%s ALL=(%s)%s %s' % (uname, user, np_entry, command) entries[p] = e @@ -3702,7 +3702,7 @@ samba-tool gpo manage access list {31B2F340-016D-11D2-945F-00C04FB984F9} realm = self.lp.get('realm') vgp_xml = '\\'.join([realm.lower(), 'Policies', gpo, - 'MACHINE\\VGP\\VTLA\\VAS' + 'MACHINE\\VGP\\VTLA\\VAS', 'HostAccessControl\\Allow\\manifest.xml']) try: allow = ET.fromstring(conn.loadfile(vgp_xml)) @@ -3727,7 +3727,7 @@ samba-tool gpo manage access list {31B2F340-016D-11D2-945F-00C04FB984F9} self.outf.write('+:%s\\%s:ALL\n' % (domain.text, name.text)) vgp_xml = '\\'.join([realm.lower(), 'Policies', gpo, - 'MACHINE\\VGP\\VTLA\\VAS' + 'MACHINE\\VGP\\VTLA\\VAS', 'HostAccessControl\\Deny\\manifest.xml']) try: deny = ET.fromstring(conn.loadfile(vgp_xml)) @@ -3798,11 +3798,11 @@ samba-tool gpo manage access add {31B2F340-016D-11D2-945F-00C04FB984F9} allow go realm = self.lp.get('realm') if etype == 'allow': vgp_dir = '\\'.join([realm.lower(), 'Policies', gpo, - 'MACHINE\\VGP\\VTLA\\VAS' + 'MACHINE\\VGP\\VTLA\\VAS', 'HostAccessControl\\Allow']) elif etype == 'deny': vgp_dir = '\\'.join([realm.lower(), 'Policies', gpo, - 'MACHINE\\VGP\\VTLA\\VAS' + 'MACHINE\\VGP\\VTLA\\VAS', 'HostAccessControl\\Deny']) else: raise CommandError("The entry type must be either 'allow' or " @@ -3930,11 +3930,11 @@ samba-tool gpo manage access remove {31B2F340-016D-11D2-945F-00C04FB984F9} allow realm = self.lp.get('realm') if etype == 'allow': vgp_dir = '\\'.join([realm.lower(), 'Policies', gpo, - 'MACHINE\\VGP\\VTLA\\VAS' + 'MACHINE\\VGP\\VTLA\\VAS', 'HostAccessControl\\Allow']) elif etype == 'deny': vgp_dir = '\\'.join([realm.lower(), 'Policies', gpo, - 'MACHINE\\VGP\\VTLA\\VAS' + 'MACHINE\\VGP\\VTLA\\VAS', 'HostAccessControl\\Deny']) else: raise CommandError("The entry type must be either 'allow' or " diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py index 1d830e3082f..762047c467b 100644 --- a/python/samba/netcmd/ldapcmp.py +++ b/python/samba/netcmd/ldapcmp.py @@ -604,11 +604,8 @@ class LDAPObject(object): continue # Attribute values that are list that contain DN based values that may differ elif x.upper() in self.dn_attributes: - m = p - n = q - if not p and not q: - m = self.attributes[x] - n = other.attributes[x] + m = self.attributes[x] + n = other.attributes[x] p = [self.fix_dn(j) for j in m] q = [other.fix_dn(j) for j in n] -- Samba Shared Repository