]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
19 months agoctdbd_conn: let register_with_ctdbd() call CTDB_CONTROL_REGISTER_SRVID just once
Stefan Metzmacher [Thu, 16 Nov 2023 12:04:12 +0000 (13:04 +0100)] 
ctdbd_conn: let register_with_ctdbd() call CTDB_CONTROL_REGISTER_SRVID just once

We do the dispatching to multiple handlers in ctdbd_msg_call_back()
and we don't need more than one message from ctdb.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
19 months agoctdbd_conn: don't use uninitialized memory in ctdbd_register_ips()
Stefan Metzmacher [Thu, 16 Nov 2023 12:29:18 +0000 (13:29 +0100)] 
ctdbd_conn: don't use uninitialized memory in ctdbd_register_ips()

We dump the structure into the socket, so we need to zero the content
including possible padding.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
19 months agoctdb: add/implement CTDB_CONTROL_TCP_CLIENT_PASSED
Stefan Metzmacher [Fri, 17 Nov 2023 14:59:57 +0000 (15:59 +0100)] 
ctdb: add/implement CTDB_CONTROL_TCP_CLIENT_PASSED

With multichannel a tcp connection is registered first with
a temporary smbd process, that calls CTDB_CONTROL_TCP_CLIENT
first and then passes the tcp connection to the longterm smbd
that already handles all connections belonging to the specific
client_guid. That smbd process calls CTDB_CONTROL_TCP_CLIENT
again, but the 'tickle' information is already there.
When the temporary smbd process exists/disconnects from ctdb
or calls CTDB_CONTROL_TCP_CLIENT_DISCONNECTED, the 'tickle'
information is removed, while the longterm smbd process
still serves the tcp connection.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
19 months agoctdb: add/implement CTDB_CONTROL_TCP_CLIENT_DISCONNECTED
Stefan Metzmacher [Wed, 15 Nov 2023 15:31:53 +0000 (16:31 +0100)] 
ctdb: add/implement CTDB_CONTROL_TCP_CLIENT_DISCONNECTED

With multichannel a ctdb connection from smbd may hold multiple
tcp connections, which can be disconnected before the smbd
process terminates the whole ctdb connection, so we a
way to remove undo 'CTDB_CONTROL_TCP_CLIENT' again.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
19 months agoctdb: add ctdb_connection_same() helper
Stefan Metzmacher [Tue, 12 Dec 2023 12:39:21 +0000 (13:39 +0100)] 
ctdb: add ctdb_connection_same() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
19 months agoctdb: make use of ctdb_canonicalize_ip_inplace() in ctdb_control_tcp_client()
Stefan Metzmacher [Tue, 12 Dec 2023 12:27:17 +0000 (13:27 +0100)] 
ctdb: make use of ctdb_canonicalize_ip_inplace() in ctdb_control_tcp_client()

We could also remove the src_addr and dest_addr helper variables
completely, but that would be too much for this commit.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
19 months agoctdb: add ctdb_canonicalize_ip_inplace() helper
Stefan Metzmacher [Tue, 12 Dec 2023 12:26:46 +0000 (13:26 +0100)] 
ctdb: add ctdb_canonicalize_ip_inplace() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
19 months agoctdb: remove unused ctdb->client_ip_list and print debug on ctdb_tcp_list instead
Stefan Metzmacher [Thu, 16 Nov 2023 10:56:59 +0000 (11:56 +0100)] 
ctdb: remove unused ctdb->client_ip_list and print debug on ctdb_tcp_list instead

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
19 months agoVERSION: move COPYRIGHT_STARTUP_MESSAGE as SAMBA_COPYRIGHT_STRING into version.h
Stefan Metzmacher [Thu, 14 Dec 2023 10:35:19 +0000 (11:35 +0100)] 
VERSION: move COPYRIGHT_STARTUP_MESSAGE as SAMBA_COPYRIGHT_STRING into version.h

We also prodive a samba_copyright_string() helper similar to
samba_version_string().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Dec 15 10:44:42 UTC 2023 on atb-devel-224

19 months agonetcmd: add shell command
Rob van der Linde [Thu, 2 Nov 2023 07:28:34 +0000 (20:28 +1300)] 
netcmd: add shell command

