[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Tue Aug 22 00:37:02 UTC 2023


The branch, master has been updated
       via  aba7eb094b9 selftest: Report time at which testsuite starts
       via  fc41a35a9bd selftest: Fix subunit reporting the time incorrectly
       via  cbc0ff187a0 selftest: Remove leftover from debugging
       via  7ce6e3c9cac selftest: Remove unused variable
       via  c2126e08f47 selftest: Remove semicolon
       via  892c1b0a0c9 s4:torture: Fix code spelling
       via  783f09cc37f s4:smb_server: Fix code spelling
       via  4b03aabe451 s4:kdc: Use smb_krb5_make_data()
       via  6d2c7c45ca4 s4:kdc: Use ‘krb5_error_code’ for return types
       via  9166d01b19f s4:kdc: Set SAMBA_KDC_FLAG_PROTOCOL_TRANSITION flag for MIT Kerberos
       via  bbfa98ec05c s4:kdc: Remove support code for older versions of MIT Kerberos
       via  6b580f73688 s4:kdc: Do not panic if authsam_logon_success_accounting() fails
       via  448cc122a8f s3:rpc_server: Remove unnecessary cast
       via  b3c47b65836 s3:libnet: Fix reference to incorrect function names
       via  4004ded906d s3:libnet: Remove unnecessary cast
       via  683dab11024 python:tests: Save files with intended contents
       via  2d6b10da225 python:tests: Fix spelling
       via  981c3413893 python:tests: Reuse policies and silos created by setUp() across all tests
       via  f71893c1a3e python:tests: Reuse claims created by setUp() across all tests
       via  a985873c46f python:tests: Make getSamDB() a static method
       via  b7e00680102 python:subunit: Use ‘is’ to compare variables with singletons
       via  c052b17556b python:subunit: Fix docstring
       via  859bbef4722 python:netcmd: Remove semicolon
       via  d40293e0df5 python:netcmd: Add missing newlines to error messages
       via  a836b433ed7 pidl: Use non-existent function dissect_ndr_int64()
       via  d5cbb542d0f librpc:ndr: Use portable integer types
       via  593a7fb6382 libcli/auth: Remove unnecessary casts
       via  d608dc175e0 lib:krb5_wrap: Fix references to incorrect function names
       via  02b546778f0 lib:krb5_wrap: Fix code spelling
      from  37fdd79cc0b tests/krb5: Remove incorrect comments

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


- Log -----------------------------------------------------------------
commit aba7eb094b978f69a632ec6e9080d55b788c9001
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 13:29:41 2023 +1200

    selftest: Report time at which testsuite starts
    
    With no call to report_time() preceding it,
    PlainFormatter.start_testsuite() would always claim that no time had
    elapsed prior to the first testsuite starting to run. This gave a
    misleading impression of the time spent running the first testsuite. Now
    the time will be consistent with that reported for subsequent
    testsuites, and will properly include any time that test environments
    took to start up.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue Aug 22 00:36:52 UTC 2023 on atb-devel-224

commit fc41a35a9bd8706d8a3770a2b8f1467cd00452b8
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 12:46:17 2023 +1200

    selftest: Fix subunit reporting the time incorrectly
    
    Although report_time() would output the time in UTC, it neglected to
    specify the timezone offset. Thus subunithelper.parse_results() would
    interpret the time string it was given as being in local time.
    TestProtocolClient.time() then converted that *back* into UTC, giving an
    incorrect result (unless UTC is your local timezone).
    
    Fix this by having report_time() indicate that the time zone is UTC.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15162
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit cbc0ff187a0cc54dddfe60235a555676a546cc6f
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 13:42:47 2023 +1200

    selftest: Remove leftover from debugging
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7ce6e3c9cac1653579d7f4efdfca76491c1fa5e7
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 16 15:20:48 2023 +1200

    selftest: Remove unused variable
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c2126e08f4764da3d1033ec72f704e7abe54ba67
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 16 15:19:05 2023 +1200

    selftest: Remove semicolon
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 892c1b0a0c97e09a553a4084a1819827a437126a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 2 14:52:13 2023 +1200

    s4:torture: Fix code spelling
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 783f09cc37fcd4ec31ca6ba7d268f8aa11ea832b
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 1 15:52:07 2023 +1200

    s4:smb_server: Fix code spelling
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4b03aabe451bae6bbeadcaaf8c2ff62041511ca3
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 16 15:57:53 2023 +1200

    s4:kdc: Use smb_krb5_make_data()
    
    smb_krb5_make_data() sets the magic field, which we were previously
    ignoring. We should also not set krb5_data::length if krb5_data::data is
    NULL.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6d2c7c45ca4f40cf5f0cddd5fa7f67c2c29a0a54
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 16 15:57:00 2023 +1200

    s4:kdc: Use ‘krb5_error_code’ for return types
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 9166d01b19f32b308099969069b1f68d5f5b617c
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 16 10:18:59 2023 +1200

    s4:kdc: Set SAMBA_KDC_FLAG_PROTOCOL_TRANSITION flag for MIT Kerberos
    
    This flag was set in commit 461dc44e740aacad41bb0df0552560d1eb3c6ea8,
    but only in mit_samba_reget_pac(); it was not set in the newer function,
    mit_samba_update_pac(), used with MIT Kerberos 1.20 and above.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit bbfa98ec05c800dfcd165e1159e1d595d90209f1
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 15 15:16:57 2023 +1200

    s4:kdc: Remove support code for older versions of MIT Kerberos
    
    The oldest version we now support is 1.21. For every supported version
    we can be certain that KRB5_KDB_API_VERSION >= 10 and
    KRB5_KDB_DAL_MAJOR_VERSION >= 9.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6b580f73688bd6517789d1e8663042b0e310e848
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Aug 14 10:50:37 2023 +1200

    s4:kdc: Do not panic if authsam_logon_success_accounting() fails
    
    In hdb_samba4_audit(), ERR_GENERIC signals an unexpected situation — if
    we encounter that error code while running under selftest, we’ll panic.
    In response to an expected event such as the failure of
    authsam_logon_success_accounting(), it’s more appropriate to continue to
    run.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 448cc122a8f484377a37460f804cbe834b8ff70b
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 9 16:54:02 2023 +1200

    s3:rpc_server: Remove unnecessary cast
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b3c47b65836db2ea0dd2dc027508ca24e9d7b512
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 16 09:47:18 2023 +1200

    s3:libnet: Fix reference to incorrect function names
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4004ded906d838ee7b7fe9c46e9cbcd95633cf20
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 9 16:53:21 2023 +1200

    s3:libnet: Remove unnecessary cast
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 683dab11024f9a3fff2e54a90866c3c9ef8095ab
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 11:13:50 2023 +1200

    python:tests: Save files with intended contents
    
    We presumably here meant to use the variable ‘contents’, not
    ‘test_contents’.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2d6b10da2252d4b421a19462010d87ac652c31c5
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 11:07:27 2023 +1200

    python:tests: Fix spelling
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 981c34138939878f1550650d50c7bb6fd72c4684
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 13:29:49 2023 +1200

    python:tests: Reuse policies and silos created by setUp() across all tests
    
    We now create the claims in setUp() only once, preserving them so as to
    reuse them across all of the tests using this class. Then we finally
    delete them all in tearDownClass().
    
    addClassCleanup() could make this cleaner, but it’s available only in
    Python 3.8 and above.
    
    This change reduces the time taken by my machine to run
    samba.tests.samba_tool.domain_auth_policy from two minutes to ten
    seconds.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f71893c1a3ea28c09648fd35a378157acaebac0e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 10:27:44 2023 +1200

    python:tests: Reuse claims created by setUp() across all tests
    
    We now create the claims in setUp() only once, preserving them so as to
    reuse them across all of the tests in this class. Then we finally delete
    them all in tearDownClass().
    
    addClassCleanup() could make this cleaner, but it’s available only in
    Python 3.8 and above.
    
    This change reduces the time taken by my machine to run these tests from
    four minutes to twenty seconds.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a985873c46fb527296e4e9b9371b397d3c2baba5
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 10:22:35 2023 +1200

    python:tests: Make getSamDB() a static method
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b7e006801021209a95b1811ca1e236bbcac8b4df
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 13:29:00 2023 +1200

    python:subunit: Use ‘is’ to compare variables with singletons
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c052b17556b6471daa29419191df4759dee93268
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 12:45:05 2023 +1200

    python:subunit: Fix docstring
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 859bbef47226735a9eba9a71215915e9022e5926
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Aug 17 11:06:01 2023 +1200

    python:netcmd: Remove semicolon
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d40293e0df53c300dee03628716c7e2aa679a40e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Aug 7 10:25:12 2023 +1200

    python:netcmd: Add missing newlines to error messages
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a836b433ed7f0acca546558d2aec359155999f30
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 16 09:27:37 2023 +1200

    pidl: Use non-existent function dissect_ndr_int64()
    
    This function does not exist yet, but Wireshark can implement it if they
    ever choose to regenerate their NDR dissectors.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d5cbb542d0f915407ce720edddfc74bdfd6c2b2d
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Aug 15 12:37:55 2023 +1200

    librpc:ndr: Use portable integer types
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 593a7fb638276e5089b48841524d217a28c6823e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 9 16:52:31 2023 +1200

    libcli/auth: Remove unnecessary casts
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d608dc175e07775424af110559f4b2bb01e6f2a3
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 16 09:46:49 2023 +1200

    lib:krb5_wrap: Fix references to incorrect function names
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 02b546778f0aa6f983419b899f8df9b9313ef1de
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 16 09:46:18 2023 +1200

    lib:krb5_wrap: Fix code spelling
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 lib/krb5_wrap/krb5_samba.c                         |  28 +-
 libcli/auth/ntlm_check.c                           |   2 +-
 libcli/auth/smbencrypt.c                           |   4 +-
 librpc/ndr/ndr.c                                   |   4 +-
 pidl/lib/Parse/Pidl/Wireshark/NDR.pm               |   2 +-
 python/samba/netcmd/domain/demote.py               |   4 +-
 python/samba/netcmd/user/sensitive.py              |   2 +-
 python/samba/subunit/run.py                        |  10 +-
 python/samba/tests/blackbox/smbcacls.py            |   2 +-
 python/samba/tests/blackbox/smbcacls_basic.py      |   2 +-
 .../blackbox/smbcacls_dfs_propagate_inherit.py     |   2 +-
 .../blackbox/smbcacls_propagate_inhertance.py      |   2 +-
 python/samba/tests/samba_tool/base.py              |   3 +-
 python/samba/tests/samba_tool/domain_auth_base.py  |  88 +++--
 python/samba/tests/samba_tool/domain_auth_silo.py  |   2 +-
 python/samba/tests/samba_tool/domain_claim.py      |  69 ++--
 python/samba/tests/smb.py                          |   2 +-
 selftest/Subunit.pm                                |   2 +-
 selftest/selftest.pl                               |   1 +
 selftest/subunithelper.py                          |   5 +-
 source3/libnet/libnet_join.c                       |   2 +-
 source3/libnet/libnet_keytab.c                     |   4 +-
 source3/rpc_server/netlogon/srv_netlog_nt.c        |   2 +-
 source4/kdc/hdb-samba4.c                           |   2 +-
 source4/kdc/mit-kdb/kdb_samba.c                    |   6 +-
 source4/kdc/mit-kdb/kdb_samba_policies.c           | 374 ---------------------
 source4/kdc/mit_samba.c                            | 256 +++-----------
 source4/smb_server/smb/negprot.c                   |   2 +-
 source4/torture/basic/misc.c                       |   2 +-
 29 files changed, 195 insertions(+), 691 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c
index 18230603b29..9177cd7b5dd 100644
--- a/lib/krb5_wrap/krb5_samba.c
+++ b/lib/krb5_wrap/krb5_samba.c
@@ -456,7 +456,7 @@ int smb_krb5_get_pw_salt(krb5_context context,
  * @param[in]  sAMAccountName     The sAMAccountName attribute of the object.
  *
  * @param[in]  userPrincipalName  The userPrincipalName attribute of the object
- *                                or NULL is not available.
+ *                                or NULL if not available.
  *
  * @param[in]  uac_flags          UF_ACCOUNT_TYPE_MASKed userAccountControl field
  *
@@ -656,7 +656,7 @@ int smb_krb5_salt_principal(krb5_context krb5_ctx,
  * @param[in]  sAMAccountName     The sAMAccountName attribute of the object.
  *
  * @param[in]  userPrincipalName  The userPrincipalName attribute of the object
- *                                or NULL is not available.
+ *                                or NULL if not available.
  *
  * @param[in]  uac_flags          UF_ACCOUNT_TYPE_MASKed userAccountControl field
  *
@@ -735,7 +735,7 @@ int smb_krb5_salt_principal_str(const char *realm,
  * @param[in]  sAMAccountName     The sAMAccountName attribute of the object.
  *
  * @param[in]  userPrincipalName  The userPrincipalName attribute of the object
- *                                or NULL is not available.
+ *                                or NULL if not available.
  *
  * @param[in]  is_computer        The indication of the object includes
  *                                objectClass=computer.
@@ -1441,7 +1441,7 @@ krb5_error_code smb_krb5_kt_open_relative(krb5_context context,
 		return krb5_kt_default(context, keytab);
 	}
 
-	mem_ctx = talloc_init("smb_krb5_open_keytab");
+	mem_ctx = talloc_init("smb_krb5_kt_open_relative");
 	if (!mem_ctx) {
 		return ENOMEM;
 	}
@@ -1482,7 +1482,7 @@ krb5_error_code smb_krb5_kt_open_relative(krb5_context context,
 		goto out;
 	}
 
-	DEBUG(10,("smb_krb5_open_keytab: krb5_kt_default_name returned %s\n", keytab_string));
+	DBG_DEBUG("krb5_kt_default_name returned %s\n", keytab_string);
 
 	tmp = talloc_strdup(mem_ctx, keytab_string);
 	if (!tmp) {
@@ -1535,7 +1535,7 @@ krb5_error_code smb_krb5_kt_open_relative(krb5_context context,
 	}
 
 resolve:
-	DEBUG(10,("smb_krb5_open_keytab: resolving: %s\n", tmp));
+	DBG_DEBUG("resolving: %s\n", tmp);
 	ret = krb5_kt_resolve(context, tmp, keytab);
 
 out:
@@ -1759,7 +1759,7 @@ krb5_error_code smb_krb5_kt_seek_and_delete_old_entries(krb5_context context,
 		 * Save the entries with kvno - 1. This is what microsoft does
 		 * to allow people with existing sessions that have kvno - 1
 		 * to still work. Otherwise, when the password for the machine
-		 * changes, all kerberizied sessions will 'break' until either
+		 * changes, all kerberized sessions will 'break' until either
 		 * the client reboots or the client's session key expires and
 		 * they get a new session ticket with the new kvno.
 		 * Some keytab files only store the kvno in 8bits, limit
@@ -2668,10 +2668,9 @@ krb5_error_code smb_krb5_kinit_s4u2_ccache(krb5_context ctx,
 		if (code != 0) {
 			ip = NULL;
 		}
-		DEBUG(1, ("smb_krb5_kinit_password_cache: "
-			  "KDC returned self principal[%s] while impersonating [%s]\n",
-			  sp?sp:"<no memory>",
-			  ip?ip:"<no memory>"));
+		DBG_WARNING("KDC returned self principal[%s] while impersonating [%s]\n",
+			    sp?sp:"<no memory>",
+			    ip?ip:"<no memory>");
 
 		SAFE_FREE(sp);
 		SAFE_FREE(ip);
@@ -2698,10 +2697,9 @@ krb5_error_code smb_krb5_kinit_s4u2_ccache(krb5_context ctx,
 		if (code != 0) {
 			ep = NULL;
 		}
-		DEBUG(1, ("smb_krb5_kinit_password_cache: "
-			  "KDC returned wrong principal[%s] we expected [%s]\n",
-			  sp?sp:"<no memory>",
-			  ep?ep:"<no memory>"));
+		DBG_WARNING("KDC returned wrong principal[%s] we expected [%s]\n",
+			    sp?sp:"<no memory>",
+			    ep?ep:"<no memory>");
 
 		SAFE_FREE(sp);
 		SAFE_FREE(ep);
diff --git a/libcli/auth/ntlm_check.c b/libcli/auth/ntlm_check.c
index 3927dfa7836..a2388706bcf 100644
--- a/libcli/auth/ntlm_check.c
+++ b/libcli/auth/ntlm_check.c
@@ -383,7 +383,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
 		if (lm_response->length && 
 		    (convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, 
 					  lm_response->data, lm_response->length, 
-					   (void *)&unix_pw, &converted_size))) {
+					   &unix_pw, &converted_size))) {
 			if (E_deshash(unix_pw, client_lm.hash)) {
 				lm_ok = true;
 			} else {
diff --git a/libcli/auth/smbencrypt.c b/libcli/auth/smbencrypt.c
index d525b373e86..73c696c95c1 100644
--- a/libcli/auth/smbencrypt.c
+++ b/libcli/auth/smbencrypt.c
@@ -968,7 +968,7 @@ bool decode_pw_buffer(TALLOC_CTX *ctx,
 				   CH_UNIX,
 				   new_password.data,
 				   new_password.length,
-				   (void *)pp_new_pwrd,
+				   pp_new_pwrd,
 				   new_pw_len);
 	data_blob_free(&new_password);
 	if (!ok) {
@@ -1062,7 +1062,7 @@ bool decode_pwd_string_from_buffer514(TALLOC_CTX *mem_ctx,
 				   CH_UNIX,
 				   new_password.data,
 				   new_password.length,
-				   (void *)&decoded_password->data,
+				   &decoded_password->data,
 				   &decoded_password->length);
 	data_blob_free(&new_password);
 	if (!ok) {
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index d9437785ac8..a2a8585249e 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -1012,12 +1012,12 @@ _PUBLIC_ enum ndr_err_code ndr_token_store(TALLOC_CTX *mem_ctx,
 			return NDR_ERR_RANGE;
 		}
 		if (list->count == alloc_count) {
-			unsigned new_alloc;
+			uint32_t new_alloc;
 			/*
 			 * Double the list, until we start in chunks
 			 * of 1000
 			 */
-			unsigned increment = MIN(list->count, 1000);
+			uint32_t increment = MIN(list->count, 1000);
 			new_alloc = alloc_count + increment;
 			if (new_alloc < alloc_count) {
 				return NDR_ERR_RANGE;
diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 83fe6cf2c27..23e8a0f0820 100644
--- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -1080,7 +1080,7 @@ sub Initialize($$)
 
 	$self->register_type("uint3264", "offset = dissect_ndr_uint3264(tvb, offset, pinfo, tree, di, drep, \@HF\@, NULL);", "FT_UINT32", "BASE_DEC", 0, "NULL", 8);
 	$self->register_type("hyper", "offset = dissect_ndr_uint64(tvb, offset, pinfo, tree, di, drep, \@HF\@, NULL);", "FT_UINT64", "BASE_DEC", 0, "NULL", 8);
-	$self->register_type("int64", "offset = dissect_ndr_uint64(tvb, offset, pinfo, tree, di, drep, \@HF\@, NULL);", "FT_INT64", "BASE_DEC", 0, "NULL", 8);
+	$self->register_type("int64", "offset = dissect_ndr_int64(tvb, offset, pinfo, tree, di, drep, \@HF\@, NULL);", "FT_INT64", "BASE_DEC", 0, "NULL", 8);
 	$self->register_type("udlong", "offset = dissect_ndr_duint32(tvb, offset, pinfo, tree, di, drep, \@HF\@, NULL);", "FT_UINT64", "BASE_DEC", 0, "NULL", 4);
 	$self->register_type("bool8", "offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, di, drep, \@HF\@, \@PARAM\@);","FT_INT8", "BASE_DEC", 0, "NULL", 1);
 	$self->register_type("char", "offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, di, drep, \@HF\@, \@PARAM\@);","FT_INT8", "BASE_DEC", 0, "NULL", 1);
diff --git a/python/samba/netcmd/domain/demote.py b/python/samba/netcmd/domain/demote.py
index 217d90a4b91..ae4d11dee43 100644
--- a/python/samba/netcmd/domain/demote.py
+++ b/python/samba/netcmd/domain/demote.py
@@ -185,7 +185,7 @@ class cmd_domain_demote(Command):
         if (len(res) != 1):
             if not (dsa_options & DS_NTDSDSA_OPT_DISABLE_OUTBOUND_REPL) and not samdb.am_rodc():
                 self.errf.write(
-                    "Error while demoting, re-enabling inbound replication")
+                    "Error while demoting, re-enabling inbound replication\n")
                 dsa_options ^= DS_NTDSDSA_OPT_DISABLE_INBOUND_REPL
                 nmsg["options"] = ldb.MessageElement(str(dsa_options), ldb.FLAG_MOD_REPLACE, "options")
                 samdb.modify(nmsg)
@@ -208,7 +208,7 @@ class cmd_domain_demote(Command):
         except Exception as e:
             if not (dsa_options & DS_NTDSDSA_OPT_DISABLE_OUTBOUND_REPL) and not samdb.am_rodc():
                 self.errf.write(
-                    "Error while demoting, re-enabling inbound replication")
+                    "Error while demoting, re-enabling inbound replication\n")
                 dsa_options ^= DS_NTDSDSA_OPT_DISABLE_INBOUND_REPL
                 nmsg["options"] = ldb.MessageElement(str(dsa_options), ldb.FLAG_MOD_REPLACE, "options")
                 samdb.modify(nmsg)
diff --git a/python/samba/netcmd/user/sensitive.py b/python/samba/netcmd/user/sensitive.py
index a0b50bdf6de..11edb2f1e90 100644
--- a/python/samba/netcmd/user/sensitive.py
+++ b/python/samba/netcmd/user/sensitive.py
@@ -56,7 +56,7 @@ class cmd_user_sensitive(Command):
                     credentials=creds, lp=lp)
 
         search_filter = "sAMAccountName=%s" % ldb.binary_encode(accountname)
-        flag = dsdb.UF_NOT_DELEGATED;
+        flag = dsdb.UF_NOT_DELEGATED
 
         if cmd == "show":
             res = sam.search(scope=ldb.SCOPE_SUBTREE, expression=search_filter,
diff --git a/python/samba/subunit/run.py b/python/samba/subunit/run.py
index d331c79ab0d..7881db448a8 100755
--- a/python/samba/subunit/run.py
+++ b/python/samba/subunit/run.py
@@ -160,7 +160,7 @@ class TestProtocolClient(unittest.TestResult):
     def time(self, a_datetime):
         """Inform the client of the time.
 
-        ":param datetime: A datetime.datetime object.
+        ":param a_datetime: A datetime.datetime object.
         """
         time = a_datetime.astimezone(datetime.timezone.utc)
         self._stream.write("time: %04d-%02d-%02d %02d:%02d:%02d.%06dZ\n" % (
@@ -598,11 +598,11 @@ class TestProgram(object):
         parser.prog = self.progName
         parser.add_option('-v', '--verbose', dest='verbose', default=False,
                           help='Verbose output', action='store_true')
-        if self.catchbreak != False:
+        if self.catchbreak is not False:
             parser.add_option('-c', '--catch', dest='catchbreak', default=False,
                               help='Catch ctrl-C and display results so far',
                               action='store_true')
-        if self.buffer != False:
+        if self.buffer is not False:
             parser.add_option('-b', '--buffer', dest='buffer', default=False,
                               help='Buffer stdout and stderr during tests',
                               action='store_true')
@@ -666,9 +666,9 @@ class TestProgram(object):
             print (msg)
         usage = {'progName': self.progName, 'catchbreak': '',
                  'buffer': ''}
-        if self.catchbreak != False:
+        if self.catchbreak is not False:
             usage['catchbreak'] = CATCHBREAK
-        if self.buffer != False:
+        if self.buffer is not False:
             usage['buffer'] = BUFFEROUTPUT
         usage_text = self.USAGE % usage
         usage_lines = usage_text.split('\n')
diff --git a/python/samba/tests/blackbox/smbcacls.py b/python/samba/tests/blackbox/smbcacls.py
index 608e2c918af..219ddc243cf 100644
--- a/python/samba/tests/blackbox/smbcacls.py
+++ b/python/samba/tests/blackbox/smbcacls.py
@@ -1,4 +1,4 @@
-# Blackbox tests for smbcaclcs
+# Blackbox tests for smbcacls
 #
 # Copyright (C) Noel Power noel.power at suse.com
 #
diff --git a/python/samba/tests/blackbox/smbcacls_basic.py b/python/samba/tests/blackbox/smbcacls_basic.py
index 355ce86f42a..7d313639863 100644
--- a/python/samba/tests/blackbox/smbcacls_basic.py
+++ b/python/samba/tests/blackbox/smbcacls_basic.py
@@ -1,4 +1,4 @@
-# Blackbox tests for smbcaclcs
+# Blackbox tests for smbcacls
 #
 # Copyright (C) Noel Power noel.power at suse.com
 #
diff --git a/python/samba/tests/blackbox/smbcacls_dfs_propagate_inherit.py b/python/samba/tests/blackbox/smbcacls_dfs_propagate_inherit.py
index b1c1df8d41e..bdb00e9dc95 100644
--- a/python/samba/tests/blackbox/smbcacls_dfs_propagate_inherit.py
+++ b/python/samba/tests/blackbox/smbcacls_dfs_propagate_inherit.py
@@ -1,4 +1,4 @@
-# Blackbox tests for smbcaclcs
+# Blackbox tests for smbcacls
 #
 # Copyright (C) Noel Power noel.power at suse.com
 #
diff --git a/python/samba/tests/blackbox/smbcacls_propagate_inhertance.py b/python/samba/tests/blackbox/smbcacls_propagate_inhertance.py
index cfe7e0b0b96..3d069225420 100644
--- a/python/samba/tests/blackbox/smbcacls_propagate_inhertance.py
+++ b/python/samba/tests/blackbox/smbcacls_propagate_inhertance.py
@@ -1,4 +1,4 @@
-# Blackbox tests for smbcaclcs
+# Blackbox tests for smbcacls
 #
 # Copyright (C) Noel Power noel.power at suse.com
 #
diff --git a/python/samba/tests/samba_tool/base.py b/python/samba/tests/samba_tool/base.py
index 76299f8023d..a5d890a2afd 100644
--- a/python/samba/tests/samba_tool/base.py
+++ b/python/samba/tests/samba_tool/base.py
@@ -42,7 +42,8 @@ class SambaToolCmdTest(samba.tests.BlackboxTestCase):
     # override if they need to (to e.g. add a lying isatty() method).
     stringIO = StringIO
 
-    def getSamDB(self, *argv):
+    @staticmethod
+    def getSamDB(*argv):
         """a convenience function to get a samdb instance so that we can query it"""
 
         # We build a fake command to get the options created the same
diff --git a/python/samba/tests/samba_tool/domain_auth_base.py b/python/samba/tests/samba_tool/domain_auth_base.py
index 66445e99c6a..54dfd90c1eb 100644
--- a/python/samba/tests/samba_tool/domain_auth_base.py
+++ b/python/samba/tests/samba_tool/domain_auth_base.py
@@ -30,39 +30,55 @@ from .base import SambaToolCmdTest
 class BaseAuthCmdTest(SambaToolCmdTest):
     def setUp(self):
         super().setUp()
-        self.host = "ldap://{DC_SERVER}".format(**os.environ)
-        self.creds = "-U{DC_USERNAME}%{DC_PASSWORD}".format(**os.environ)
-        self.samdb = self.getSamDB("-H", self.host, self.creds)
-
-        # Generate some test data.
-        self.policies = []
-        self.create_authentication_policy(name="Single Policy")
-        self.create_authentication_policy(name="User Policy")
-        self.create_authentication_policy(name="Service Policy")
-        self.create_authentication_policy(name="Computer Policy")
-
-        self.silos = []
-        self.create_authentication_silo(name="Developers",
-                                        description="Developers, Developers",
-                                        policy="Single Policy")
-        self.create_authentication_silo(name="Managers",
-                                        description="Managers",
-                                        policy="Single Policy")
-        self.create_authentication_silo(name="QA",
-                                        description="Quality Assurance",
-                                        user_policy="User Policy",
-                                        service_policy="Service Policy",
-                                        computer_policy="Computer Policy")
-
-    def tearDown(self):
-        """Remove data created by setUp."""
-        for policy in self.policies:
-            self.delete_authentication_policy(policy, force=True)
-
-        for silo in self.silos:
-            self.delete_authentication_silo(silo, force=True)
-
-        super().tearDown()
+
+        if self._first_self is None:
+            cls = type(self)
+            cls.host = "ldap://{DC_SERVER}".format(**os.environ)
+            cls.creds = "-U{DC_USERNAME}%{DC_PASSWORD}".format(**os.environ)
+            cls.samdb = self.getSamDB("-H", self.host, self.creds)
+
+            # Generate some test data.
+            self.create_authentication_policy(name="Single Policy")
+            self.create_authentication_policy(name="User Policy")
+            self.create_authentication_policy(name="Service Policy")
+            self.create_authentication_policy(name="Computer Policy")
+
+            self.create_authentication_silo(name="Developers",
+                                            description="Developers, Developers",
+                                            policy="Single Policy")
+            self.create_authentication_silo(name="Managers",
+                                            description="Managers",
+                                            policy="Single Policy")
+            self.create_authentication_silo(name="QA",
+                                            description="Quality Assurance",
+                                            user_policy="User Policy",
+                                            service_policy="Service Policy",
+                                            computer_policy="Computer Policy")
+
+            cls._first_self = self
+
+    @classmethod
+    def setUpClass(cls):
+        super().setUpClass()
+        cls._first_self = None
+        cls.policies = []
+        cls.silos = []
+
+    @classmethod
+    def tearDownClass(cls):
+        """Remove data created by setUp, and kept for the lifetime of the
+        class."""
+        first_self = cls._first_self
+        if first_self is not None:
+            for policy in first_self.policies:
+                first_self.delete_authentication_policy(policy, force=True)
+
+            for silo in first_self.silos:
+                first_self.delete_authentication_silo(silo, force=True)
+
+            cls._first_self = None
+
+        super().tearDownClass()
 
     def get_services_dn(self):
         """Returns Services DN."""
@@ -129,7 +145,8 @@ class BaseAuthCmdTest(SambaToolCmdTest):
         if protect:
             cmd.append("--protect")
 
-        # Run command and store name in self.silos for tearDown to clean up.
+        # Run command and store name in self.silos for tearDownClass to clean
+        # up.
         result, out, err = self.runcmd(*cmd)
         self.assertIsNone(result, msg=err)
         self.assertTrue(out.startswith("Created authentication policy"))
@@ -174,7 +191,8 @@ class BaseAuthCmdTest(SambaToolCmdTest):
         if audit:
             cmd.append("--audit")
 
-        # Run command and store name in self.silos for tearDown to clean up.
+        # Run command and store name in self.silos for tearDownClass to clean
+        # up.
         result, out, err = self.runcmd(*cmd)
         self.assertIsNone(result, msg=err)
         self.assertTrue(out.startswith("Created authentication silo"))
diff --git a/python/samba/tests/samba_tool/domain_auth_silo.py b/python/samba/tests/samba_tool/domain_auth_silo.py
index b9f008f779e..2b18098ba0f 100644
--- a/python/samba/tests/samba_tool/domain_auth_silo.py
+++ b/python/samba/tests/samba_tool/domain_auth_silo.py
@@ -458,7 +458,7 @@ class AuthSiloMemberCmdTestCase(BaseAuthCmdTest):
         # Remove organisational unit.
         self.samdb.delete(self.ou, ["tree_delete:1"])
 
-        # Remove members from silos before deleting them in super.
+        # Remove members from silos.
         for silo, members in self.members.items():
             for member in members:
                 self.remove_silo_member(silo, member)
diff --git a/python/samba/tests/samba_tool/domain_claim.py b/python/samba/tests/samba_tool/domain_claim.py
index 14aca17b120..60b1de04d7f 100644
--- a/python/samba/tests/samba_tool/domain_claim.py
+++ b/python/samba/tests/samba_tool/domain_claim.py
@@ -67,30 +67,57 @@ VALUE_TYPES = [
 class ClaimCmdTestCase(SambaToolCmdTest):
     def setUp(self):
         super().setUp()
-        self.host = "ldap://{DC_SERVER}".format(**os.environ)
-        self.creds = "-U{DC_USERNAME}%{DC_PASSWORD}".format(**os.environ)
-        self.samdb = self.getSamDB("-H", self.host, self.creds)
-        self.claim_types = []
+        self.this_test_claim_types = set()
 
-        # Generate some known claim types used by tests.
-        for attribute in ATTRIBUTES:
-            self.create_claim_type(attribute, classes=["user"])
+        if self._first_self is None:
+            cls = type(self)
+            cls.host = "ldap://{DC_SERVER}".format(**os.environ)
+            cls.creds = "-U{DC_USERNAME}%{DC_PASSWORD}".format(**os.environ)
+            cls.samdb = self.getSamDB("-H", self.host, self.creds)
+
+            # Generate some known claim types used by tests.
+            for attribute in ATTRIBUTES:
+                self.create_claim_type(attribute, classes=["user"], preserve=True)
 
-        # Generate some more with unique names not in the ATTRIBUTES list.
-        self.create_claim_type("accountExpires", name="expires",
-                               classes=["user"])
-        self.create_claim_type("department", name="dept", classes=["user"],
-                               protect=True)
-        self.create_claim_type("carLicense", name="plate", classes=["user"],
-                               disable=True)
+            # Generate some more with unique names not in the ATTRIBUTES list.
+            self.create_claim_type("accountExpires", name="expires",
+                                   classes=["user"], preserve=True)
+            self.create_claim_type("department", name="dept", classes=["user"],
+                                   protect=True, preserve=True)
+            self.create_claim_type("carLicense", name="plate", classes=["user"],
+                                   disable=True, preserve=True)
+
+            cls._first_self = self
 
     def tearDown(self):
-        # Remove claim types created by setUp.
-        for claim_type in self.claim_types:
-            self.delete_claim_type(claim_type, force=True)
+        # Remove claim types created by a single test.
+        first_self = self._first_self
+        if first_self is not None:
+            for claim_type in first_self.this_test_claim_types:
+                first_self.delete_claim_type(claim_type, force=True)
+                first_self.claim_types.remove(claim_type)
 
         super().tearDown()
 
+    @classmethod
+    def setUpClass(cls):
+        super().setUpClass()
+        cls._first_self = None
+        cls.claim_types = set()
+
+    @classmethod
+    def tearDownClass(cls):
+        # Remove claim types created by setUp, and kept for the lifetime of the
+        # class.
+        first_self = cls._first_self
+        if first_self is not None:
+            for claim_type in first_self.claim_types:
+                first_self.delete_claim_type(claim_type, force=True)
+
+            cls._first_self = None
+
+        super().tearDownClass()
+
     def get_services_dn(self):
         """Returns Services DN."""
         services_dn = self.samdb.get_config_basedn()
@@ -113,7 +140,8 @@ class ClaimCmdTestCase(SambaToolCmdTest):
     runsubcmd = _run
 
     def create_claim_type(self, attribute, name=None, description=None,
-                          classes=None, disable=False, protect=False):


-- 
Samba Shared Repository



More information about the samba-cvs mailing list