]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
2 years agos4:torture: Fix code spelling
Joseph Sutton [Wed, 2 Aug 2023 02:52:13 +0000 (14:52 +1200)] 
s4:torture: Fix code spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:smb_server: Fix code spelling
Joseph Sutton [Tue, 1 Aug 2023 03:52:07 +0000 (15:52 +1200)] 
s4:smb_server: Fix code spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Use smb_krb5_make_data()
Joseph Sutton [Wed, 16 Aug 2023 03:57:53 +0000 (15:57 +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@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Use ‘krb5_error_code’ for return types
Joseph Sutton [Wed, 16 Aug 2023 03:57:00 +0000 (15:57 +1200)] 
s4:kdc: Use ‘krb5_error_code’ for return types

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Set SAMBA_KDC_FLAG_PROTOCOL_TRANSITION flag for MIT Kerberos
Joseph Sutton [Tue, 15 Aug 2023 22:18:59 +0000 (10:18 +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@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove support code for older versions of MIT Kerberos
Joseph Sutton [Tue, 15 Aug 2023 03:16:57 +0000 (15:16 +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@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Do not panic if authsam_logon_success_accounting() fails
Joseph Sutton [Sun, 13 Aug 2023 22:50:37 +0000 (10:50 +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@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:rpc_server: Remove unnecessary cast
Joseph Sutton [Wed, 9 Aug 2023 04:54:02 +0000 (16:54 +1200)] 
s3:rpc_server: Remove unnecessary cast

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:libnet: Fix reference to incorrect function names
Joseph Sutton [Tue, 15 Aug 2023 21:47:18 +0000 (09:47 +1200)] 
s3:libnet: Fix reference to incorrect function names

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:libnet: Remove unnecessary cast
Joseph Sutton [Wed, 9 Aug 2023 04:53:21 +0000 (16:53 +1200)] 
s3:libnet: Remove unnecessary cast

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:tests: Save files with intended contents
Joseph Sutton [Wed, 16 Aug 2023 23:13:50 +0000 (11:13 +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@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:tests: Fix spelling
Joseph Sutton [Wed, 16 Aug 2023 23:07:27 +0000 (11:07 +1200)] 
python:tests: Fix spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:tests: Reuse policies and silos created by setUp() across all tests
Joseph Sutton [Thu, 17 Aug 2023 01:29:49 +0000 (13:29 +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@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:tests: Reuse claims created by setUp() across all tests
Joseph Sutton [Wed, 16 Aug 2023 22:27:44 +0000 (10:27 +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@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:tests: Make getSamDB() a static method
Joseph Sutton [Wed, 16 Aug 2023 22:22:35 +0000 (10:22 +1200)] 
python:tests: Make getSamDB() a static method

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:subunit: Use ‘is’ to compare variables with singletons
Joseph Sutton [Thu, 17 Aug 2023 01:29:00 +0000 (13:29 +1200)] 
python:subunit: Use ‘is’ to compare variables with singletons

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:subunit: Fix docstring
Joseph Sutton [Thu, 17 Aug 2023 00:45:05 +0000 (12:45 +1200)] 
python:subunit: Fix docstring

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:netcmd: Remove semicolon
Joseph Sutton [Wed, 16 Aug 2023 23:06:01 +0000 (11:06 +1200)] 
python:netcmd: Remove semicolon

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:netcmd: Add missing newlines to error messages
Joseph Sutton [Sun, 6 Aug 2023 22:25:12 +0000 (10:25 +1200)] 
python:netcmd: Add missing newlines to error messages

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopidl: Use non-existent function dissect_ndr_int64()
Joseph Sutton [Tue, 15 Aug 2023 21:27:37 +0000 (09:27 +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@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibrpc:ndr: Use portable integer types
Joseph Sutton [Tue, 15 Aug 2023 00:37:55 +0000 (12:37 +1200)] 
librpc:ndr: Use portable integer types

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/auth: Remove unnecessary casts
Joseph Sutton [Wed, 9 Aug 2023 04:52:31 +0000 (16:52 +1200)] 
libcli/auth: Remove unnecessary casts

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:krb5_wrap: Fix references to incorrect function names
Joseph Sutton [Tue, 15 Aug 2023 21:46:49 +0000 (09:46 +1200)] 
lib:krb5_wrap: Fix references to incorrect function names

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:krb5_wrap: Fix code spelling
Joseph Sutton [Tue, 15 Aug 2023 21:46:18 +0000 (09:46 +1200)] 
lib:krb5_wrap: Fix code spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/krb5: Remove incorrect comments
Joseph Sutton [Tue, 15 Aug 2023 00:36:05 +0000 (12:36 +1200)] 
tests/krb5: Remove incorrect comments

Now that the INT64 claim IDL definition has been corrected, these tests
should pass against Windows.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15452

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Aug 15 19:41:50 UTC 2023 on atb-devel-224

2 years agoclaims.idl: Use ‘int64’ instead of ‘dlong’ for INT64 claims
Joseph Sutton [Tue, 15 Aug 2023 00:31:54 +0000 (12:31 +1200)] 
claims.idl: Use ‘int64’ instead of ‘dlong’ for INT64 claims

This field is supposed to be aligned to eight bytes, but the ‘dlong’
type is aligned to only four bytes. This discrepancy resulted in claims
being encoded and decoded incorrectly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15452

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibrpc:ndr: Add ‘int64’ type
Joseph Sutton [Tue, 15 Aug 2023 00:29:03 +0000 (12:29 +1200)] 
librpc:ndr: Add ‘int64’ type

This type behaves like a signed variant of ‘hyper’. Unlike the existing
‘dlong’ type, which has four byte alignment, ‘int64’ is aligned to eight
bytes.

Bump the NDR version to 3.0.1.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15452

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/krb5: Add a test decoding INT64 PAC claims issued by Windows
Joseph Sutton [Tue, 15 Aug 2023 00:21:30 +0000 (12:21 +1200)] 
tests/krb5: Add a test decoding INT64 PAC claims issued by Windows

Our NDR code currently handles INT64 claims incorrectly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15452

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/krb5: Shorten long lines
Joseph Sutton [Tue, 15 Aug 2023 00:20:50 +0000 (12:20 +1200)] 
tests/krb5: Shorten long lines

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15452

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/krb5: Remove unused import
Joseph Sutton [Tue, 15 Aug 2023 00:20:17 +0000 (12:20 +1200)] 
tests/krb5: Remove unused import

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15452

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3: smbd: Ensure init_smb1_request() zeros out what the incoming pointer points to.
Jeremy Allison [Sat, 12 Aug 2023 00:28:53 +0000 (17:28 -0700)] 
s3: smbd: Ensure init_smb1_request() zeros out what the incoming pointer points to.

Remove the now unneeded req->xxx = NULL assignments (and the
deliberately bogus req->session = (void *)0xDEADBEEF one
used to demonstrate the bug).

Remove knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15432

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Aug 15 12:06:36 UTC 2023 on atb-devel-224

2 years agos3: torture: Add SMB1-NEGOTIATE-TCON that shows the SMB1 server crashes on the uninit...
Jeremy Allison [Sat, 12 Aug 2023 00:18:26 +0000 (17:18 -0700)] 
s3: torture: Add SMB1-NEGOTIATE-TCON that shows the SMB1 server crashes on the uninitialized req->session.

Found by Robert Morris <rtm@lcs.mit.edu>.

Adds knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15432

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <nopower@samba.org>
2 years agos3: smbd: init_smb1_request() isn't being passed zero'ed memory from any codepath.
Jeremy Allison [Sat, 12 Aug 2023 00:14:38 +0000 (17:14 -0700)] 
s3: smbd: init_smb1_request() isn't being passed zero'ed memory from any codepath.

If a client does a SMB1 NEGPROT followed by SMB1 TCON
then req->session is left uninitialized.

Show this causes a crash by deliberately initializing
req->session to an invalid pointer. This will be removed
once the test shows the crash, and the fix is added to
cause init_smb1_request() to zero the memory passed in.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15432

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agoctdb-common: Set immediate mode for pcap capture
Martin Schwenke [Tue, 15 Aug 2023 02:34:20 +0000 (12:34 +1000)] 
ctdb-common: Set immediate mode for pcap capture

Fix a problem where ctdb_killtcp (almost always) fails to capture
packets with --enable-pcap and libpcap ≥ 1.9.1.  The problem is due to
a gradual change in libpcap semantics when using
pcap_get_selectable_fd(3PCAP) to get a file descriptor and then using
that file descriptor in non-blocking mode.

pcap_set_immediate_mode(3PCAP) says:

  pcap_set_immediate_mode() sets whether immediate mode should be set
  on a capture handle when the handle is activated.  In immediate
  mode, packets are always delivered as soon as they arrive, with no
  buffering.

and

  On Linux, with previous releases of libpcap, capture devices are
  always in immediate mode; however, in 1.5.0 and later, they are, by
  default, not in immediate mode, so if pcap_set_immediate_mode() is
  available, it should be used.

However, it wasn't until libpcap commit
2ade7676101366983bd4f86bc039ffd25da8c126 (before libpcap 1.9.1) that
it became a requirement to use pcap_set_immediate_mode(), even with a
timeout of 0.

More explanation in this libpcap issue comment:

  https://github.com/the-tcpdump-group/libpcap/issues/860#issuecomment-541204548

Do a configure check for pcap_set_immediate_mode() even though it has
existed for 10 years.  It is easy enough.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15451

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Aug 15 10:53:52 UTC 2023 on atb-devel-224

2 years agoctdb-common: Replace pcap_open_live() by lower level calls
Martin Schwenke [Tue, 15 Aug 2023 00:57:59 +0000 (10:57 +1000)] 
ctdb-common: Replace pcap_open_live() by lower level calls

A subsequent commit will insert an additional call before
pcap_activate().

This sequence of calls is taken from the source for pcap_open_live(),
so there should be no change in behaviour.

Given the defaults set by pcap_create_common(), it would be possible
to omit the calls to pcap_set_promisc() and pcap_set_timeout().
However, those defaults don't seem to be well documented, so continue
to explicitly set everything that was set before.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15451

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-common: Improve error handling
Martin Schwenke [Tue, 15 Aug 2023 00:43:57 +0000 (10:43 +1000)] 
ctdb-common: Improve error handling

Factor out a failure label, which will get more use in subsequent
commits, and only set private_data when success is certain.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15451

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agogitlab-ci: Add running codespell
Andreas Schneider [Wed, 22 Mar 2023 09:15:54 +0000 (10:15 +0100)] 
gitlab-ci: Add running codespell

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Aug 14 22:44:58 UTC 2023 on atb-devel-224

2 years agoscripts: Add codespell check
Andreas Schneider [Tue, 14 Mar 2023 07:51:03 +0000 (08:51 +0100)] 
scripts: Add codespell check

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agowintest: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:50:30 +0000 (15:50 +0200)] 
wintest: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:50:07 +0000 (15:50 +0200)] 
tests: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotestprogs: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:49:45 +0000 (15:49 +0200)] 
testprogs: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:wrepl_server: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:48:16 +0000 (15:48 +0200)] 
s4:wrepl_server: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:wrepl_server: Remove trailing white spaces
Andreas Schneider [Thu, 3 Aug 2023 13:49:06 +0000 (15:49 +0200)] 
s4:wrepl_server: Remove trailing white spaces

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:46:43 +0000 (15:46 +0200)] 
s4:torture: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:smb2: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:45:39 +0000 (15:45 +0200)] 
s4:torture:smb2: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:rpc: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:45:20 +0000 (15:45 +0200)] 
s4:torture:rpc: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:raw: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:45:05 +0000 (15:45 +0200)] 
s4:torture:raw: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:nbt: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:44:41 +0000 (15:44 +0200)] 
s4:torture:nbt: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:nbench: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:44:26 +0000 (15:44 +0200)] 
s4:torture:nbench: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:libnetapi: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:44:01 +0000 (15:44 +0200)] 
s4:torture:libnetapi: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:ldb: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:43:39 +0000 (15:43 +0200)] 
s4:torture:ldb: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:ldap: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:43:00 +0000 (15:43 +0200)] 
s4:torture:ldap: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:ldap: Remove trailing white spaces
Andreas Schneider [Thu, 3 Aug 2023 13:59:51 +0000 (15:59 +0200)] 
s4:torture:ldap: Remove trailing white spaces

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:krb5: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:42:18 +0000 (15:42 +0200)] 
s4:torture:krb5: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:dns: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:41:49 +0000 (15:41 +0200)] 
s4:torture:dns: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:basic: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:41:02 +0000 (15:41 +0200)] 
s4:torture:basic: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:drs: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:40:42 +0000 (15:40 +0200)] 
s4:torture:drs: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:dfs: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:40:20 +0000 (15:40 +0200)] 
s4:torture:dfs: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture:auth: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:39:59 +0000 (15:39 +0200)] 
s4:torture:auth: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:smb_server: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:35:35 +0000 (15:35 +0200)] 
s4:smb_server: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:setup: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:34:24 +0000 (15:34 +0200)] 
s4:setup: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:ldap_server: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:29:56 +0000 (15:29 +0200)] 
s3:ldap_server: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:selftest: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 13:28:06 +0000 (15:28 +0200)] 
s4:selftest: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:scripting: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 12:45:16 +0000 (14:45 +0200)] 
s4:scripting: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:samba: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 12:42:10 +0000 (14:42 +0200)] 
s4:samba: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:rpc_server: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 12:40:26 +0000 (14:40 +0200)] 
s4:rpc_server: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:ntvfs: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 12:40:03 +0000 (14:40 +0200)] 
s4:ntvfs: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:librpc: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 12:37:09 +0000 (14:37 +0200)] 
s4:librpc: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:libnet: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 12:36:50 +0000 (14:36 +0200)] 
s4:libnet: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:libcli: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 12:34:51 +0000 (14:34 +0200)] 
s4:libcli: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:libcli: Remove tailing white spaces
Andreas Schneider [Fri, 4 Aug 2023 05:21:18 +0000 (07:21 +0200)] 
s4:libcli: Remove tailing white spaces

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:lib: Fix code spelling
Andreas Schneider [Thu, 3 Aug 2023 12:32:27 +0000 (14:32 +0200)] 
s4:lib: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoaudit_logging: Simplify json_add_stringn() with json_stringn()
Volker Lendecke [Thu, 10 Aug 2023 13:05:22 +0000 (15:05 +0200)] 
audit_logging: Simplify json_add_stringn() with json_stringn()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Aug 14 20:51:11 UTC 2023 on atb-devel-224