A simple samba-tool shell, can be quite useful to play around with the ldb database and models.

All models get imported and the samdb connection variable made available.

Example usage:

    bin/samba-tool shell -H <host> --workgroup <workgroup> --realm <realm>

>>> silos = AuthenticationSilo.query(ldb)
>>> for silo in silos:
...     print(silo)
...

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-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): Fri Dec 15 03:51:55 UTC 2023 on atb-devel-224

19 months agopython: use python3 style super statements
Rob van der Linde [Thu, 14 Dec 2023 02:30:42 +0000 (15:30 +1300)] 
python: use python3 style super statements

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agonetcmd: getpassword: get rid of pointless overridden constructors
Rob van der Linde [Thu, 14 Dec 2023 02:24:29 +0000 (15:24 +1300)] 
netcmd: getpassword: get rid of pointless overridden constructors

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: pep257: docstring should use double quotes
Rob van der Linde [Thu, 14 Dec 2023 02:14:27 +0000 (15:14 +1300)] 
python: pep257: docstring should use double quotes

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove references to removed parameters
Joseph Sutton [Fri, 1 Dec 2023 02:01:16 +0000 (15:01 +1300)] 
python: Remove references to removed parameters

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): Thu Dec 14 04:32:31 UTC 2023 on atb-devel-224

19 months agopython: Remove unused parameter ‘backup’
Joseph Sutton [Thu, 23 Nov 2023 08:04:07 +0000 (21:04 +1300)] 
python: Remove unused parameter ‘backup’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘serverrole’
Joseph Sutton [Thu, 23 Nov 2023 08:03:57 +0000 (21:03 +1300)] 
python: Remove unused parameter ‘serverrole’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘am_rodc’
Joseph Sutton [Thu, 23 Nov 2023 08:03:19 +0000 (21:03 +1300)] 
python: Remove unused parameter ‘am_rodc’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘am_rodc’
Joseph Sutton [Thu, 23 Nov 2023 08:02:13 +0000 (21:02 +1300)] 
python: Remove unused parameter ‘am_rodc’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameters ‘backend_store’ and ‘backend_store_size’
Joseph Sutton [Thu, 23 Nov 2023 08:01:19 +0000 (21:01 +1300)] 
python: Remove unused parameters ‘backend_store’ and ‘backend_store_size’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameters ‘backend_store’ and ‘backend_store_size’
Joseph Sutton [Thu, 23 Nov 2023 07:59:59 +0000 (20:59 +1300)] 
python: Remove unused parameters ‘backend_store’ and ‘backend_store_size’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘fill’
Joseph Sutton [Thu, 23 Nov 2023 07:58:02 +0000 (20:58 +1300)] 
python: Remove unused parameter ‘fill’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘keytab_path’
Joseph Sutton [Thu, 23 Nov 2023 07:57:29 +0000 (20:57 +1300)] 
python: Remove unused parameter ‘keytab_path’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘erase’
Joseph Sutton [Thu, 23 Nov 2023 07:57:10 +0000 (20:57 +1300)] 
python: Remove unused parameter ‘erase’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘backend_store_size’
Joseph Sutton [Thu, 23 Nov 2023 07:56:49 +0000 (20:56 +1300)] 
python: Remove unused parameter ‘backend_store_size’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘root_gid’
Joseph Sutton [Thu, 23 Nov 2023 07:55:41 +0000 (20:55 +1300)] 
python: Remove unused parameter ‘root_gid’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameters ‘maxuid’ and ‘maxgid’
Joseph Sutton [Thu, 23 Nov 2023 07:54:45 +0000 (20:54 +1300)] 
python: Remove unused parameters ‘maxuid’ and ‘maxgid’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameters ‘maxuid’ and ‘maxgid’
Joseph Sutton [Thu, 23 Nov 2023 07:53:41 +0000 (20:53 +1300)] 
python: Remove unused parameters ‘maxuid’ and ‘maxgid’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘name’
Joseph Sutton [Thu, 23 Nov 2023 07:52:32 +0000 (20:52 +1300)] 
python: Remove unused parameter ‘name’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘netlogon’
Joseph Sutton [Thu, 23 Nov 2023 07:52:03 +0000 (20:52 +1300)] 
python: Remove unused parameter ‘netlogon’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘samdb’
Joseph Sutton [Thu, 23 Nov 2023 07:50:42 +0000 (20:50 +1300)] 
python: Remove unused parameter ‘samdb’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘lp’
Joseph Sutton [Thu, 23 Nov 2023 07:50:18 +0000 (20:50 +1300)] 
python: Remove unused parameter ‘lp’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘message’
Joseph Sutton [Thu, 23 Nov 2023 07:48:56 +0000 (20:48 +1300)] 
python: Remove unused parameter ‘message’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘targetdir’
Joseph Sutton [Thu, 23 Nov 2023 07:47:31 +0000 (20:47 +1300)] 
python: Remove unused parameter ‘targetdir’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘backend_store’
Joseph Sutton [Thu, 23 Nov 2023 07:42:57 +0000 (20:42 +1300)] 
python: Remove unused parameter ‘backend_store’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘lp’
Joseph Sutton [Thu, 23 Nov 2023 07:42:16 +0000 (20:42 +1300)] 
python: Remove unused parameter ‘lp’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘lp’
Joseph Sutton [Thu, 23 Nov 2023 07:41:18 +0000 (20:41 +1300)] 
python: Remove unused parameter ‘lp’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘targetdir’
Joseph Sutton [Thu, 23 Nov 2023 07:40:16 +0000 (20:40 +1300)] 
python: Remove unused parameter ‘targetdir’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘targetdir’
Joseph Sutton [Thu, 23 Nov 2023 07:38:15 +0000 (20:38 +1300)] 
python: Remove unused parameter ‘targetdir’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘backend_store’
Joseph Sutton [Thu, 23 Nov 2023 07:37:04 +0000 (20:37 +1300)] 
python: Remove unused parameter ‘backend_store’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘lp’
Joseph Sutton [Thu, 23 Nov 2023 07:34:31 +0000 (20:34 +1300)] 
python: Remove unused parameter ‘lp’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘logger’
Joseph Sutton [Thu, 23 Nov 2023 07:34:08 +0000 (20:34 +1300)] 
python: Remove unused parameter ‘logger’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Make use of ‘prefix’ parameter
Joseph Sutton [Thu, 30 Nov 2023 04:05:22 +0000 (17:05 +1300)] 
python: Make use of ‘prefix’ parameter

