]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
22 months agoldb: sync DLIST_DEMOTE_SHORT() changes to include/dlinklist.h
Stefan Metzmacher [Mon, 30 Jan 2023 15:10:07 +0000 (16:10 +0100)] 
ldb: sync DLIST_DEMOTE_SHORT() changes to include/dlinklist.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
22 months agolib/util: sync DLIST_DEMOTE_SHORT() changes to dlinklist.h
Stefan Metzmacher [Mon, 30 Jan 2023 15:10:07 +0000 (16:10 +0100)] 
lib/util: sync DLIST_DEMOTE_SHORT() changes to dlinklist.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
22 months agotevent: introduce DLIST_DEMOTE_SHORT()
Stefan Metzmacher [Mon, 30 Jan 2023 15:10:07 +0000 (16:10 +0100)] 
tevent: introduce DLIST_DEMOTE_SHORT()

It turns out that the overhead of DLIST_DEMOTE() implemented
as DLIST_REMOVE();DLIST_ADD_END(), is very high if the list
contains only 1 or 2 elements.

The next commits will make use of DLIST_DEMOTE_SHORT() for
multiplexing multiple tevent_fd structures for a single fd
and the most important and common case is a list with just
one element.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
22 months agowintest: Fix invalid escape sequences
Joseph Sutton [Sun, 10 Sep 2023 23:59:55 +0000 (11:59 +1200)] 
wintest: Fix invalid escape sequences

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 Oct 13 04:55:06 UTC 2023 on atb-devel-224

22 months agoselftest: Use now() instead of utcnow()
Joseph Sutton [Mon, 2 Oct 2023 00:58:18 +0000 (13:58 +1300)] 
selftest: Use now() instead of utcnow()

utcnow() is deprecated and will be removed in a future version of Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:torture: Use assertEqual() instead of assertEquals()
Joseph Sutton [Mon, 2 Oct 2023 00:35:32 +0000 (13:35 +1300)] 
s4:torture: Use assertEqual() instead of assertEquals()

assertEquals() was removed in Python 3.12.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb:tests: Use loadTestsFromTestCase() instead of makeSuite()
Joseph Sutton [Mon, 2 Oct 2023 02:07:54 +0000 (15:07 +1300)] 
s4:dsdb:tests: Use loadTestsFromTestCase() instead of makeSuite()

makeSuite() is deprecated and will be removed in Python 3.13.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb:tests: Fix assertion messages
Joseph Sutton [Mon, 2 Oct 2023 01:25:52 +0000 (14:25 +1300)] 
s4:dsdb:tests: Fix assertion messages

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb:tests: Remove unused variables
Joseph Sutton [Mon, 2 Oct 2023 01:25:16 +0000 (14:25 +1300)] 
s4:dsdb:tests: Remove unused variables

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb:tests: Remove unused imports
Joseph Sutton [Mon, 2 Oct 2023 01:24:49 +0000 (14:24 +1300)] 
s4:dsdb:tests: Remove unused imports

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:script: Remove semicolons
Joseph Sutton [Wed, 16 Aug 2023 23:20:40 +0000 (11:20 +1200)] 
s3:script: Remove semicolons

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agotests/krb5: Fix assertion messages
Joseph Sutton [Mon, 2 Oct 2023 02:06:45 +0000 (15:06 +1300)] 
tests/krb5: Fix assertion messages

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agotests/krb5: Use assertEqual() instead of assertEquals()
Joseph Sutton [Mon, 2 Oct 2023 00:32:10 +0000 (13:32 +1300)] 
tests/krb5: Use assertEqual() instead of assertEquals()

assertEquals() was removed in Python 3.12.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agopython:tests: Use now() instead of utcnow()
Joseph Sutton [Mon, 2 Oct 2023 00:58:00 +0000 (13:58 +1300)] 
python:tests: Use now() instead of utcnow()