2 years agotevent: Fix a typo
Volker Lendecke [Wed, 9 Aug 2023 14:22:03 +0000 (16:22 +0200)] 
tevent: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: A bit README.Coding for cli_qpathinfo2()
Volker Lendecke [Wed, 5 Jul 2023 09:58:39 +0000 (11:58 +0200)] 
libsmb: A bit README.Coding for cli_qpathinfo2()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Pass down "dirfsp" to smb_unix_mknod()
Volker Lendecke [Wed, 5 Jul 2023 06:27:03 +0000 (08:27 +0200)] 
smbd: Pass down "dirfsp" to smb_unix_mknod()

Avoids a call to parent_pathref()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Use "dirfsp" in smb_posix_unlink()
Volker Lendecke [Tue, 4 Jul 2023 15:21:32 +0000 (17:21 +0200)] 
smbd: Use "dirfsp" in smb_posix_unlink()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Use "dirfsp" in smb_posix_open()
Volker Lendecke [Tue, 4 Jul 2023 15:19:40 +0000 (17:19 +0200)] 
smbd: Use "dirfsp" in smb_posix_open()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbstatus: Fix CID 1507865 Uninitialized pointer read
Volker Lendecke [Wed, 2 Aug 2023 16:39:20 +0000 (18:39 +0200)] 
smbstatus: Fix CID 1507865 Uninitialized pointer read

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbstatus: Fix CID 1507870 Uninitialized pointer read
Volker Lendecke [Wed, 2 Aug 2023 16:38:22 +0000 (18:38 +0200)] 
smbstatus: Fix CID 1507870 Uninitialized pointer read

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agodbwrap: Simplify dbwrap_change_int32_atomic_action()
Volker Lendecke [Wed, 12 Jul 2023 23:19:43 +0000 (01:19 +0200)] 
dbwrap: Simplify dbwrap_change_int32_atomic_action()