This method is now consistent with the other ‘add_*_record()’ methods.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘lp’
Joseph Sutton [Thu, 23 Nov 2023 07:31:55 +0000 (20:31 +1300)] 
python: Remove unused parameter ‘lp’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused parameter ‘targetdir’
Joseph Sutton [Thu, 23 Nov 2023 07:30:55 +0000 (20:30 +1300)] 
python: Remove unused parameter ‘targetdir’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Make use of ‘serverdn’ parameter
Joseph Sutton [Thu, 30 Nov 2023 04:01:11 +0000 (17:01 +1300)] 
python: Make use of ‘serverdn’ parameter

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unused variable ‘machinesid’
Joseph Sutton [Thu, 23 Nov 2023 07:22:16 +0000 (20:22 +1300)] 
python: Remove unused variable ‘machinesid’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agopython: Remove unfinished join method
Joseph Sutton [Mon, 13 Nov 2023 00:00:43 +0000 (13:00 +1300)] 
python: Remove unfinished join method

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agolibcli/security: allow SDDL conditional ACE round-trip for -00 and -0x0
Douglas Bagnall [Wed, 13 Dec 2023 23:50:31 +0000 (12:50 +1300)] 
libcli/security: allow SDDL conditional ACE round-trip for -00 and -0x0

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agolibcli/security: allow round-trip for conditional ACE hex integers
Douglas Bagnall [Wed, 13 Dec 2023 04:24:50 +0000 (17:24 +1300)] 
libcli/security: allow round-trip for conditional ACE hex integers

As with the previous commit, though not addressing the particular fuzz
case, zero hex numbers need to be explicitly written as "0x0", or the
round-trip will fail.

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62929

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agolibcli/security: allow round-trip for conditional ACE octal integers
Douglas Bagnall [Wed, 13 Dec 2023 04:20:38 +0000 (17:20 +1300)] 
libcli/security: allow round-trip for conditional ACE octal integers