utcnow() is deprecated and will be removed in a future version of Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agopython:tests: Remove semicolons
Joseph Sutton [Wed, 16 Aug 2023 23:09:31 +0000 (11:09 +1200)] 
python:tests: Remove semicolons

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agopython:tests: Correct search expression
Joseph Sutton [Mon, 2 Oct 2023 02:07:16 +0000 (15:07 +1300)] 
python:tests: Correct search expression

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agopython:tests: Fix comment
Joseph Sutton [Mon, 2 Oct 2023 02:07:03 +0000 (15:07 +1300)] 
python:tests: Fix comment

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agopython:tests: Fix exception message
Joseph Sutton [Mon, 2 Oct 2023 02:06:07 +0000 (15:06 +1300)] 
python:tests: Fix exception message

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agopython:tests: Use assertEqual() instead of assertEquals()
Joseph Sutton [Mon, 2 Oct 2023 00:34:05 +0000 (13:34 +1300)] 
python:tests: Use assertEqual() instead of assertEquals()

assertEquals() was removed in Python 3.12.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agopython:subunit: Use now() instead of utcnow()
Joseph Sutton [Mon, 2 Oct 2023 00:57:43 +0000 (13:57 +1300)] 
python:subunit: Use now() instead of utcnow()

utcnow() is deprecated and will be removed in a future version of Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agopython:colour: Fix exception message
Joseph Sutton [Mon, 2 Oct 2023 02:05:33 +0000 (15:05 +1300)] 
python:colour: Fix exception message

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agoexamples: Fix invalid escape sequences
Joseph Sutton [Sun, 10 Sep 2023 23:59:08 +0000 (11:59 +1200)] 
examples: Fix invalid escape sequences

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agoexamples: Don’t use deprecated method ‘has_key()’
Joseph Sutton [Sun, 10 Sep 2023 23:50:22 +0000 (11:50 +1200)] 
examples: Don’t use deprecated method ‘has_key()’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agobuildtools: Remove semicolons
Joseph Sutton [Tue, 29 Aug 2023 08:47:58 +0000 (20:47 +1200)] 
buildtools: Remove semicolons

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4-torture: add another test to demonstrate identical functions
Günther Deschner [Thu, 28 Sep 2023 20:01:36 +0000 (22:01 +0200)] 
s4-torture: add another test to demonstrate identical functions

Create a spoolss_EnumPrinters request and send it to both endpoints and
verify they deliver identical replies.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Oct 13 03:19:59 UTC 2023 on atb-devel-224

22 months agos3-iremotewinspool: check for correct object_uuid in dispatch fn.
Günther Deschner [Mon, 25 Sep 2023 18:31:24 +0000 (20:31 +0200)] 
s3-iremotewinspool: check for correct object_uuid in dispatch fn.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4-torture: add testcase to iremotewinspool suite to explore object_uuid handling
Günther Deschner [Mon, 25 Sep 2023 18:28:52 +0000 (20:28 +0200)] 
s4-torture: add testcase to iremotewinspool suite to explore object_uuid handling

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3-iremotewinspool: properly map incoming PAR to RPRN requests.
Günther Deschner [Fri, 22 Sep 2023 22:29:51 +0000 (00:29 +0200)] 
s3-iremotewinspool: properly map incoming PAR to RPRN requests.

Map the incoming iremotewinspool opnum to match the appropriate call in
the spoolss server in the pull path.

There is no 1:1 mapping in the opnums between the procols, only in the
corresponding functions.

Without doing the mapping we currently forward
e.g. winspool_AsyncOpenPrinter() to spoolss_EnumPrinters() leading to
all sorts of errors.

A correct mapping was in place earlier with an handsorted server call
table but it got removed with the rpc server rewrite.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3-iremotewinspool: add PAR->RPRN mapping table
Günther Deschner [Thu, 25 Aug 2016 09:37:36 +0000 (11:37 +0200)] 
s3-iremotewinspool: add PAR->RPRN mapping table

There is no 1:1 mapping between the opcodes but between the functions
(including _Ex and _2 naming extensions):

