[SCM] Samba Shared Repository - branch master updated

Noel Power npower at samba.org
Fri Feb 7 12:04:15 UTC 2020


The branch, master has been updated
       via  beb829d0e64 samba-tool gpo: tighter matching for ini names
       via  07fa6678e43 python: use raw string for regex with escape
       via  c247afbda00 pytests: heed assertEquals deprecation warning en-masse
      from  3bc7acc6264 nmblib: avoid undefined behaviour in handle_name_ptrs()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit beb829d0e6477f4f82758b2d646c3e21634c768d
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Feb 7 11:27:32 2020 +1300

    samba-tool gpo: tighter matching for ini names
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Noel Power <npower at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Fri Feb  7 12:03:34 UTC 2020 on sn-devel-184

commit 07fa6678e43aa899472ac7c4f61960fabd326531
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Feb 7 11:25:27 2020 +1300

    python: use raw string for regex with escape
    
    Python regards 'GPT\.INI$' as a string containing an invalid escape
    sequence '\.', which is ignored (i.e. treated as the literal sequence
    of those 2 characters), but only after Python has grumbled to itself,
    and to you if you enabled DeprecationWarnings.
    
    The proper thing to do here is use r-strings, like r'GPT\.INI$', which
    tell Python that all backslashes are literal. Alternatively (as we do
    once in this patch), the backslash can itself be escaped ('\\').
    
    There are more problems of this nature in the build scripts.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Noel Power <npower at samba.org>