The string "00" will decode into an integer tagged as octal, but
`snprintf("%#oll")` will write the string "0", which would decode as
decimal, so the in the SDDL1->SD1->SDDL2->SD2 round trip, SD1 would
not be the same as SD2.

The effect is really only relevant to SDDL, which wants to remember
what base the numbers were presented in, though the fuzzers and tests
don't directly compare SDDL, which can have extra spaces and so forth.

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62929

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agolibcli/security: tests for conditional ACE integer base persistence
Douglas Bagnall [Wed, 13 Dec 2023 22:56:19 +0000 (11:56 +1300)] 
libcli/security: tests for conditional ACE integer base persistence

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62929

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agolibcli/security: fix tests for SDDL conditional ACE round-trip
Douglas Bagnall [Wed, 13 Dec 2023 23:27:08 +0000 (12:27 +1300)] 
libcli/security: fix tests for SDDL conditional ACE round-trip

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agolibcli/security: clarify tests for SDDL round trips
Douglas Bagnall [Wed, 13 Dec 2023 22:56:19 +0000 (11:56 +1300)] 
libcli/security: clarify tests for SDDL round trips

The `failed = failed || ok` did the same thing, obscurely.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agolibcli/security: don't allow conditional ACE SIDs to have trailing bytes
Douglas Bagnall [Wed, 13 Dec 2023 02:39:33 +0000 (15:39 +1300)] 
libcli/security: don't allow conditional ACE SIDs to have trailing bytes

They should be tightly packed, allowing conditional ACEs to
round-trip.

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64197

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agolibcli/security: SDDL decode stops earlier with too many ACEs
Douglas Bagnall [Tue, 12 Dec 2023 21:57:41 +0000 (10:57 +1300)] 
libcli/security: SDDL decode stops earlier with too many ACEs

For this purpose, "too many" means we know for sure that it won't fit
in packet format, even if all the ACEs are minimum size. This would
fail anyway.

Credit to OSS-Fuzz, who found that 50 thousand ACEs that took more
than 60 seconds to decode. This will now fail after 4096 ACEs which
should be about 150 times faster than 50k (because the realloc loop in
quadratic), so ~0.5 seconds in the fuzz context with sanitisers
enabled. That is still slowish, but SDDL parsing is not a critical
path and without address sanitisers it will be many times faster.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62511

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agotests: Add a test for the idmap_nss : use_upn setting
Samuel Cabrero [Tue, 12 Dec 2023 20:17:50 +0000 (21:17 +0100)] 
tests: Add a test for the idmap_nss : use_upn setting

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Wed Dec 13 16:05:19 UTC 2023 on atb-devel-224

19 months agoidmap_nss: Install a messaging filter to reload the configuration
Samuel Cabrero [Tue, 12 Dec 2023 15:02:33 +0000 (16:02 +0100)] 
idmap_nss: Install a messaging filter to reload the configuration

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
19 months agoidmap_nss: Add a parameter to use UPNs instead of plain names
Samuel Cabrero [Mon, 27 Nov 2023 07:05:29 +0000 (08:05 +0100)] 
idmap_nss: Add a parameter to use UPNs instead of plain names

idmap config <DOMAIN> : backend = nss
idmap config <DOMAIN> : use_upn = yes|no

When translating a Unix ID to a SID the module calls get[pwu|grg]id() but the
name returned by some NSS modules might be a UPN instead of a plain name. If
the new parameter is enabled the returned name will be parsed and correctly
handled.

On the other hand, when translating a SID to a Unix ID the module first
resolves the SID to a domain + name, and then calls get[pw|gr]name() with the
plain name, or the UPN if the new parameter is enabled.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
19 months agoidmap_nss: Increase debug on failures
Samuel Cabrero [Wed, 29 Nov 2023 11:55:13 +0000 (12:55 +0100)] 
idmap_nss: Increase debug on failures

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
19 months agodocs: Document idmap_nss "range" option
Samuel Cabrero [Mon, 27 Nov 2023 09:20:05 +0000 (10:20 +0100)] 
docs: Document idmap_nss "range" option

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
19 months agos3:winbind: Register a messaging filter foreach domain child
Samuel Cabrero [Tue, 12 Dec 2023 14:55:20 +0000 (15:55 +0100)] 
s3:winbind: Register a messaging filter foreach domain child