e.g.
winspool_AsyncOpenPrinter  (0x00) -> spoolss_OpenPrinterEx (0x45)
winspool_AsyncClosePrinter (0x14) -> spoolss_ClosePrinter  (0x1d)

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:rpc_server: Check return values of gnutls functions (CID 1452111)
Joseph Sutton [Fri, 6 Oct 2023 01:24:51 +0000 (14:24 +1300)] 
s4:rpc_server: Check return values of gnutls functions (CID 1452111)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:rpc_server: Check mkdir() return value (CID 1034649)
Joseph Sutton [Thu, 5 Oct 2023 22:10:25 +0000 (11:10 +1300)] 
s4:rpc_server: Check mkdir() return value (CID 1034649)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:ntvfs: Correctly acknowledge PVFS_FLAG_STRICT_SYNC flag (CID 241154)
Joseph Sutton [Fri, 6 Oct 2023 03:00:46 +0000 (16:00 +1300)] 
s4:ntvfs: Correctly acknowledge PVFS_FLAG_STRICT_SYNC flag (CID 241154)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:ntvfs: Remove dead code path
Joseph Sutton [Thu, 5 Oct 2023 21:10:16 +0000 (10:10 +1300)] 
s4:ntvfs: Remove dead code path

‘pending’ will never be NULL.

View with ‘git show -b’.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:ntvfs: Remove unneeded NULL check (CID 240771)
Joseph Sutton [Thu, 5 Oct 2023 21:07:14 +0000 (10:07 +1300)] 
s4:ntvfs: Remove unneeded NULL check (CID 240771)

We’ve already dereferenced ‘pending’ in the init‐clause of the loop, and
won’t reassign it during the loop.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:messaging: Remove redundant code
Joseph Sutton [Thu, 5 Oct 2023 23:03:40 +0000 (12:03 +1300)] 
s4:messaging: Remove redundant code

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:libcli: Check return value of convert_string_talloc() (CID 1272839)
Joseph Sutton [Fri, 6 Oct 2023 01:10:09 +0000 (14:10 +1300)] 
s4:libcli: Check return value of convert_string_talloc() (CID 1272839)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:libcli: Remove unnecessary casts
Joseph Sutton [Wed, 9 Aug 2023 04:55:15 +0000 (16:55 +1200)] 
s4:libcli: Remove unnecessary casts

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb: Don’t overwrite existing error code (CID 1445263)
Joseph Sutton [Fri, 6 Oct 2023 02:43:41 +0000 (15:43 +1300)] 
s4:dsdb: Don’t overwrite existing error code (CID 1445263)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb: Log correct ldb error
Joseph Sutton [Fri, 6 Oct 2023 02:43:13 +0000 (15:43 +1300)] 
s4:dsdb: Log correct ldb error

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb: Replace early ‘continue’ with ‘if’ statement (CID 1414738)
Joseph Sutton [Fri, 6 Oct 2023 01:33:16 +0000 (14:33 +1300)] 
s4:dsdb: Replace early ‘continue’ with ‘if’ statement (CID 1414738)

A ‘continue’ statement creates the misleading impression that this loop
executes more than once.

This also avoids ‘mem_ctx’ being leaked.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb: Check return value of ldb_msg_add_empty() (CID 1272827)
Joseph Sutton [Fri, 6 Oct 2023 01:07:41 +0000 (14:07 +1300)] 
s4:dsdb: Check return value of ldb_msg_add_empty() (CID 1272827)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb: Fix unreachable code (CID 1435967)
Joseph Sutton [Thu, 5 Oct 2023 23:45:55 +0000 (12:45 +1300)] 
s4:dsdb: Fix unreachable code (CID 1435967)

Commit ede668e8e24c86f0836dfa5740e76d8aca1e0824 removed this condition
for some unexplained reason, causing the following code to become
unreachable.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb: Remove unreachable code (CID 1034686)
Joseph Sutton [Thu, 5 Oct 2023 22:05:49 +0000 (11:05 +1300)] 
s4:dsdb: Remove unreachable code (CID 1034686)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb: Check return code (CID 1444824/1444844)
Joseph Sutton [Thu, 5 Oct 2023 21:37:32 +0000 (10:37 +1300)] 
s4:dsdb: Check return code (CID 1444824/1444844)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb: Permit forward link to be missing in linked_attributes_fix_forward_link()
Joseph Sutton [Sun, 8 Oct 2023 22:55:10 +0000 (11:55 +1300)] 
s4:dsdb: Permit forward link to be missing in linked_attributes_fix_forward_link()

