ab/samba-autobuild/.git
11 months agoAdd ROLE_IPA_DC into two more places master
Alexander Bokovoy [Mon, 24 Apr 2023 16:26:19 +0000 (19:26 +0300)]
Add ROLE_IPA_DC into two more places

Missed two more places originally when introduced ROLE_IPA_DC.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agos3:locking: fix debug level for NT_STATUS_NOT_FOUND messanges in get_static_share_mod...
Stefan Metzmacher [Mon, 24 Apr 2023 13:08:42 +0000 (15:08 +0200)]
s3:locking: fix debug level for NT_STATUS_NOT_FOUND messanges in get_static_share_mode_data

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Apr 24 14:13:35 UTC 2023 on atb-devel-224

11 months agopython:tests: Skip the source_chars test if not a git dir
Andreas Schneider [Fri, 14 Apr 2023 19:05:18 +0000 (21:05 +0200)]
python:tests: Skip the source_chars test if not a git dir

This test doesn't work in release tarballs. Skip it if git fails.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Apr 21 13:59:29 UTC 2023 on atb-devel-224

12 months agos3:client: Remove unused tree.c
Andreas Schneider [Thu, 20 Apr 2023 11:02:05 +0000 (13:02 +0200)]
s3:client: Remove unused tree.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Apr 20 12:56:53 UTC 2023 on atb-devel-224

12 months agos3:libsmb: Also deprecate smbc_init()
Andreas Schneider [Tue, 18 Apr 2023 14:00:51 +0000 (16:00 +0200)]
s3:libsmb: Also deprecate smbc_init()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
12 months agos3:utils: Use smbc_set_credentials_with_fallback() for smbget
Andreas Schneider [Thu, 13 Apr 2023 13:41:53 +0000 (15:41 +0200)]
s3:utils: Use smbc_set_credentials_with_fallback() for smbget

smbc_set_credentials() is deprecated.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
12 months agos3:libsmb: Mark smbc_set_credentials() as deprecated
Andreas Schneider [Thu, 13 Apr 2023 13:31:04 +0000 (15:31 +0200)]
s3:libsmb: Mark smbc_set_credentials() as deprecated

This will issue a compiler warning!

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
12 months agos3:lib: Do not try to match '.' and '..' directories in is_in_path()
Andreas Schneider [Wed, 19 Apr 2023 14:23:10 +0000 (16:23 +0200)]
s3:lib: Do not try to match '.' and '..' directories in is_in_path()

This fixes setting veto files to '.*' to not list hidden files and
directories starting with a dot.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 19 22:30:19 UTC 2023 on atb-devel-224

12 months agos3:tests: Add test that veto files works for hidden files
Andreas Schneider [Wed, 19 Apr 2023 13:35:47 +0000 (15:35 +0200)]
s3:tests: Add test that veto files works for hidden files

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
12 months agos3:tests: Create a temporary directory for test_veto_files.sh
Andreas Schneider [Wed, 19 Apr 2023 18:45:52 +0000 (20:45 +0200)]
s3:tests: Create a temporary directory for test_veto_files.sh

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
12 months agogp: Fix NameError: free variable 'cron_dir' in Crontab CSE
David Mulder [Tue, 18 Apr 2023 19:34:46 +0000 (13:34 -0600)]
gp: Fix NameError: free variable 'cron_dir' in Crontab CSE

An apply reports the error "NameError: free
variable 'cron_dir' referenced before assignment
in enclosing scope". This only happens when no
policy is defined for this CSE, because existing
policy causes the variable to be defined.

Moved the 'cron_dir' varilable to the correct
scope.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Wed Apr 19 21:21:10 UTC 2023 on atb-devel-224

12 months agopylibsmb: Return "flags" in create_returns
Volker Lendecke [Tue, 14 Feb 2023 19:49:52 +0000 (20:49 +0100)]
pylibsmb: Return "flags" in create_returns

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr 18 15:58:42 UTC 2023 on atb-devel-224