Instead of registering the "classic" callback for MSG_SMB_CONF_UPDATED,
install a message filter to allow other parts of the code to also
listen for this message because classic callbacks are delivered only
once (see commit a2436b67e5dd47d955a3bea2b83e0693b627ab96).

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
19 months agos3:winbind: talloc the static locator child
Samuel Cabrero [Tue, 12 Dec 2023 14:49:07 +0000 (15:49 +0100)] 
s3:winbind: talloc the static locator child

Next commits will use talloc_get_type_abort() to get the reference.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
19 months agos3:winbind: talloc the static idmap child
Samuel Cabrero [Tue, 12 Dec 2023 14:44:21 +0000 (15:44 +0100)] 
s3:winbind: talloc the static idmap child

Next commits will use talloc_get_type_abort() to get the reference.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
19 months agobuildtools: Remove ‘keep_underscore’ parameter
Joseph Sutton [Sun, 12 Nov 2023 20:44:26 +0000 (09:44 +1300)] 
buildtools: Remove ‘keep_underscore’ parameter

Nothing now passes this in.

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 Dec 11 02:13:39 UTC 2023 on atb-devel-224

19 months agobuildtools: Remove useless ‘keep_underscore’ parameter
Joseph Sutton [Sun, 12 Nov 2023 20:39:20 +0000 (09:39 +1300)] 
buildtools: Remove useless ‘keep_underscore’ parameter

SAMBA_LIBARY()’s ‘keep_underscore’ parameter has an effect only if None
is passed in for ‘bundled_name’. However, SAMBA_PLUGIN() always passes
in a string for ‘bundled_name’. Therefore ‘keep_underscore’ will never
have any effect — remove it.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agobuildtools: Pass through parameter ‘keep_underscore’
Joseph Sutton [Fri, 20 Oct 2023 23:08:23 +0000 (12:08 +1300)] 
buildtools: Pass through parameter ‘keep_underscore’

This parameter has gone unused until now.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agos4:librpc: Fix code spelling
Joseph Sutton [Fri, 10 Nov 2023 21:03:20 +0000 (10:03 +1300)] 
s4:librpc: Fix code spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agobuildtools: Fix code spelling
Joseph Sutton [Sat, 21 Oct 2023 02:14:04 +0000 (15:14 +1300)] 
buildtools: Fix code spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agobuildtools: Remove unused parameter ‘env’
Joseph Sutton [Sat, 21 Oct 2023 01:13:27 +0000 (14:13 +1300)] 
buildtools: Remove unused parameter ‘env’

This parameter goes unused, and nothing passes it in.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agos3:utils: Fix auth callback with smburl
Andreas Schneider [Wed, 6 Dec 2023 12:16:53 +0000 (13:16 +0100)] 
s3:utils: Fix auth callback with smburl

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

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): Sun Dec 10 22:22:51 UTC 2023 on atb-devel-224

19 months agos3:tests: Add interactive smbget test for password entry
Andreas Schneider [Wed, 6 Dec 2023 14:58:08 +0000 (15:58 +0100)] 
s3:tests: Add interactive smbget test for password entry

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoauth:creds: Add cli_credentials_get_domain_and_obtained()
Andreas Schneider [Wed, 6 Dec 2023 12:26:43 +0000 (13:26 +0100)] 
auth:creds: Add cli_credentials_get_domain_and_obtained()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoauth:creds: Fix cli_credentials_get_password_and_obtained() with callback
Andreas Schneider [Wed, 6 Dec 2023 12:06:42 +0000 (13:06 +0100)] 
auth:creds: Fix cli_credentials_get_password_and_obtained() with callback

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoauth:creds:tests: Add test for password callback
Andreas Schneider [Wed, 6 Dec 2023 12:16:26 +0000 (13:16 +0100)] 
auth:creds:tests: Add test for password callback

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agos3:tests: Fix smbget test
Andreas Schneider [Thu, 7 Dec 2023 08:47:14 +0000 (09:47 +0100)] 
s3:tests: Fix smbget test