We don’t care if a forward link is missing from an object being renamed
during the deletion process.

Nothing yet checks the value returned from this function, so there
should be no change in behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dsdb: Check whether ‘p’ is NULL before dereferencing it (CID 240875)
Joseph Sutton [Thu, 5 Oct 2023 21:27:45 +0000 (10:27 +1300)] 
s4:dsdb: Check whether ‘p’ is NULL before dereferencing it (CID 240875)

Commit 6baf7608dfc3517cb3798fc53db849f49c6d157a added a NULL check in
one place, but not everywhere ‘p’ was dereferenced.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dns_server: Check return value of ldb_transaction_commit() (CID 1034631)
Joseph Sutton [Thu, 5 Oct 2023 22:16:37 +0000 (11:16 +1300)] 
s4:dns_server: Check return value of ldb_transaction_commit() (CID 1034631)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:dns_server: Merge similar code paths
Joseph Sutton [Thu, 5 Oct 2023 22:15:38 +0000 (11:15 +1300)] 
s4:dns_server: Merge similar code paths

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:auth: Remove event context on failure
Joseph Sutton [Thu, 5 Oct 2023 22:04:06 +0000 (11:04 +1300)] 
s4:auth: Remove event context on failure

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:auth: Fix resource leak (CID 1107222)
Joseph Sutton [Thu, 5 Oct 2023 22:03:52 +0000 (11:03 +1300)] 
s4:auth: Fix resource leak (CID 1107222)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:utils: Check return value of cli_RNetServiceEnum() (CID 1273313)
Joseph Sutton [Fri, 6 Oct 2023 02:31:47 +0000 (15:31 +1300)] 
s3:utils: Check return value of cli_RNetServiceEnum() (CID 1273313)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:utils: Avoid integer overflow (CID 1035488)
Joseph Sutton [Fri, 6 Oct 2023 02:23:05 +0000 (15:23 +1300)] 
s3:utils: Avoid integer overflow (CID 1035488)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agosmb2_server: Check status codes (CID 1474441)
Joseph Sutton [Fri, 6 Oct 2023 02:46:34 +0000 (15:46 +1300)] 
smb2_server: Check status codes (CID 1474441)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agosmb2_server: Remove unreachable code (CID 1444981)
Joseph Sutton [Thu, 5 Oct 2023 23:49:32 +0000 (12:49 +1300)] 
smb2_server: Remove unreachable code (CID 1444981)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agoRevert "smbd: Fix CID 1504457 Resource leak"
Joseph Sutton [Thu, 5 Oct 2023 22:55:46 +0000 (11:55 +1300)] 
Revert "smbd: Fix CID 1504457 Resource leak"

We cannot free ‘enc’ — it may be a copy of ‘buffer’, in which parameter
both construct_reply_chain() and smb_request_done() pass arrays of
automatic storage duration!

Fixes CID 1505354.

This reverts commit a395f752f0748751d4ade533c41066903f26c2dd.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:smbd: Avoid integer overflow (CID 1035487)
Joseph Sutton [Fri, 6 Oct 2023 02:20:35 +0000 (15:20 +1300)] 
s3:smbd: Avoid integer overflow (CID 1035487)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:rpcclient: Do not pass uninitialized pointer to printf() (CID 1476170)
Joseph Sutton [Fri, 6 Oct 2023 02:07:24 +0000 (15:07 +1300)] 
s3:rpcclient: Do not pass uninitialized pointer to printf() (CID 1476170)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:nmbd: Remove redundant code (CID 1414756)
Joseph Sutton [Fri, 6 Oct 2023 02:38:29 +0000 (15:38 +1300)] 
s3:nmbd: Remove redundant code (CID 1414756)

‘buf’ is reassigned a few lines down.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:modules: Initialize mask_permset (CID 1435850)
Joseph Sutton [Fri, 6 Oct 2023 01:58:34 +0000 (14:58 +1300)] 
s3:modules: Initialize mask_permset (CID 1435850)

If this code had ever run, sys_acl_clear_perms() would have attempted to
write to some random address in memory. ‘mask_permset’ must be a valid
non‐NULL pointer.