12 months agolibsmb: Return [MS-SMB2] 2.2.14 SMB2 CREATE Response flags field
Volker Lendecke [Tue, 14 Feb 2023 19:44:16 +0000 (20:44 +0100)]
libsmb: Return [MS-SMB2] 2.2.14 SMB2 CREATE Response flags field

Not used yet, mostly for completeness.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agosmbd: Save 488 bytes RSS
Volker Lendecke [Thu, 9 Mar 2023 16:36:26 +0000 (17:36 +0100)]
smbd: Save 488 bytes RSS

With this ld.so does not have to relocate the string pointers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibsmb: Adapt cli_echo_send() to modern conventions
Volker Lendecke [Sat, 11 Mar 2023 12:51:43 +0000 (13:51 +0100)]
libsmb: Adapt cli_echo_send() to modern conventions

Nowadays we rather do protocol-specific _done() functions, and overall
this cuts a few lines.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agosmbd: Fix a DBG statement
Volker Lendecke [Sat, 11 Mar 2023 14:37:59 +0000 (15:37 +0100)]
smbd: Fix a DBG statement

This is not smbd_smb2_create_send() anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibsmb: Make setting errno safer in SMBC_add_cached_server()
Volker Lendecke [Sat, 1 Apr 2023 09:57:47 +0000 (11:57 +0200)]
libsmb: Make setting errno safer in SMBC_add_cached_server()

DEBUG should preserve errno, but make this more obvious.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibsmb: Simplify SMBC_add_cached_server()
Volker Lendecke [Sat, 1 Apr 2023 09:57:29 +0000 (11:57 +0200)]
libsmb: Simplify SMBC_add_cached_server()

ENOMEM is the only error condition we have

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibsmb: Avoid an explicit ZERO_STRUCTP with calloc
Volker Lendecke [Sat, 1 Apr 2023 09:55:10 +0000 (11:55 +0200)]
libsmb: Avoid an explicit ZERO_STRUCTP with calloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibsmb: Slightly simplify smbc_init()
Volker Lendecke [Sat, 1 Apr 2023 10:47:51 +0000 (12:47 +0200)]
libsmb: Slightly simplify smbc_init()

Reduce indentation with an early return, review with git show -w

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibsmb: Make cli_smb2_qpathinfo2() asynchronous
Volker Lendecke [Tue, 4 Apr 2023 07:36:08 +0000 (09:36 +0200)]
libsmb: Make cli_smb2_qpathinfo2() asynchronous

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibsmb: Make cli_qpathinfo2_done() parse the results
Volker Lendecke [Mon, 3 Apr 2023 16:31:01 +0000 (18:31 +0200)]
libsmb: Make cli_qpathinfo2_done() parse the results

Make it easier to do an async SMB2 version

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibsmb: Introduce type-safe struct cli_smb2_create_flags
Volker Lendecke [Wed, 12 Apr 2023 13:31:03 +0000 (15:31 +0200)]
libsmb: Introduce type-safe struct cli_smb2_create_flags