Time to fix the smget share to not have `guest ok = yes` set. A new
[smbget_guest] will be used for guest only tests. This way we can
correctly test different authentication mechanisms.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agos3:tests: Remove the non-working test_kerberos_upn_denied of smbget
Andreas Schneider [Thu, 7 Dec 2023 12:11:46 +0000 (13:11 +0100)] 
s3:tests: Remove the non-working test_kerberos_upn_denied of smbget

See TODO code comment for details.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agos3:tests: Fix the test_kerberos_trust in smbget testsuite
Andreas Schneider [Thu, 7 Dec 2023 10:43:33 +0000 (11:43 +0100)] 
s3:tests: Fix the test_kerberos_trust in smbget testsuite

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agos3:tests: Fix test_kerberos in smbget tests
Andreas Schneider [Thu, 7 Dec 2023 09:51:32 +0000 (10:51 +0100)] 
s3:tests: Fix test_kerberos in smbget tests

We switched to a temporary directory, so $PREFIX doesn't exist.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agos3:tests: Pass down a normal domain user for test_smbget.sh
Andreas Schneider [Thu, 7 Dec 2023 08:45:54 +0000 (09:45 +0100)] 
s3:tests: Pass down a normal domain user for test_smbget.sh

It is better to test with a normal user than administrator.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest: Add DOMAIN_ADMIN and DOMAIN_USER variables
Andreas Schneider [Fri, 8 Dec 2023 12:07:19 +0000 (13:07 +0100)] 
selftest: Add DOMAIN_ADMIN and DOMAIN_USER variables

We should start using those in future. So we can distinguish which
privileges we want. Currently DC_USERNAME is the Administrator. Whatever
possible should use DOMIAN_USER instead.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest: Remove trailing tabs/white spaces in Samba4.pm
Andreas Schneider [Fri, 8 Dec 2023 12:06:27 +0000 (13:06 +0100)] 
selftest: Remove trailing tabs/white spaces in Samba4.pm

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agos3:tests: Fix authentication with smbget_user in smbget tests
Andreas Schneider [Thu, 7 Dec 2023 08:18:26 +0000 (09:18 +0100)] 
s3:tests: Fix authentication with smbget_user in smbget tests

Currently the smget share is broken. We set `guest ok = yes` so if you
specify invalid names, the authentication will still succeed as we
are mapped to guest.

The smbget_user is a local ad_member user. We need to set the
workstation as the "domain" for the user.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest/knownfail: move more parts to expectedfail.d/ntlm-auth
Douglas Bagnall [Fri, 8 Dec 2023 03:59:33 +0000 (16:59 +1300)] 
selftest/knownfail: move more parts to expectedfail.d/ntlm-auth

Here NTLM is disabled, so failure is intended.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest/knownfail: move some parts to expectedfail.d/ntlm-auth
Douglas Bagnall [Fri, 8 Dec 2023 03:58:10 +0000 (16:58 +1300)] 
selftest/knownfail: move some parts to expectedfail.d/ntlm-auth

Where NETLOGON is disabled, the failure is intended.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest/knownfail.d: move encrypted_secrets to expectedfail.d
Douglas Bagnall [Fri, 8 Dec 2023 03:37:39 +0000 (16:37 +1300)] 
selftest/knownfail.d: move encrypted_secrets to expectedfail.d

From the file itself:

> # The fl2000dc environment is provisioned with the --plaintext-secrets option
> # running the ecnrypted secrets tests on it and expecting them to fail.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest/knownfail.d: move ntlmv1-restrictions to expectedfail.d
Douglas Bagnall [Fri, 8 Dec 2023 03:31:34 +0000 (16:31 +1300)] 
selftest/knownfail.d: move ntlmv1-restrictions to expectedfail.d

These tests have been set up to fail by smb.conf options, partly
in order to test those options.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest/knownfail.d: move samba-4.5-emulation to expectedfail.d
Douglas Bagnall [Fri, 8 Dec 2023 03:22:16 +0000 (16:22 +1300)] 
selftest/knownfail.d: move samba-4.5-emulation to expectedfail.d