Commit 9b79d5f2a2f8af75ef13bdc41d2dc296e19ba098 seems to have been a
previous attempt to fix this issue.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:modules: Remove unreachable code (CID 1508998)
Joseph Sutton [Thu, 5 Oct 2023 23:54:48 +0000 (12:54 +1300)] 
s3:modules: Remove unreachable code (CID 1508998)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:libsmb: Fix array traversal (CID 1034683)
Joseph Sutton [Thu, 5 Oct 2023 23:20:37 +0000 (12:20 +1300)] 
s3:libsmb: Fix array traversal (CID 1034683)

Commit 033185e2a1b2892fe8dc74a18a38e5e13e08cb22 changed the sentinel
value to an empty character array, but failed to update the traversal
code to match.

Commit 48a453996ac161d7c7a7cb15a047e57cbdbb1e87 then tried to fix the
situation, but did not do so correctly.

Fix this code by forgetting about sentinel values altogether.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:libnet: Remove always‐false comparison (CID 241309)
Joseph Sutton [Fri, 6 Oct 2023 02:25:13 +0000 (15:25 +1300)] 
s3:libnet: Remove always‐false comparison (CID 241309)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agoRevert "s3:libads: Don’t do first loop iteration if ‘attr’ is NULL"
Joseph Sutton [Thu, 5 Oct 2023 22:18:10 +0000 (11:18 +1300)] 
Revert "s3:libads: Don’t do first loop iteration if ‘attr’ is NULL"

Fixes CID 1547073: Control flow issues (DEADCODE).

This reverts commit 184a48d65772f359bd81f83256daada8c9e500b3.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:lib: Rearrange preprocessor directives to avoid structurally dead code (CID 242032)
Joseph Sutton [Fri, 6 Oct 2023 00:59:59 +0000 (13:59 +1300)] 
s3:lib: Rearrange preprocessor directives to avoid structurally dead code (CID 242032)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos3:client: Correctly call setgroups() (CID 1449449)
Joseph Sutton [Fri, 6 Oct 2023 00:25:16 +0000 (13:25 +1300)] 
s3:client: Correctly call setgroups() (CID 1449449)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agosmbXcli: Remove unreachable code (CID 1444978)
Joseph Sutton [Thu, 5 Oct 2023 23:48:40 +0000 (12:48 +1300)] 
smbXcli: Remove unreachable code (CID 1444978)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agolib:util: Remove always‐false comparison (CID 242193)
Joseph Sutton [Fri, 6 Oct 2023 02:27:18 +0000 (15:27 +1300)] 
lib:util: Remove always‐false comparison (CID 242193)

‘id’ is an unsigned variable, and so it can never be less than zero.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agoutil: Remove redundant assertion (CID 1497841)
Joseph Sutton [Fri, 6 Oct 2023 00:12:05 +0000 (13:12 +1300)] 
util: Remove redundant assertion (CID 1497841)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agotdb: Do not pass non–null‐terminated strings to strcmp() (CID 1449485)
Joseph Sutton [Fri, 6 Oct 2023 00:54:02 +0000 (13:54 +1300)] 
tdb: Do not pass non–null‐terminated strings to strcmp() (CID 1449485)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agolib:replace: Properly check result of write() and read() (CID 1034925)
Joseph Sutton [Fri, 6 Oct 2023 00:49:43 +0000 (13:49 +1300)] 
lib:replace: Properly check result of write() and read() (CID 1034925)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agolib:printer_driver: Check return value of gp_inifile_enum_section() (CID 1444835)
Joseph Sutton [Fri, 6 Oct 2023 02:40:23 +0000 (15:40 +1300)] 
lib:printer_driver: Check return value of gp_inifile_enum_section() (CID 1444835)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agolib:compression: Correctly fix sign extension of long matches (CID 1517275)
Joseph Sutton [Fri, 6 Oct 2023 02:18:41 +0000 (15:18 +1300)] 
lib:compression: Correctly fix sign extension of long matches (CID 1517275)