This makes it clearer what to pass into the create_flags argument to
cli_smb2_create_fnum(). There was already confusion in
source3/torture/test_smb2.c: It passed in
SMB2_OPLOCK_LEVEL_NONE (which was okay because it #defines to 0), but
it should have been a straight 0, for example
SMB2_OPLOCK_LEVEL_EXCLUSIVE would have been wrong.

This way adding other flags (.nofollow comes to mind) will be much
easier to handle.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoshadow_copy2: Fix stream open for streams_depot paths
Volker Lendecke [Fri, 14 Apr 2023 15:22:18 +0000 (17:22 +0200)]
shadow_copy2: Fix stream open for streams_depot paths

streams_depot hands us absolute paths with : filename components
instead of having set smb_fname_in->stream_name.

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

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 Apr 17 18:11:07 UTC 2023 on atb-devel-224

12 months agotests: Show that streams_depot and shadow_copy2 don't play together
Volker Lendecke [Fri, 14 Apr 2023 15:34:17 +0000 (15:34 +0000)]
tests: Show that streams_depot and shadow_copy2 don't play together

See the next patch, we assert in shadow_copy2_openat() over paths
passed in from shadow_copy2

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
12 months agostreams_depot: Create files when requested
Volker Lendecke [Fri, 14 Apr 2023 14:32:42 +0000 (16:32 +0200)]
streams_depot: Create files when requested

If you set "create mask = 0600" no streams will be created....

Tested manually. Not creating an automated test for this, there are so
many places where this can go wrong that testing this individual
glitch does not gain us much confidence.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
12 months agodebug: Only initialize gpfs wrapper when gpfs logging is enabled
Christof Schmitt [Thu, 13 Apr 2023 18:13:00 +0000 (11:13 -0700)]
debug: Only initialize gpfs wrapper when gpfs logging is enabled

This avoids unnecessary attempts to load libgpfs.so when it is not
needed.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Apr 14 12:28:23 UTC 2023 on atb-devel-224

12 months agotestprogs: Set PREFIX_ABS before it is used in test_primary_group.sh
Pavel Filipenský [Thu, 13 Apr 2023 07:41:26 +0000 (09:41 +0200)]
testprogs: Set PREFIX_ABS before it is used in test_primary_group.sh

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Apr 14 06:18:18 UTC 2023 on atb-devel-224

12 months agolib:util: Fix code spelling
Andreas Schneider [Thu, 13 Apr 2023 11:29:32 +0000 (13:29 +0200)]
lib:util: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agolib:util: Remove trailing white spaces in byteorder.h
Andreas Schneider [Thu, 13 Apr 2023 11:27:37 +0000 (13:27 +0200)]
lib:util: Remove trailing white spaces in byteorder.h

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agolib:tsocket: Fix code spelling
Andreas Schneider [Thu, 13 Apr 2023 11:19:05 +0000 (13:19 +0200)]
lib:tsocket: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agolib:tevent: Fix code spelling
Andreas Schneider [Thu, 13 Apr 2023 11:18:05 +0000 (13:18 +0200)]
lib:tevent: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agolib:tdb: Fix code spelling
Andreas Schneider [Thu, 13 Apr 2023 11:17:08 +0000 (13:17 +0200)]
lib:tdb: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agolib:talloc: Fix code spelling
Andreas Schneider [Thu, 13 Apr 2023 11:14:10 +0000 (13:14 +0200)]
lib:talloc: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agolib:socket: Fix code spelling
Andreas Schneider [Thu, 13 Apr 2023 10:54:55 +0000 (12:54 +0200)]
lib:socket: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agolib:smbconf: Fix code spelling
Andreas Schneider [Thu, 13 Apr 2023 10:54:21 +0000 (12:54 +0200)]
lib:smbconf: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agolib:replace: Fix code spelling
Andreas Schneider [Thu, 13 Apr 2023 10:53:07 +0000 (12:53 +0200)]
lib:replace: Fix code spelling

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agolib:replace: Remove trailing white spaces in xattr.c
Andreas Schneider [Thu, 13 Apr 2023 10:52:52 +0000 (12:52 +0200)]
lib:replace: Remove trailing white spaces in xattr.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
12 months agoselftest:Samba3: use the correct NSS_WRAPPER_HOSTNAME
Stefan Metzmacher [Wed, 12 Apr 2023 15:22:02 +0000 (17:22 +0200)]
selftest:Samba3: use the correct NSS_WRAPPER_HOSTNAME

The value of NSS_WRAPPER_HOSTNAME needs to match value
we put into the NSS_WRAPPER_HOSTS file.

We had a mismatch of
idmapridmember.samba.example.com
vs.
idmapridmember.addom.samba.example.com

This causes getaddrinfo() in nss_wrapper to fallback to
the libc version, which talks to a dns server.
It's not clear if recent glibc code will reach resolve/socket wrapper.
So it's not unlikely that idmapridmember.samba.example.com will
be passed via the internet, which causes delays up to 20 seconds.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Apr 12 20:29:05 UTC 2023 on atb-devel-224

12 months agoselftest: Catch error codes from failing testsuites
Joseph Sutton [Thu, 6 Apr 2023 04:31:09 +0000 (16:31 +1200)]
selftest: Catch error codes from failing testsuites

Testsuites declared with functions such as plantestsuite() are not run
directly, but are piped through filter-subunit. The overall exit code of
the executed test command is that returned by the last command in the
pipeline (that is, filter-subunit), and thus the actual testsuite return
code is lost.

A real consequence of this is that an error in setUpClass() in a Python
testsuite causes the whole testsuite to be skipped silently.

The --fail-on-empty option partially addressed this, but didn't help if
the testsuite contained multiple test classes, only one of which
contained an error.

We now use bash with the pipefail option, which makes the return code of
the last failing command into the return code of the entire pipeline.
That means that we properly fail if a testsuite returns a non-zero exit
code, but doesn't otherwise exhibit any failures in its output.

This doesn't help for cases where a testsuite has other failing tests
that become xfails due to knownfail entries. In that case, the overall
'testsuite-failure' will be turned into 'testsuite-xfail' by
filter-subunit and the silent failures will remain unheeded. Still, this
is better than the existing situation.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Apr 12 14:57:55 UTC 2023 on atb-devel-224

12 months agoselftest: Fix samba3.clustered.smb2.deny.deny2 test
Joseph Sutton [Wed, 12 Apr 2023 01:20:00 +0000 (13:20 +1200)]
selftest: Fix samba3.clustered.smb2.deny.deny2 test

This test failed to start, emitting the following error:
Unknown torture operation 'clustered.smb2.deny.deny2'

To fix this, remove the 'clustered.' prefix from the test name.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoselftest: Only run clusteredmember tests if ctdb is built
Joseph Sutton [Tue, 11 Apr 2023 22:15:30 +0000 (10:15 +1200)]
selftest: Only run clusteredmember tests if ctdb is built

Trying to run any of these tests without having built ctdb results in a
failure, as the environment cannot be started.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolib/torture: Don't overwrite test outcomes
Joseph Sutton [Tue, 11 Apr 2023 21:41:29 +0000 (09:41 +1200)]
lib/torture: Don't overwrite test outcomes

If a test fails an assertion, and later calls torture_skip() to skip
part of the test, the TORTURE_SKIP result will overwrite the
TORTURE_FAIL result, and the overall outcome will be successful.

To avoid this, we now arrange possible outcomes in order of priority,
and ensure we always keep the higher priority one.

This reveals some failing tests.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4:torture: Don't try to close the connection after running disconnect tests
Joseph Sutton [Tue, 11 Apr 2023 08:57:31 +0000 (20:57 +1200)]
s4:torture: Don't try to close the connection after running disconnect tests

dcerpc_mdssvc_close() would always fail with
STATUS_CONNECTION_DISCONNECTED, causing the testsuite as a whole to
fail.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4:torture: Correctly zero structure
Joseph Sutton [Tue, 11 Apr 2023 22:34:22 +0000 (10:34 +1200)]
s4:torture: Correctly zero structure

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4:rpc_server: Ensure EnumDomainUsers() doesn't return a NULL array
Joseph Sutton [Tue, 11 Apr 2023 08:36:15 +0000 (20:36 +1200)]
s4:rpc_server: Ensure EnumDomainUsers() doesn't return a NULL array

This is what source4/torture/rpc/samr.c:test_EnumDomainUsers_all() in
the test 'samba4.rpc.samr' expects, and allows that test to pass.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4:rpc_server: Handle LDB_ERR_NO_SUCH_ATTRIBUTE when deleting group
Joseph Sutton [Tue, 11 Apr 2023 08:19:52 +0000 (20:19 +1200)]
s4:rpc_server: Handle LDB_ERR_NO_SUCH_ATTRIBUTE when deleting group

This is what source4/torture/rpc/samr.c:test_AddGroupMember() in the
test 'samba4.rpc.samr' expects.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoselftest: Fix typo
Joseph Sutton [Tue, 11 Apr 2023 08:04:23 +0000 (20:04 +1200)]
selftest: Fix typo

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4:torture: Fix typo
Joseph Sutton [Tue, 11 Apr 2023 07:37:21 +0000 (19:37 +1200)]
s4:torture: Fix typo

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos3:selftest: Enable winbindd for maptoguest environment
Joseph Sutton [Tue, 11 Apr 2023 03:39:04 +0000 (15:39 +1200)]
s3:selftest: Enable winbindd for maptoguest environment

This is required for the samba3.blackbox.guest test to work. Without it,
the test fails to find a group map.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos3:tests: Correct condition
Joseph Sutton [Tue, 11 Apr 2023 02:43:23 +0000 (14:43 +1200)]
s3:tests: Correct condition

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotestprogs: Return correct status code
Joseph Sutton [Tue, 11 Apr 2023 02:38:30 +0000 (14:38 +1200)]
testprogs: Return correct status code

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos3:script: Always return a non-zero status code on failure
Joseph Sutton [Tue, 11 Apr 2023 02:34:07 +0000 (14:34 +1200)]
s3:script: Always return a non-zero status code on failure

If $expected didn't match $received, these functions would still return
zero.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotestprogs: Have testfail() return 0 on success
Joseph Sutton [Tue, 11 Apr 2023 02:31:59 +0000 (14:31 +1200)]
testprogs: Have testfail() return 0 on success

This is more consistent with the other testing functions.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotestprogs: Make test_rpcclient_expect_failure_grep() return 0 on success
Joseph Sutton [Tue, 11 Apr 2023 02:26:56 +0000 (14:26 +1200)]
testprogs: Make test_rpcclient_expect_failure_grep() return 0 on success

This is more consistent with the behaviour of the other expect_failure
functions.

Adjust all callers expecting the opposite behaviour to match.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotestprogs: Return correct status code
Joseph Sutton [Tue, 11 Apr 2023 02:24:55 +0000 (14:24 +1200)]
testprogs: Return correct status code

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotestprogs: Make test_smbclient_expect_failure() return 0 on success
Joseph Sutton [Tue, 11 Apr 2023 02:23:00 +0000 (14:23 +1200)]
testprogs: Make test_smbclient_expect_failure() return 0 on success

This is the behaviour that most existing callers expect, but the
function actually returns a non-zero status code in that case.

Adjust all callers expecting the opposite behaviour to match.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agonsswitch:tests: Remove unused functions
Joseph Sutton [Tue, 11 Apr 2023 02:20:01 +0000 (14:20 +1200)]
nsswitch:tests: Remove unused functions

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotestprogs: Make testit_expect_failure() return 0 on success
Joseph Sutton [Tue, 11 Apr 2023 02:04:59 +0000 (14:04 +1200)]
testprogs: Make testit_expect_failure() return 0 on success

This is the behaviour that most existing callers expect, but the
function actually returns a non-zero status code in that case.

Adjust all callers expecting the opposite behaviour to match.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotestprogs: Fix comparison
Joseph Sutton [Tue, 11 Apr 2023 02:00:51 +0000 (14:00 +1200)]
testprogs: Fix comparison

SC2039: In POSIX sh, == in place of = is undefined.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos3:net_usershare: Correctly escape newline in error message
Joseph Sutton [Mon, 13 Feb 2023 01:16:47 +0000 (14:16 +1300)]
s3:net_usershare: Correctly escape newline in error message

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-dsdb: Handle allocation failure
Joseph Sutton [Mon, 13 Feb 2023 02:00:21 +0000 (15:00 +1300)]
s4-dsdb: Handle allocation failure

If a talloc function returns NULL, indicating failure, the failure could
be masked by the next talloc call allocating on the NULL context.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos3:net_usershare: Handle allocation failure
Joseph Sutton [Mon, 13 Feb 2023 01:59:38 +0000 (14:59 +1300)]
s3:net_usershare: Handle allocation failure

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agosmbd/notify: Handle allocation failure
Joseph Sutton [Mon, 13 Feb 2023 01:58:52 +0000 (14:58 +1300)]
smbd/notify: Handle allocation failure

If a talloc function returns NULL, indicating failure, the failure could
be masked by the next talloc call allocating on the NULL context.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibndr: Handle allocation failure
Joseph Sutton [Mon, 13 Feb 2023 01:58:23 +0000 (14:58 +1300)]
libndr: Handle allocation failure

If a talloc function returns NULL, indicating failure, the failure could
be masked by the next talloc call allocating on the NULL context.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agopyldb: Handle allocation failure
Joseph Sutton [Mon, 13 Feb 2023 01:57:24 +0000 (14:57 +1300)]
pyldb: Handle allocation failure

If we don't check for NULL after each loop iteration, the failure could
be masked in the next iteration by talloc_asprintf_append() allocating
on the NULL context. That could result in values getting lost.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoctdb:tool: Remove unnecessary strlen()
Joseph Sutton [Mon, 3 Apr 2023 23:34:47 +0000 (11:34 +1200)]
ctdb:tool: Remove unnecessary strlen()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agolibrpc/ndr: Add missing newlines to error messages
Joseph Sutton [Mon, 3 Apr 2023 23:08:54 +0000 (11:08 +1200)]
librpc/ndr: Add missing newlines to error messages

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agopysmbd: Fix typo in error message
Joseph Sutton [Mon, 3 Apr 2023 23:06:47 +0000 (11:06 +1200)]
pysmbd: Fix typo in error message

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-drs: Don't skip over elements in uref_del_dest()
Joseph Sutton [Tue, 21 Mar 2023 00:47:16 +0000 (13:47 +1300)]
s4-drs: Don't skip over elements in uref_del_dest()

If we remove an element, we should not skip over the element following.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoposix_acls: Don't skip ACEs in merge_default_aces()
Joseph Sutton [Tue, 21 Mar 2023 00:43:20 +0000 (13:43 +1300)]
posix_acls: Don't skip ACEs in merge_default_aces()

If we remove the i'th element, we should decrement i so that we don't
skip over the succeeding element.

If we remove the j'th element, we should decrement j and continue around
the loop, so as not to skip subsequent elements.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-acl: Make parameter const
Joseph Sutton [Tue, 4 Apr 2023 22:02:35 +0000 (10:02 +1200)]
s4-acl: Make parameter const

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4/dsdb/cracknames: Remove unneeded attribute
Joseph Sutton [Thu, 26 Jan 2023 18:59:00 +0000 (07:59 +1300)]
s4/dsdb/cracknames: Remove unneeded attribute

The cracknames code never uses this.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-dsdb: Check correct ldb opaque variable
Joseph Sutton [Mon, 3 Apr 2023 04:45:07 +0000 (16:45 +1200)]
s4-dsdb: Check correct ldb opaque variable

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-dsdb: Remove is_attr_in_list()
Joseph Sutton [Mon, 13 Feb 2023 23:03:10 +0000 (12:03 +1300)]
s4-dsdb: Remove is_attr_in_list()

ldb_attr_in_list() already exists and does essentially the same thing.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4/dsdb/util: Make some arrays static
Joseph Sutton [Thu, 9 Mar 2023 23:39:54 +0000 (12:39 +1300)]
s4/dsdb/util: Make some arrays static

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoldb: Avoid undefined pointer arithmetic
Joseph Sutton [Mon, 20 Feb 2023 20:42:28 +0000 (09:42 +1300)]
ldb: Avoid undefined pointer arithmetic

Computing a pointer that points outside of an array, and not to one past
the last element, is undefined behaviour. To avoid this, do our
comparisons in terms of lengths, not pointers.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoldb: Fix function documentation to be consistent
Joseph Sutton [Mon, 13 Feb 2023 23:02:01 +0000 (12:02 +1300)]
ldb: Fix function documentation to be consistent

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoldb: Don't wrongly claim to return message elements
Joseph Sutton [Thu, 26 Jan 2023 19:02:18 +0000 (08:02 +1300)]
ldb: Don't wrongly claim to return message elements

If the LDB_UNPACK_DATA_FLAG_NO_ATTRS flag is set, we don't return any
elements, so we should set num_elements accordingly. This ensures
callers don't try to access elements that aren't there.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoldb: Remove misleading comment
Joseph Sutton [Tue, 4 Apr 2023 04:44:10 +0000 (16:44 +1200)]
ldb: Remove misleading comment

That an attribute has been access checked doesn't mean that the user has
the right to view it.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agoldb: Remove old misleading comments
Joseph Sutton [Wed, 29 Jun 2022 04:02:05 +0000 (16:02 +1200)]
ldb: Remove old misleading comments

Commit bed9efa6cda17ecca91bdf71227ec656b94dcf94 introduced
ldb_msg_add_linearized_dn() to replace ldb_msg_add_dn(), but retained
the now-incorrect associated comment. The comment later made its way
into a function added later by commit 'CVE-2022-32746 ldb: Add functions
for appending to an ldb_message'.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotalloc: Remove unneeded va_copy()
Joseph Sutton [Wed, 1 Mar 2023 21:23:40 +0000 (10:23 +1300)]
talloc: Remove unneeded va_copy()

We don't use 'ap' again after this.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotalloc: Put comment back in appropriate place
Joseph Sutton [Wed, 1 Mar 2023 21:22:45 +0000 (10:22 +1300)]
talloc: Put comment back in appropriate place

This comment originally referred, not to a va_copy() call, but to the
use of &c with vsnprintf() rather than passing in NULL with a length of
zero.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4:kdc: Fix typos
Joseph Sutton [Mon, 3 Apr 2023 04:56:56 +0000 (16:56 +1200)]
s4:kdc: Fix typos

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4:kdc: Fix typos in comments
Joseph Sutton [Fri, 29 Apr 2022 00:11:35 +0000 (12:11 +1200)]
s4:kdc: Fix typos in comments

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4:kdc: Allocate memory on a temporary context
Joseph Sutton [Tue, 4 Apr 2023 00:51:19 +0000 (12:51 +1200)]
s4:kdc: Allocate memory on a temporary context

We should not allocate memory on a longer-lived context than necessary.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4:kdc: Remove unused parameter
Joseph Sutton [Tue, 4 Apr 2023 00:54:08 +0000 (12:54 +1200)]
s4:kdc: Remove unused parameter

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agosamba-tool domain: Initialise variables before attempting to use them
Joseph Sutton [Mon, 13 Feb 2023 01:52:18 +0000 (14:52 +1300)]
samba-tool domain: Initialise variables before attempting to use them

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agopytest/acl: Remove unused remnants of source4/dsdb/tests/python/acl.py
Joseph Sutton [Tue, 4 Apr 2023 04:55:35 +0000 (16:55 +1200)]
pytest/acl: Remove unused remnants of source4/dsdb/tests/python/acl.py

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-dsdb:large_ldap: Note that we don't check that an error was raised
Joseph Sutton [Tue, 7 Mar 2023 00:43:25 +0000 (13:43 +1300)]
s4-dsdb:large_ldap: Note that we don't check that an error was raised

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-dsdb:large_ldap: Assert that we got all the entries
Joseph Sutton [Thu, 6 Apr 2023 00:19:43 +0000 (12:19 +1200)]
s4-dsdb:large_ldap: Assert that we got all the entries

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-dsdb:large_ldap: Fix disabled test
Joseph Sutton [Wed, 5 Apr 2023 04:47:29 +0000 (16:47 +1200)]
s4-dsdb:large_ldap: Fix disabled test

This test was silently skipped due to setUpClass() throwing a NameError.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-dsdb:large_ldap: Correctly increment count variable
Joseph Sutton [Tue, 7 Mar 2023 00:44:17 +0000 (13:44 +1300)]
s4-dsdb:large_ldap: Correctly increment count variable

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agos4-dsdb:large_ldap: Fix typos in variable names
Joseph Sutton [Mon, 13 Feb 2023 02:05:08 +0000 (15:05 +1300)]
s4-dsdb:large_ldap: Fix typos in variable names

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotests/krb5: Fix comment indentation
Joseph Sutton [Tue, 4 Apr 2023 23:55:06 +0000 (11:55 +1200)]
tests/krb5: Fix comment indentation

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agotests/krb5: Remove unused variable
Joseph Sutton [Tue, 4 Apr 2023 00:10:08 +0000 (12:10 +1200)]
tests/krb5: Remove unused variable

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
12 months agovfs_fruit: avoid using 'conn->tcon->compat', we can just use 'conn'!
Stefan Metzmacher [Wed, 5 Apr 2023 14:59:28 +0000 (16:59 +0200)]
vfs_fruit: avoid using 'conn->tcon->compat', we can just use 'conn'!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Apr 12 13:51:50 UTC 2023 on atb-devel-224

12 months agosmbXsrv_tcon: avoid storing temporary (invalid!) records.
Stefan Metzmacher [Wed, 5 Apr 2023 14:59:44 +0000 (16:59 +0200)]
smbXsrv_tcon: avoid storing temporary (invalid!) records.

We used to store smbXsrv_tcon_global.tdb records in two steps,
first we created a record in order to allocate the tcon id.
The temporary record had a NULL share_name, which translated
into 0 bytes for the string during ndr_push_smbXsrv_tcon_global0.

The problem is that ndr_pull_smbXsrv_tcon_global0 fails on
this with something like:

Invalid record in smbXsrv_tcon_global.tdb:key '2CA0ED4A' ndr_pull_struct_blob(length=85) - Buffer Size Error

The blob looks like this:

[0000] 00 00 00 00 01 00 00 00   00 00 00 00 00 00 02 00   ........  ........
[0010] 00 00 00 00 4A ED A0 2C   4A ED A0 2C 00 00 00 00   ....J.., J..,....
[0020] F8 4B 00 00 00 00 00 00   00 00 00 00 FF FF FF FF   .K......  ........
[0030] 4D 59 9B 9F 83 F4 35 20   36 D2 B0 82 62 68 D9 01   MY....5 6...bh..
[0040] 00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00   ........  ........
[0050] 00 00 00 00 00                                      .....

The reason for having a temporary entry was just based on
the fact, that it was easier to keep the logic in
make_connection_snum() untouched.

But we have all information available in order to store
the final record directly. We only need to do the
"max connections" check first.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
12 months agos3-client: Provide more information on protocol negotiation failures
Andrew Bartlett [Tue, 14 Mar 2023 00:01:07 +0000 (13:01 +1300)]
s3-client: Provide more information on protocol negotiation failures

In particular, this may help track down REASON: Exception: Exception: protocol negotiation failed: NT_STATUS_IO_TIMEOUT

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Apr 11 13:47:01 UTC 2023 on atb-devel-224

12 months agolib:replace: Fix snprintf of rep_inet_ntop()
Andreas Schneider [Thu, 6 Apr 2023 14:17:16 +0000 (16:17 +0200)]
lib:replace: Fix snprintf of rep_inet_ntop()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Apr 11 10:08:54 UTC 2023 on atb-devel-224