These tests are expected to fail because the handling of GET_ANC has
deliberately been degraded in this environment (in order to test an
upgrade path, long story).

> We now show this is in effect by the fact that tests now fail.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest/knownfail.d: move labdc to expectedfail.d
Douglas Bagnall [Fri, 8 Dec 2023 03:18:25 +0000 (16:18 +1300)] 
selftest/knownfail.d: move labdc to expectedfail.d

To quote the original commit:

> Note that the rpc.echo tests for the testallowed and testdenied users
> fail, because we don't backup the secrets for these users. So these
> tests failing proves that the lab-DC testenv is correct.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest/knownfail.d: remove empty files
Douglas Bagnall [Fri, 8 Dec 2023 03:07:47 +0000 (16:07 +1300)] 
selftest/knownfail.d: remove empty files

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest/knownfail.d: README memntions expectedfail.d
Douglas Bagnall [Fri, 8 Dec 2023 03:06:08 +0000 (16:06 +1300)] 
selftest/knownfail.d: README memntions expectedfail.d

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
19 months agoselftest: add an expectedfail directory
Douglas Bagnall [Fri, 8 Dec 2023 03:05:36 +0000 (16:05 +1300)] 
selftest: add an expectedfail directory

We have some tests that are not only known to fail, but which are
intended to fail.

For example, to quote selftest/knownfail.d/dns:

> # These tests are expected to fail because we want to ensure that
> # unauthenticated updates are not permitted against the default
> # configuration, nor against an RODC

In contrast to selftest/knownfail.d/uac_objectclass_restrict, which
says:

> # All these tests need to be fixed and the entries here removed

That one should stay in selftest/knownfail.d.

Some files are mixed. For example, there are lines in
selftest/knownfail.d/smb1-tests which were added in *commits* that say

> We also need to add a knownfail (which will not be removed) for the
> new test which will fail in smb1 envs

but it is not clear to me that the whole file is expected to always
fail.

By moving some knownfails here, we allow selftest/knownfail.d to be a
bit more like a TODO list, containing things that actually constitute
failure.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
20 months agoselftest: Remove unused import
Joseph Sutton [Wed, 8 Nov 2023 21:55:24 +0000 (10:55 +1300)] 
selftest: Remove unused import

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): Fri Dec  8 03:25:20 UTC 2023 on atb-devel-224

20 months agoRevert "s4:torture: Increase multichannel timeout"
Joseph Sutton [Wed, 29 Nov 2023 22:57:08 +0000 (11:57 +1300)] 
Revert "s4:torture: Increase multichannel timeout"

This reverts commit c6d0df787a1f6007e1f4594f68ff1f75a46bd293.

Said commit did not help with GitLab CI timeouts, but just made the CI
pipeline take longer when the test did time out.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
20 months agos4:ntvfs: Remove trailing whitespace
Joseph Sutton [Tue, 24 Oct 2023 03:24:03 +0000 (16:24 +1300)] 
s4:ntvfs: Remove trailing whitespace

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
20 months agopymessaging: Remove trailing whitespace
Joseph Sutton [Tue, 14 Nov 2023 00:07:01 +0000 (13:07 +1300)] 
pymessaging: Remove trailing whitespace

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
20 months agos4:kdc: Remove unused includes
Joseph Sutton [Mon, 4 Dec 2023 06:25:33 +0000 (19:25 +1300)] 
s4:kdc: Remove unused includes

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
20 months agos4:include: Fix code spelling
Joseph Sutton [Thu, 9 Nov 2023 03:02:59 +0000 (16:02 +1300)] 
s4:include: Fix code spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
20 months agos4:include: Remove trailing whitespace
Joseph Sutton [Thu, 9 Nov 2023 03:02:48 +0000 (16:02 +1300)] 
s4:include: Remove trailing whitespace

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
20 months agos4:dsdb: Fix code spelling
Joseph Sutton [Tue, 5 Dec 2023 03:54:44 +0000 (16:54 +1300)] 
s4:dsdb: Fix code spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
20 months agos4:dsdb: Remove trailing whitespace
Joseph Sutton [Wed, 6 Dec 2023 01:39:45 +0000 (14:39 +1300)] 
s4:dsdb: Remove trailing whitespace

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