Commit 6b4d94c9877ec59081b9da946c00fa2647cad928 was a previous attempt
to fix this issue.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Always regard device info when checking a server authentication policy
Joseph Sutton [Mon, 9 Oct 2023 05:20:53 +0000 (18:20 +1300)] 
s4:kdc: Always regard device info when checking a server authentication policy

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 Oct 13 00:11:08 UTC 2023 on atb-devel-224

22 months agos4:dsdb: Skip allocation of empty device SIDs array
Joseph Sutton [Tue, 10 Oct 2023 03:19:53 +0000 (16:19 +1300)] 
s4:dsdb: Skip allocation of empty device SIDs array

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Use claims to evaluate RBCD conditions
Joseph Sutton [Tue, 10 Oct 2023 02:41:40 +0000 (15:41 +1300)] 
s4:kdc: Use claims to evaluate RBCD conditions

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Use device info to evaluate RBCD conditions
Joseph Sutton [Tue, 10 Oct 2023 02:40:13 +0000 (15:40 +1300)] 
s4:kdc: Use device info to evaluate RBCD conditions

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Pass claims and device info into samba_kdc_check_s4u2proxy_rbcd()
Joseph Sutton [Tue, 10 Oct 2023 02:38:29 +0000 (15:38 +1300)] 
s4:kdc: Pass claims and device info into samba_kdc_check_s4u2proxy_rbcd()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Rename ‘user_info_dc’ to ‘client_info’
Joseph Sutton [Tue, 10 Oct 2023 02:22:28 +0000 (15:22 +1300)] 
s4:kdc: Rename ‘user_info_dc’ to ‘client_info’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Call samba_kdc_get_user_info_dc() to get client information
Joseph Sutton [Tue, 10 Oct 2023 02:19:47 +0000 (15:19 +1300)] 
s4:kdc: Call samba_kdc_get_user_info_dc() to get client information

Among other things, this function can deal with RODC‐issued PACs.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Add comment regarding RODC‐issued evidence tickets for constrained delegation
Joseph Sutton [Tue, 10 Oct 2023 02:16:24 +0000 (15:16 +1300)] 
s4:kdc: Add comment regarding RODC‐issued evidence tickets for constrained delegation

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Factor creation of user_info_dc out of samba_kdc_check_s4u2proxy_rbcd() into...
Joseph Sutton [Tue, 10 Oct 2023 02:12:30 +0000 (15:12 +1300)] 
s4:kdc: Factor creation of user_info_dc out of samba_kdc_check_s4u2proxy_rbcd() into its callers

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Adapt interface to new Heimdal revision
Joseph Sutton [Tue, 10 Oct 2023 02:03:22 +0000 (15:03 +1300)] 
s4:kdc: Adapt interface to new Heimdal revision