Use dbwrap_do_locked()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agodbwrap: Simplify dbwrap_change_uint32_atomic_action()
Volker Lendecke [Wed, 12 Jul 2023 23:03:14 +0000 (01:03 +0200)] 
dbwrap: Simplify dbwrap_change_uint32_atomic_action()

Use dbwrap_do_locked()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Fix DBG macro
Volker Lendecke [Wed, 26 Jul 2023 22:47:23 +0000 (00:47 +0200)] 
smbd: Fix DBG macro

This augments 5c37615efa2, the DBG macros already prepend the the function name

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Use struct initialization
Volker Lendecke [Wed, 26 Jul 2023 14:49:24 +0000 (16:49 +0200)] 
smbd: Use struct initialization

Avoid an explicit ZERO_STRUCT

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Move few bytes of R/W data to R/O text
Volker Lendecke [Mon, 10 Jul 2023 16:17:36 +0000 (18:17 +0200)] 
lib: Move few bytes of R/W data to R/O text

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoidmap:fix whitespace
Volker Lendecke [Tue, 24 Jan 2023 17:01:43 +0000 (18:01 +0100)] 
idmap:fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoidmap_tdb: Remove a variable never used
Volker Lendecke [Tue, 24 Jan 2023 10:04:24 +0000 (11:04 +0100)] 
idmap_tdb: Remove a variable never used

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoidmap: Fix whitespace
Volker Lendecke [Tue, 24 Jan 2023 10:03:28 +0000 (11:03 +0100)] 
idmap: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agopassdb: Fix a DBG statement
Volker Lendecke [Tue, 24 Jan 2023 09:28:26 +0000 (10:28 +0100)] 
passdb: Fix a DBG statement