commit c247afbda00013bf4821e5a2d4f3166bf31814f0
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Feb 7 11:02:38 2020 +1300

    pytests: heed assertEquals deprecation warning en-masse
    
    TestCase.assertEquals() is an alias for TestCase.assertEqual() and
    has been deprecated since Python 2.7.
    
    When we run our tests with in python developer mode (`PYTHONDEVMODE=1
    make test`) we get 580 DeprecationWarnings about this.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Noel Power <npower at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 auth/credentials/tests/bind.py                     |    6 +-
 buildtools/wafsamba/tests/test_abi.py              |   20 +-
 buildtools/wafsamba/tests/test_bundled.py          |    2 +-
 buildtools/wafsamba/tests/test_utils.py            |   28 +-
 lib/ldb-samba/tests/match_rules.py                 |   38 +-
 python/samba/gp_parse/gp_inf.py                    |    2 +-
 python/samba/netcmd/drs.py                         |    2 +-
 python/samba/netcmd/dsacl.py                       |    4 +-
 python/samba/netcmd/gpo.py                         |   20 +-
 python/samba/netcmd/ldapcmp.py                     |    6 +-
 python/samba/tests/__init__.py                     |    2 +-
 python/samba/tests/audit_log_dsdb.py               |  222 +--
 python/samba/tests/audit_log_pass_change.py        |   94 +-
 python/samba/tests/auth_log.py                     |  350 ++---
 python/samba/tests/auth_log_ncalrpc.py             |   22 +-
 python/samba/tests/auth_log_netlogon.py            |   24 +-
 python/samba/tests/auth_log_netlogon_bad_creds.py  |   10 +-
 python/samba/tests/auth_log_pass_change.py         |    6 +-
 python/samba/tests/auth_log_samlogon.py            |   10 +-
 python/samba/tests/auth_log_winbind.py             |  166 +--
 python/samba/tests/blackbox/mdfind.py              |    2 +-
 python/samba/tests/blackbox/traffic_learner.py     |    8 +-
 python/samba/tests/blackbox/traffic_summary.py     |    2 +-
 python/samba/tests/common.py                       |   24 +-
 python/samba/tests/core.py                         |   16 +-
 python/samba/tests/dcerpc/bare.py                  |   12 +-
 python/samba/tests/dcerpc/dnsserver.py             |   36 +-
 python/samba/tests/dcerpc/integer.py               |   22 +-
 python/samba/tests/dcerpc/mdssvc.py                |    2 +-
 python/samba/tests/dcerpc/misc.py                  |   18 +-
 python/samba/tests/dcerpc/raw_protocol.py          | 1504 ++++++++++----------
 python/samba/tests/dcerpc/raw_testcase.py          |  134 +-
 python/samba/tests/dcerpc/registry.py              |    4 +-
 python/samba/tests/dcerpc/rpc_talloc.py            |    2 +-
 python/samba/tests/dcerpc/rpcecho.py               |   20 +-
 python/samba/tests/dcerpc/sam.py                   |  108 +-
 python/samba/tests/dcerpc/unix.py                  |    4 +-
 python/samba/tests/dns.py                          |  110 +-
 python/samba/tests/dns_base.py                     |   12 +-
 python/samba/tests/dns_forwarder.py                |    4 +-
 python/samba/tests/dns_tkey.py                     |    8 +-
 python/samba/tests/dns_wildcard.py                 |   48 +-
 python/samba/tests/dsdb.py                         |   10 +-
 python/samba/tests/dsdb_schema_attributes.py       |   52 +-
 python/samba/tests/encrypted_secrets.py            |    2 +-
 python/samba/tests/get_opt.py                      |   14 +-
 python/samba/tests/gpo.py                          |   22 +-
 python/samba/tests/group_audit.py                  |   70 +-
 python/samba/tests/hostconfig.py                   |   10 +-
 python/samba/tests/join.py                         |   12 +-
 python/samba/tests/kcc/graph.py                    |    4 +-
 python/samba/tests/kcc/kcc_utils.py                |    4 +-
 python/samba/tests/netcmd.py                       |   10 +-
 python/samba/tests/ntacls.py                       |    4 +-
 python/samba/tests/ntacls_backup.py                |    8 +-
 python/samba/tests/ntlm_auth.py                    |   24 +-
 python/samba/tests/param.py                        |   14 +-
 python/samba/tests/password_hash.py                |   14 +-
 python/samba/tests/password_hash_fl2003.py         |   76 +-
 python/samba/tests/password_hash_fl2008.py         |   92 +-
 python/samba/tests/password_hash_gpgme.py          |  104 +-
 python/samba/tests/password_hash_ldap.py           |    2 +-
 python/samba/tests/policy.py                       |    4 +-
 python/samba/tests/posixacl.py                     |  466 +++---
 python/samba/tests/prefork_restart.py              |   22 +-
 python/samba/tests/provision.py                    |   24 +-
 python/samba/tests/registry.py                     |    4 +-
 python/samba/tests/s3idmapdb.py                    |   12 +-
 python/samba/tests/s3param.py                      |    8 +-
 python/samba/tests/s3passdb.py                     |  100 +-
 python/samba/tests/s3registry.py                   |    6 +-
 python/samba/tests/s3windb.py                      |    2 +-
 python/samba/tests/samba3sam.py                    |  666 ++++-----
 python/samba/tests/samba_tool/computer.py          |   18 +-
 python/samba/tests/samba_tool/contact.py           |   20 +-
 .../samba_tool/drs_clone_dc_data_lmdb_size.py      |    4 +-
 python/samba/tests/samba_tool/dsacl.py             |   22 +-
 python/samba/tests/samba_tool/forest.py            |    4 +-
 python/samba/tests/samba_tool/fsmo.py              |    2 +-
 python/samba/tests/samba_tool/group.py             |   22 +-
 python/samba/tests/samba_tool/join_lmdb_size.py    |    8 +-
 python/samba/tests/samba_tool/ntacl.py             |   60 +-
 python/samba/tests/samba_tool/ou.py                |   22 +-
 python/samba/tests/samba_tool/passwordsettings.py  |   60 +-
 .../samba/tests/samba_tool/promote_dc_lmdb_size.py |   16 +-
 .../samba/tests/samba_tool/provision_lmdb_size.py  |    8 +-
 python/samba/tests/samba_tool/schema.py            |   12 +-
 python/samba/tests/samba_tool/sites.py             |    2 +-
 python/samba/tests/samba_tool/timecmd.py           |    4 +-
 python/samba/tests/samba_tool/user.py              |   50 +-
 .../samba/tests/samba_tool/user_virtualCryptSHA.py |   28 +-
 python/samba/tests/samba_tool/visualize_drs.py     |    2 +-
 python/samba/tests/samdb_api.py                    |   24 +-
 python/samba/tests/security.py                     |   38 +-
 python/samba/tests/smb.py                          |   10 +-
 python/samba/tests/strings.py                      |    4 +-
 python/samba/tests/upgrade.py                      |    4 +-
 python/samba/tests/upgradeprovision.py             |   30 +-
 python/samba/tests/upgradeprovisionneeddc.py       |    8 +-
 python/samba/tests/xattr.py                        |    6 +-
 source4/dsdb/tests/python/acl.py                   |  178 +--
 source4/dsdb/tests/python/deletetest.py            |   50 +-
 source4/dsdb/tests/python/dirsync.py               |    4 +-
 source4/dsdb/tests/python/dsdb_schema_info.py      |    2 +-
 source4/dsdb/tests/python/ldap.py                  |  670 ++++-----
 source4/dsdb/tests/python/ldap_schema.py           |  118 +-
 source4/dsdb/tests/python/ldap_syntaxes.py         |   62 +-
 source4/dsdb/tests/python/notification.py          |   24 +-
 source4/dsdb/tests/python/password_lockout.py      |   44 +-
 source4/dsdb/tests/python/password_lockout_base.py |   50 +-
 source4/dsdb/tests/python/password_settings.py     |   16 +-
 source4/dsdb/tests/python/passwords.py             |   98 +-
 source4/dsdb/tests/python/rodc_rwdc.py             |   24 +-
 source4/dsdb/tests/python/sam.py                   |  376 ++---
 source4/dsdb/tests/python/sec_descriptor.py        |   32 +-
 source4/dsdb/tests/python/sort.py                  |    8 +-
 source4/dsdb/tests/python/token_group.py           |   18 +-
 source4/dsdb/tests/python/tombstone_reanimation.py |   20 +-
 source4/dsdb/tests/python/urgent_replication.py    |   32 +-
 source4/dsdb/tests/python/vlv.py                   |   14 +-
 source4/torture/drs/python/cracknames.py           |   28 +-
 source4/torture/drs/python/delete_object.py        |   26 +-
 source4/torture/drs/python/drs_base.py             |   14 +-
 source4/torture/drs/python/fsmo.py                 |    2 +-
 source4/torture/drs/python/getnc_exop.py           |    2 +-
 source4/torture/drs/python/getncchanges.py         |    2 +-
 source4/torture/drs/python/repl_move.py            |  138 +-
 source4/torture/drs/python/repl_rodc.py            |   26 +-
 source4/torture/drs/python/repl_schema.py          |    4 +-
 source4/torture/drs/python/repl_secdesc.py         |   18 +-
 source4/torture/drs/python/replica_sync.py         |    8 +-
 source4/torture/drs/python/replica_sync_rodc.py    |    4 +-
 source4/torture/drs/python/ridalloc_exop.py        |    6 +-
 .../torture/drs/python/samba_tool_drs_no_dns.py    |   24 +-
 134 files changed, 3813 insertions(+), 3813 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/tests/bind.py b/auth/credentials/tests/bind.py