NOTE: This commit finally works again!

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agothird_party/heimdal: import lorikeet-heimdal-202310092248 (commit cd12cddd8058d9fe627...
Andrew Bartlett [Thu, 12 Oct 2023 22:14:55 +0000 (11:14 +1300)] 
third_party/heimdal: import lorikeet-heimdal-202310092248 (commit cd12cddd8058d9fe627b5b203e471b8d761dcfbb)

NOTE: THIS COMMIT WON’T COMPILE/WORK ON ITS OWN!

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
22 months agothird_party/heimdal: Fix PKINIT freshness token memory handling (Import lorikeet...
Joseph Sutton [Mon, 9 Oct 2023 22:59:34 +0000 (11:59 +1300)] 
third_party/heimdal: Fix PKINIT freshness token memory handling (Import lorikeet-heimdal-202310092148 (commit 38aa80e35b6b1e16b081fa9c005c03b1e6994204))

The issue here is that only the size of the pointer, not the size
of the struture was allocated with calloc().

This means that the malloc() for the freshness token bytes would
have the memory address written beyond the end of the allocated memory.

Additionally, the allocation was not free()ed, resulting in a memory
leak.  This means that a user could trigger ongoing memory allocation
in the server.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Use claims and device info to evaluate server authentication policy
Joseph Sutton [Mon, 9 Oct 2023 06:35:10 +0000 (19:35 +1300)] 
s4:kdc: Use claims and device info to evaluate server authentication policy

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Make samba_kdc_get_user_info_dc() non‐static
Joseph Sutton [Mon, 9 Oct 2023 06:37:08 +0000 (19:37 +1300)] 
s4:kdc: Make samba_kdc_get_user_info_dc() non‐static

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Use ‘claims_data’ functions to create client claims blob
Joseph Sutton [Mon, 9 Oct 2023 06:32:24 +0000 (19:32 +1300)] 
s4:kdc: Use ‘claims_data’ functions to create client claims blob

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Use device claims to evaluate client authentication policy
Joseph Sutton [Mon, 9 Oct 2023 06:27:59 +0000 (19:27 +1300)] 
s4:kdc: Use device claims to evaluate client authentication policy

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Use claims and device info to evaluate server authentication policy
Joseph Sutton [Mon, 9 Oct 2023 06:00:09 +0000 (19:00 +1300)] 
s4:kdc: Use claims and device info to evaluate server authentication policy

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Have samba_kdc_allowed_to_authenticate_to() take claims and device info
Joseph Sutton [Mon, 9 Oct 2023 05:19:36 +0000 (18:19 +1300)] 
s4:kdc: Have samba_kdc_allowed_to_authenticate_to() take claims and device info

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Fetch device claims for server restrictions
Joseph Sutton [Mon, 9 Oct 2023 02:50:19 +0000 (15:50 +1300)] 
s4:kdc: Fetch device claims for server restrictions

View with ‘git show -b’.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Do not perform compound authentication for services without Compound Identity...
Joseph Sutton [Mon, 9 Oct 2023 01:19:13 +0000 (14:19 +1300)] 
s4:kdc: Do not perform compound authentication for services without Compound Identity support

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agotests/krb5: Correctly test services that do not support Compound Identity
Joseph Sutton [Mon, 9 Oct 2023 01:08:43 +0000 (14:08 +1300)] 
tests/krb5: Correctly test services that do not support Compound Identity

These two tests now pass against Windows.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Make samba_kdc_add_compounded_auth() static
Joseph Sutton [Mon, 9 Oct 2023 02:24:57 +0000 (15:24 +1300)] 
s4:kdc: Make samba_kdc_add_compounded_auth() static

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Remove ‘compounded_auth’ parameter from samba_kdc_add_compounded_auth()
Joseph Sutton [Mon, 9 Oct 2023 02:24:06 +0000 (15:24 +1300)] 
s4:kdc: Remove ‘compounded_auth’ parameter from samba_kdc_add_compounded_auth()

It’s only ever equal to SAMBA_COMPOUNDED_AUTH_INCLUDE.

View with ‘git show -b’.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Change the type of ‘compounded_auth’ to boolean
Andrew Bartlett [Wed, 11 Oct 2023 04:25:48 +0000 (17:25 +1300)] 
s4:kdc: Change the type of ‘compounded_auth’ to boolean

View with ‘git show -b’.

This allows us to make the call to authsam_shallow_copy_user_info_dc()
and samba_kdc_add_compounded_auth() only if required.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Remove ‘claims_valid’ parameter from samba_kdc_add_claims_valid()
Joseph Sutton [Mon, 9 Oct 2023 02:19:01 +0000 (15:19 +1300)] 
s4:kdc: Remove ‘claims_valid’ parameter from samba_kdc_add_claims_valid()

It’s only ever equal to SAMBA_CLAIMS_VALID_INCLUDE.

View with ‘git show -b’.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Introduce helper variable ‘server_restrictions_present’
Joseph Sutton [Mon, 9 Oct 2023 00:41:59 +0000 (13:41 +1300)] 
s4:kdc: Introduce helper variable ‘server_restrictions_present’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Simplify creation of device claims blob
Joseph Sutton [Thu, 5 Oct 2023 03:39:47 +0000 (16:39 +1300)] 
s4:kdc: Simplify creation of device claims blob

Let samba_kdc_get_claims_data() and claims_data_encoded_claims_set()
handle the work for us.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agos4:kdc: Note use of parent memory context
Joseph Sutton [Thu, 5 Oct 2023 03:35:52 +0000 (16:35 +1300)] 
s4:kdc: Note use of parent memory context

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