This is not pdb_getsampwent()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agopassdb: Fix whitespace
Volker Lendecke [Tue, 24 Jan 2023 09:16:41 +0000 (10:16 +0100)] 
passdb: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agopassdb: Fix a DBG message
Volker Lendecke [Tue, 24 Jan 2023 09:00:25 +0000 (10:00 +0100)] 
passdb: Fix a DBG message

This is not dsdb_add_domain_alias()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3: smbd: Add missing 'return;'s in exit paths in reply_exit_done().
Jeremy Allison [Fri, 11 Aug 2023 22:19:01 +0000 (15:19 -0700)] 
s3: smbd: Add missing 'return;'s in exit paths in reply_exit_done().

Remove knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15430

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Aug 14 19:52:49 UTC 2023 on atb-devel-224

2 years agos3: torture: Add a test doing an SMB1 negotiate+exit.
Jeremy Allison [Fri, 11 Aug 2023 22:12:05 +0000 (15:12 -0700)] 
s3: torture: Add a test doing an SMB1 negotiate+exit.

Robert Morris <rtm@lcs.mit.edu> noticed a missing
return in reply_exit_done().

Adds knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15430

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2 years agomdssvc: Do an early talloc_free() in _mdssvc_open()
Jones Syue [Mon, 7 Aug 2023 09:08:29 +0000 (17:08 +0800)] 
mdssvc: Do an early talloc_free() in _mdssvc_open()