index 2eaf0c0fd08..79bf93355b1 100755
--- a/auth/credentials/tests/bind.py
+++ b/auth/credentials/tests/bind.py
@@ -65,7 +65,7 @@ class BindTests(samba.tests.TestCase):
 
         if self.info_dc is None:
             res = self.ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
-            self.assertEquals(len(res), 1)
+            self.assertEqual(len(res), 1)
             BindTests.info_dc = res[0]
         # cache some of RootDSE props
         self.schema_dn = self.info_dc["schemaNamingContext"][0]
@@ -120,7 +120,7 @@ unicodePwd:: """ + base64.b64encode(u"\"P at ssw0rd\"".encode('utf-16-le')).decode(
         ldb_res = self.ldb.search(base=self.domain_dn,
                                   scope=SCOPE_SUBTREE,
                                   expression="(samAccountName=%s)" % self.username)
-        self.assertEquals(len(ldb_res), 1)
+        self.assertEqual(len(ldb_res), 1)
         user_dn = ldb_res[0]["dn"]
         self.addCleanup(delete_force, self.ldb, user_dn)
 
@@ -154,7 +154,7 @@ unicodePwd:: """ + base64.b64encode(u"\"P at ssw0rd\"".encode('utf-16-le')).decode(
         ldb_res = self.ldb.search(base=self.domain_dn,
                                   scope=SCOPE_SUBTREE,
                                   expression="(samAccountName=%s)" % self.username)
-        self.assertEquals(len(ldb_res), 1)
+        self.assertEqual(len(ldb_res), 1)
         user_dn = ldb_res[0]["dn"]
         self.addCleanup(delete_force, self.ldb, user_dn)
 
diff --git a/buildtools/wafsamba/tests/test_abi.py b/buildtools/wafsamba/tests/test_abi.py
index d6bdb041f72..8521c49d8e8 100644
--- a/buildtools/wafsamba/tests/test_abi.py
+++ b/buildtools/wafsamba/tests/test_abi.py
@@ -27,30 +27,30 @@ from samba.compat import StringIO
 class NormaliseSignatureTests(TestCase):
 
     def test_function_simple(self):
-        self.assertEquals("int (const struct GUID *, const struct GUID *)",
+        self.assertEqual("int (const struct GUID *, const struct GUID *)",
             normalise_signature("$2 = {int (const struct GUID *, const struct GUID *)} 0xe871 <GUID_compare>"))
 
     def test_maps_Bool(self):
         # Some types have different internal names
-        self.assertEquals("bool (const struct GUID *)",
+        self.assertEqual("bool (const struct GUID *)",
             normalise_signature("$1 = {_Bool (const struct GUID *)} 0xe75b <GUID_all_zero>"))
 
     def test_function_keep(self):
-        self.assertEquals(
+        self.assertEqual(
             "enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)",
             normalise_signature("enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)"))
 
     def test_struct_constant(self):
-        self.assertEquals(
+        self.assertEqual(
             'uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\\000", node = "\\000\\000\\000\\000\\000"}, if_version = 0',
             normalise_signature('$239 = {uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\\000", node = "\\000\\000\\000\\000\\000"}, if_version = 0}'))
 
     def test_incomplete_sequence(self):
         # Newer versions of gdb insert these incomplete sequence elements
-        self.assertEquals(
+        self.assertEqual(
             'uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237\\350", node = "\\b\\000+\\020H`"}, if_version = 2',
             normalise_signature('$244 = {uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237", <incomplete sequence \\350>, node = "\\b\\000+\\020H`"}, if_version = 2}'))
-        self.assertEquals(
+        self.assertEqual(
             'uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237\\350", node = "\\b\\000+\\020H`"}, if_version = 2',
             normalise_signature('$244 = {uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237\\350", node = "\\b\\000+\\020H`"}, if_version = 2}'))
 
@@ -62,7 +62,7 @@ class WriteVscriptTests(TestCase):
         abi_write_vscript(f, "MYLIB", "1.0", [], {
             "old": "1.0",
             "new": "1.0"}, ["*"])
-        self.assertEquals(f.getvalue(), """\
+        self.assertEqual(f.getvalue(), """\
 1.0 {
 \tglobal:
 \t\t*;
@@ -79,7 +79,7 @@ class WriteVscriptTests(TestCase):
         abi_write_vscript(f, "MYLIB", "1.0", ["0.1"], {
             "old": "0.1",
             "new": "1.0"}, ["*"])
-        self.assertEquals(f.getvalue(), """\
+        self.assertEqual(f.getvalue(), """\
 MYLIB_0.1 {
 \tglobal:
 \t\told;
@@ -101,7 +101,7 @@ MYLIB_0.1 {
             "exc_old": "0.1",
             "old": "0.1",
             "new": "1.0"}, ["!exc_*"])
-        self.assertEquals(f.getvalue(), """\
+        self.assertEqual(f.getvalue(), """\
 1.0 {
 \tglobal:
 \t\t*;
@@ -120,7 +120,7 @@ MYLIB_0.1 {
             "exc_bar": "1.0",
             "other": "1.0"
             }, ["pub_*", "!exc_*"])
-        self.assertEquals(f.getvalue(), """\
+        self.assertEqual(f.getvalue(), """\
 1.0 {
 \tglobal:
 \t\tpub_*;
diff --git a/buildtools/wafsamba/tests/test_bundled.py b/buildtools/wafsamba/tests/test_bundled.py
index c5f0db63cba..a8e982190d1 100644
--- a/buildtools/wafsamba/tests/test_bundled.py
+++ b/buildtools/wafsamba/tests/test_bundled.py
@@ -24,4 +24,4 @@ from wafsamba.samba_bundled import (
 class TuplizeVersionTests(TestCase):
 
     def test_simple(self):
-        self.assertEquals((1, 2, 10), tuplize_version("1.2.10"))
+        self.assertEqual((1, 2, 10), tuplize_version("1.2.10"))
diff --git a/buildtools/wafsamba/tests/test_utils.py b/buildtools/wafsamba/tests/test_utils.py
index a9578e25ae6..77fc55c0e52 100644
--- a/buildtools/wafsamba/tests/test_utils.py
+++ b/buildtools/wafsamba/tests/test_utils.py
@@ -26,33 +26,33 @@ from wafsamba.samba_utils import (
 class ToListTests(TestCase):
 
     def test_none(self):
-        self.assertEquals([], TO_LIST(None))
+        self.assertEqual([], TO_LIST(None))
 
     def test_already_list(self):
-        self.assertEquals(["foo", "bar", 1], TO_LIST(["foo", "bar", 1]))
+        self.assertEqual(["foo", "bar", 1], TO_LIST(["foo", "bar", 1]))
 
     def test_default_delimiter(self):
-        self.assertEquals(["foo", "bar"], TO_LIST("foo bar"))
-        self.assertEquals(["foo", "bar"], TO_LIST("  foo bar  "))
-        self.assertEquals(["foo ", "bar"], TO_LIST("  \"foo \" bar  "))
+        self.assertEqual(["foo", "bar"], TO_LIST("foo bar"))
+        self.assertEqual(["foo", "bar"], TO_LIST("  foo bar  "))
+        self.assertEqual(["foo ", "bar"], TO_LIST("  \"foo \" bar  "))
 
     def test_delimiter(self):
-        self.assertEquals(["foo", "bar"], TO_LIST("foo,bar", ","))
-        self.assertEquals(["  foo", "bar  "], TO_LIST("  foo,bar  ", ","))
-        self.assertEquals(["  \" foo\"", " bar  "], TO_LIST("  \" foo\", bar  ", ","))
+        self.assertEqual(["foo", "bar"], TO_LIST("foo,bar", ","))
+        self.assertEqual(["  foo", "bar  "], TO_LIST("  foo,bar  ", ","))
+        self.assertEqual(["  \" foo\"", " bar  "], TO_LIST("  \" foo\", bar  ", ","))
 
 
 class UniqueListTests(TestCase):
 
     def test_unique_list(self):
-        self.assertEquals(["foo", "bar"], unique_list(["foo", "bar", "foo"]))
+        self.assertEqual(["foo", "bar"], unique_list(["foo", "bar", "foo"]))
 
 
 class SubstVarsErrorTests(TestCase):
 
     def test_valid(self):
-        self.assertEquals("", subst_vars_error("", {}))
-        self.assertEquals("FOO bar", subst_vars_error("${F} bar", {"F": "FOO"}))
+        self.assertEqual("", subst_vars_error("", {}))
+        self.assertEqual("FOO bar", subst_vars_error("${F} bar", {"F": "FOO"}))
 
     def test_invalid(self):
         self.assertRaises(KeyError, subst_vars_error, "${F}", {})
@@ -63,14 +63,14 @@ class DictConcatTests(TestCase):
     def test_empty(self):
         ret = {}
         dict_concat(ret, {})
-        self.assertEquals({}, ret)
+        self.assertEqual({}, ret)
 
     def test_same(self):
         ret = {"foo": "bar"}
         dict_concat(ret, {"foo": "bla"})
-        self.assertEquals({"foo": "bar"}, ret)
+        self.assertEqual({"foo": "bar"}, ret)
 
     def test_simple(self):
         ret = {"foo": "bar"}
         dict_concat(ret, {"blie": "bla"})
-        self.assertEquals({"foo": "bar", "blie": "bla"}, ret)
+        self.assertEqual({"foo": "bar", "blie": "bla"}, ret)
diff --git a/lib/ldb-samba/tests/match_rules.py b/lib/ldb-samba/tests/match_rules.py
index 0ad375653f6..abf485c9eab 100755
--- a/lib/ldb-samba/tests/match_rules.py
+++ b/lib/ldb-samba/tests/match_rules.py
@@ -1132,7 +1132,7 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="memberOf=cn=g1,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 2)
+        self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn) for res in res1]
         self.assertTrue("CN=g2,%s" % self.ou_groups in dn_list)
         self.assertTrue("CN=u2,%s" % self.ou_users in dn_list)
@@ -1140,7 +1140,7 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="memberOf:1.2.840.113556.1.4.1941:=cn=g1,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 6)
+        self.assertEqual(len(res1), 6)
         dn_list = [str(res.dn) for res in res1]
         self.assertTrue("CN=u2,%s" % self.ou_users in dn_list)
         self.assertTrue("CN=u3,%s" % self.ou_users in dn_list)
@@ -1152,18 +1152,18 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="member=cn=g1,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 0)
+        self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="member:1.2.840.113556.1.4.1941:=cn=g1,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 0)
+        self.assertEqual(len(res1), 0)
 
     def test_g2_members(self):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="memberOf=cn=g2,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 2)
+        self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn) for res in res1]
         self.assertTrue("CN=g3,%s" % self.ou_groups in dn_list)
         self.assertTrue("CN=u2,%s" % self.ou_users in dn_list)
@@ -1171,7 +1171,7 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="memberOf:1.2.840.113556.1.4.1941:=cn=g2,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 5)
+        self.assertEqual(len(res1), 5)
         dn_list = [str(res.dn) for res in res1]
         self.assertTrue("CN=u2,%s" % self.ou_users in dn_list)
         self.assertTrue("CN=u3,%s" % self.ou_users in dn_list)
@@ -1182,20 +1182,20 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="member=cn=g2,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 1)
-        self.assertEquals(str(res1[0].dn), "CN=g1,%s" % self.ou_groups)
+        self.assertEqual(len(res1), 1)
+        self.assertEqual(str(res1[0].dn), "CN=g1,%s" % self.ou_groups)
 
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="member:1.2.840.113556.1.4.1941:=cn=g2,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 1)
-        self.assertEquals(str(res1[0].dn), "CN=g1,%s" % self.ou_groups)
+        self.assertEqual(len(res1), 1)
+        self.assertEqual(str(res1[0].dn), "CN=g1,%s" % self.ou_groups)
 
     def test_g3_members(self):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="memberOf=cn=g3,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 2)
+        self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn) for res in res1]
         self.assertTrue("CN=u3,%s" % self.ou_users in dn_list)
         self.assertTrue("CN=c3,%s" % self.ou_computers in dn_list)
@@ -1203,7 +1203,7 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="memberOf:1.2.840.113556.1.4.1941:=cn=g3,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 3)
+        self.assertEqual(len(res1), 3)
         dn_list = [str(res.dn) for res in res1]
         self.assertTrue("CN=u3,%s" % self.ou_users in dn_list)
         self.assertTrue("CN=c1,%s" % self.ou_computers in dn_list)
@@ -1212,13 +1212,13 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="member=cn=g3,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 1)
-        self.assertEquals(str(res1[0].dn), "CN=g2,%s" % self.ou_groups)
+        self.assertEqual(len(res1), 1)
+        self.assertEqual(str(res1[0].dn), "CN=g2,%s" % self.ou_groups)
 
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="member:1.2.840.113556.1.4.1941:=cn=g3,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 2)
+        self.assertEqual(len(res1), 2)
         dn_list = [str(res.dn) for res in res1]
         self.assertTrue("CN=g1,%s" % self.ou_groups in dn_list)
         self.assertTrue("CN=g2,%s" % self.ou_groups in dn_list)
@@ -1227,7 +1227,7 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="memberOf=cn=g4,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 3)
+        self.assertEqual(len(res1), 3)
         dn_list = [str(res.dn) for res in res1]
         self.assertTrue("CN=u3,%s" % self.ou_users in dn_list)
         self.assertTrue("CN=u4,%s" % self.ou_users in dn_list)
@@ -1236,7 +1236,7 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="memberOf:1.2.840.113556.1.4.1941:=cn=g4,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 4)
+        self.assertEqual(len(res1), 4)
         dn_list = [str(res.dn) for res in res1]
         self.assertTrue("CN=u3,%s" % self.ou_users in dn_list)
         self.assertTrue("CN=u4,%s" % self.ou_users in dn_list)
@@ -1246,12 +1246,12 @@ class MatchRuleConditionTests(samba.tests.TestCase):
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="member=cn=g4,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 0)
+        self.assertEqual(len(res1), 0)
 
         res1 = self.ldb.search(self.ou,
                                scope=SCOPE_SUBTREE,
                                expression="member:1.2.840.113556.1.4.1941:=cn=g4,%s" % self.ou_groups)
-        self.assertEquals(len(res1), 0)
+        self.assertEqual(len(res1), 0)
 
     def test_u1_members(self):
         res1 = self.ldb.search(self.ou,
diff --git a/python/samba/gp_parse/gp_inf.py b/python/samba/gp_parse/gp_inf.py
index a3c828fa82d..4480bbb589d 100644
--- a/python/samba/gp_parse/gp_inf.py
+++ b/python/samba/gp_parse/gp_inf.py
@@ -319,7 +319,7 @@ class GptTmplInfParser(GPParser):
         current_header_name = None
 
         for line in inf_file.splitlines():
-            match = re.match('\[(.*)\]', line)
+            match = re.match(r'\[(.*)\]', line)
             if match:
                 header_name = match.group(1)
                 if header_name in self.sections:
diff --git a/python/samba/netcmd/drs.py b/python/samba/netcmd/drs.py
index 9d6e8087e87..cebcca5f489 100644
--- a/python/samba/netcmd/drs.py
+++ b/python/samba/netcmd/drs.py
@@ -156,7 +156,7 @@ class cmd_drs_showrepl(Command):
                 raise
         try:
             (site, server) = drs_parse_ntds_dn(n.source_dsa_obj_dn)
-            d["DSA"] = "%s\%s" % (site, server)
+            d["DSA"] = "%s\\%s" % (site, server)
         except RuntimeError:
             pass
         return d
diff --git a/python/samba/netcmd/dsacl.py b/python/samba/netcmd/dsacl.py
index 92570760d40..d3b8b5f554e 100644
--- a/python/samba/netcmd/dsacl.py
+++ b/python/samba/netcmd/dsacl.py
@@ -114,11 +114,11 @@ class cmd_dsacl_set(Command):
         """Add new ace explicitly."""
         desc = self.read_descriptor(samdb, object_dn)
         new_ace = security.descriptor.from_sddl("D:" + new_ace,self.get_domain_sid(samdb))
-        new_ace_list = re.findall("\(.*?\)",new_ace.as_sddl())
+        new_ace_list = re.findall(r"\(.*?\)",new_ace.as_sddl())
         for new_ace in new_ace_list:
             desc_sddl = desc.as_sddl(self.get_domain_sid(samdb))
             # TODO add bindings for descriptor manipulation and get rid of this
-            desc_aces = re.findall("\(.*?\)", desc_sddl)
+            desc_aces = re.findall(r"\(.*?\)", desc_sddl)
             for ace in desc_aces:
                 if ("ID" in ace):
                     desc_sddl = desc_sddl.replace(ace, "")
diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py
index 76ba9fa18a9..4b08c62d773 100644
--- a/python/samba/netcmd/gpo.py
+++ b/python/samba/netcmd/gpo.py
@@ -248,29 +248,29 @@ def parse_unc(unc):
 
 
 def find_parser(name, flags=re.IGNORECASE):
-    if re.match('fdeploy1\.ini$', name, flags=flags):
+    if re.match(r'fdeploy1\.ini$', name, flags=flags):
         return GPFDeploy1IniParser()
-    if re.match('audit\.csv$', name, flags=flags):
+    if re.match(r'audit\.csv$', name, flags=flags):
         return GPAuditCsvParser()
-    if re.match('GptTmpl\.inf$', name, flags=flags):
+    if re.match(r'GptTmpl\.inf$', name, flags=flags):
         return GptTmplInfParser()
-    if re.match('GPT\.INI$', name, flags=flags):
+    if re.match(r'GPT\.INI$', name, flags=flags):
         return GPTIniParser()
-    if re.match('scripts.ini$', name, flags=flags):
+    if re.match(r'scripts\.ini$', name, flags=flags):
         return GPScriptsIniParser()
-    if re.match('psscripts.ini$', name, flags=flags):
+    if re.match(r'psscripts\.ini$', name, flags=flags):
         return GPScriptsIniParser()
-    if re.match('GPE\.INI$', name, flags=flags):
+    if re.match(r'GPE\.INI$', name, flags=flags):
         # This file does not appear in the protocol specifications!
         #
         # It appears to be a legacy file used to maintain gPCUserExtensionNames
         # and gPCMachineExtensionNames. We should just copy the file as binary.
         return GPParser()
-    if re.match('.*\.ini$', name, flags=flags):
+    if re.match(r'.*\.ini$', name, flags=flags):
         return GPIniParser()
-    if re.match('.*\.pol$', name, flags=flags):
+    if re.match(r'.*\.pol$', name, flags=flags):
         return GPPolParser()
-    if re.match('.*\.aas$', name, flags=flags):
+    if re.match(r'.*\.aas$', name, flags=flags):
         return GPAasParser()
 
     return GPParser()
diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py
index 6051b55b31a..1d830e3082f 100644
--- a/python/samba/netcmd/ldapcmp.py
+++ b/python/samba/netcmd/ldapcmp.py
@@ -37,7 +37,7 @@ from samba.netcmd import (
     Option,
 )
 
-RE_RANGED_RESULT = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$")
+RE_RANGED_RESULT = re.compile(r"^([^;]+);range=(\d+)-(\d+|\*)$")
 
 
 class LDAPBase(object):
@@ -274,9 +274,9 @@ class Descriptor(object):
         """
         try:
             if "S:" in self.sddl:
-                res = re.search("D:(.*?)(\(.*?\))S:", self.sddl).group(2)
+                res = re.search(r"D:(.*?)(\(.*?\))S:", self.sddl).group(2)
             else:
-                res = re.search("D:(.*?)(\(.*\))", self.sddl).group(2)
+                res = re.search(r"D:(.*?)(\(.*\))", self.sddl).group(2)
         except AttributeError:
             return []
         return re.findall("(\(.*?\))", res)
diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py
index 3f22eaa1c94..e7979a7e3ab 100644
--- a/python/samba/tests/__init__.py
+++ b/python/samba/tests/__init__.py
@@ -298,7 +298,7 @@ class TestCaseInTempDir(TestCase):
 
     def _remove_tempdir(self):
         # Note asserting here is treated as an error rather than a test failure
-        self.assertEquals([], os.listdir(self.tempdir))
+        self.assertEqual([], os.listdir(self.tempdir))
         os.rmdir(self.tempdir)
         self.tempdir = None
 
diff --git a/python/samba/tests/audit_log_dsdb.py b/python/samba/tests/audit_log_dsdb.py
index 29861332518..5de25502087 100644
--- a/python/samba/tests/audit_log_dsdb.py
+++ b/python/samba/tests/audit_log_dsdb.py
@@ -137,18 +137,18 @@ class AuditLogDsdbTests(AuditLogTestBase):
 
         messages = self.waitForMessages(1, net, dn=dn)
         print("Received %d messages" % len(messages))
-        self.assertEquals(1,
+        self.assertEqual(1,
                           len(messages),
                           "Did not receive the expected number of messages")
 
         audit = messages[0]["dsdbChange"]
-        self.assertEquals("Modify", audit["operation"])
+        self.assertEqual("Modify", audit["operation"])
         self.assertFalse(audit["performedAsSystem"])
         self.assertTrue(dn.lower(), audit["dn"].lower())
         self.assertRegexpMatches(audit["remoteAddress"],
                                  self.remoteAddress)
         session_id = self.get_session()
-        self.assertEquals(session_id, audit["sessionId"])
+        self.assertEqual(session_id, audit["sessionId"])
         # We skip the check for self.get_service_description() as this
         # is subject to a race between smbd and the s4 rpc_server code
         # as to which will set the description as it is DCE/RPC over SMB
@@ -156,11 +156,11 @@ class AuditLogDsdbTests(AuditLogTestBase):
         self.assertTrue(self.is_guid(audit["transactionId"]))
 
         attributes = audit["attributes"]
-        self.assertEquals(1, len(attributes))
+        self.assertEqual(1, len(attributes))
         actions = attributes["clearTextPassword"]["actions"]
-        self.assertEquals(1, len(actions))
+        self.assertEqual(1, len(actions))
         self.assertTrue(actions[0]["redacted"])
-        self.assertEquals("replace", actions[0]["action"])
+        self.assertEqual("replace", actions[0]["action"])
 
     def test_net_set_password(self):
 
@@ -179,17 +179,17 @@ class AuditLogDsdbTests(AuditLogTestBase):
                          domain_name=domain)
         messages = self.waitForMessages(1, net, dn=dn)
         print("Received %d messages" % len(messages))
-        self.assertEquals(1,
+        self.assertEqual(1,
                           len(messages),
                           "Did not receive the expected number of messages")
         audit = messages[0]["dsdbChange"]
-        self.assertEquals("Modify", audit["operation"])


-- 
Samba Shared Repository



More information about the samba-cvs mailing list