Environment setup:
When macOS Finder connect to a samba server with 'spotlight = yes',
macOS would issue mdssvc open (mdssvc.opnum == 0) to samba and it goes
through api _mdssvc_open().

After applied 578e434a94147dc2d7dbfc006d2ab84807859c1d,
(this is reported by jaywei@qnap.com)
this line 'talloc_free(path);' is deleted if _mdssvc_open() normal exit,
so memory is lazy de-allocate: delayed to
smbd_tevent_trace_callback() @ smb2_process.c. [1]

Supposed to explicitly free 'path' in _mdssvc_open() @ srv_mdssvc_nt.c[2]
just like abnormal exit, do not wait for main loop to free 'path' which is
no longer used, this is more consistent while reading source code.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15449

[1] gdb tracing 'path' address 0x56204ccc67e0 to know how it is freed.
Breakpoint 2, _tc_free_children_internal (tc=0x56204ccc6780, ptr=0x56204ccc67e0, location=0x7ff430d96410 "../../lib/talloc/talloc.c:1714") at ../../lib/talloc/talloc.c:1656
1656            while (tc->child) {
(gdb) bt
0  _tc_free_children_internal (tc=0x56204ccc6780, ptr=0x56204ccc67e0, location=0x7ff430d96410 "../../lib/talloc/talloc.c:1714") at ../../lib/talloc/talloc.c:1656
1  0x00007ff430d92b14 in _tc_free_internal (tc=0x56204ccc6780, location=0x7ff430d96410 "../../lib/talloc/talloc.c:1714") at ../../lib/talloc/talloc.c:1183
2  0x00007ff430d93b71 in _tc_free_children_internal (tc=0x56204ccc6720, ptr=0x56204ccc6780, location=0x7ff430d96410 "../../lib/talloc/talloc.c:1714") at ../../lib/talloc/talloc.c:1668
3  0x00007ff430d93d66 in talloc_free_children (ptr=0x56204ccc6780) at ../../lib/talloc/talloc.c:1714
4  0x00007ff432235aca in talloc_pop (frame=0x56204ccc6780) at ../../lib/util/talloc_stack.c:125
5  0x00007ff430d92959 in _tc_free_internal (tc=0x56204ccc6720, location=0x7ff431f358d0 "../../source3/smbd/process.c:3726") at ../../lib/talloc/talloc.c:1157
6  0x00007ff430d92cd5 in _talloc_free_internal (ptr=0x56204ccc6780, location=0x7ff431f358d0 "../../source3/smbd/process.c:3726") at ../../lib/talloc/talloc.c:1247
7  0x00007ff430d93f96 in _talloc_free (ptr=0x56204ccc6780, location=0x7ff431f358d0 "../../source3/smbd/process.c:3726") at ../../lib/talloc/talloc.c:1791
8  0x00007ff431d81292 in smbd_tevent_trace_callback (point=TEVENT_TRACE_AFTER_LOOP_ONCE, private_data=0x7ffe46591e30) at ../../source3/smbd/process.c:3726
<...cut...>

[2] gdb tracing 'path' address 0x55a6d66deed0 to know how it is freed.
Breakpoint 2, _tc_free_children_internal (tc=0x55a6d66deed0, ptr=0x55a6d66def30, location=0x7fc4cca84040 "../../source3/rpc_server/mdssvc/srv_mdssvc_nt.c:189") at ../../lib/talloc/talloc.c:1656
1656            while (tc->child) {
(gdb) bt
0  _tc_free_children_internal (tc=0x55a6d66deed0, ptr=0x55a6d66def30, location=0x7fc4cca84040 "../../source3/rpc_server/mdssvc/srv_mdssvc_nt.c:189") at ../../lib/talloc/talloc.c:1656
1  0x00007fc4cb892b14 in _tc_free_internal (tc=0x55a6d66deed0, location=0x7fc4cca84040 "../../source3/rpc_server/mdssvc/srv_mdssvc_nt.c:189") at ../../lib/talloc/talloc.c:1183
2  0x00007fc4cb892cd5 in _talloc_free_internal (ptr=0x55a6d66def30, location=0x7fc4cca84040 "../../source3/rpc_server/mdssvc/srv_mdssvc_nt.c:189") at ../../lib/talloc/talloc.c:1247
3  0x00007fc4cb893f96 in _talloc_free (ptr=0x55a6d66def30, location=0x7fc4cca84040 "../../source3/rpc_server/mdssvc/srv_mdssvc_nt.c:189") at ../../lib/talloc/talloc.c:1791
4  0x00007fc4cc9396e4 in _mdssvc_open (p=0x55a6d66d5600, r=0x55a6d66edc60) at ../../source3/rpc_server/mdssvc/srv_mdssvc_nt.c:189
<...cut...>

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Noel Power <npower@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Aug 14 18:11:37 UTC 2023 on atb-devel-224

2 years agos3: smbd: Ensure all callers to srvstr_pull_req_talloc() pass a zeroed-out dest pointer.
Jeremy Allison [Fri, 11 Aug 2023 17:52:31 +0000 (10:52 -0700)] 
s3: smbd: Ensure all callers to srvstr_pull_req_talloc() pass a zeroed-out dest pointer.

Now we've fixed srvstr_pull_req_talloc() this isn't
strictly needed, but ensuring pointers are initialized
is best practice to avoid future bugs.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15420

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Aug 14 15:55:43 UTC 2023 on atb-devel-224

2 years agos3: smbd: Uncorrupt the pointer we were using to prove a crash.
Jeremy Allison [Fri, 11 Aug 2023 17:47:28 +0000 (10:47 -0700)] 
s3: smbd: Uncorrupt the pointer we were using to prove a crash.

Rather than restore to uninitialized, set to NULL as per
modern coding practices.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15420
Reviewed-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agos3: smbd: Ensure srvstr_pull_req_talloc() always NULLs out *dest.
Jeremy Allison [Fri, 11 Aug 2023 17:42:41 +0000 (10:42 -0700)] 
s3: smbd: Ensure srvstr_pull_req_talloc() always NULLs out *dest.

Robert Morris <rtm@lcs.mit.edu> noticed that in the case
where srvstr_pull_req_talloc() is being called with
buffer remaining == 0, we don't NULL out the destination
pointed which is *always* done in the codepaths inside
pull_string_talloc(). This prevents a crash in the caller.

Remove knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15420

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agos3: torture: Add SMB1-TRUNCATED-SESSSETUP test.
Jeremy Allison [Fri, 11 Aug 2023 17:39:36 +0000 (10:39 -0700)] 
s3: torture: Add SMB1-TRUNCATED-SESSSETUP test.

Shows that we indirect through an uninitialized pointer and the client crashes
it's own smbd.

Add knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15420

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agos3: smbd: Deliberately currupt an uninitialized pointer.
Jeremy Allison [Fri, 11 Aug 2023 17:38:23 +0000 (10:38 -0700)] 
s3: smbd: Deliberately currupt an uninitialized pointer.

We will need this to show smbd crashing in the test code.
This will be removed once we're passing the test.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15420

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agos4:kdc: Add get_claims_set_for_principal()
Joseph Sutton [Thu, 10 Aug 2023 22:54:52 +0000 (10:54 +1200)] 
s4:kdc: Add get_claims_set_for_principal()

Add a new function, get_claims_set_for_principal(), that returns the
claims as a CLAIMS_SET structure rather than as a blob. To accommodate
this, move the call to encode_claims_set() out of get_all_claims() and
into get_claims_blob_for_principal().

Being able to get the unencoded claims will save us from having to
decode claims that we just needlessly encoded.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Aug 14 05:51:45 UTC 2023 on atb-devel-224