]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
25 hours agoctdb-scripts: Do not de-duplicate the interfaces list master
Martin Schwenke [Thu, 18 Apr 2024 04:13:11 +0000 (14:13 +1000)] 
ctdb-scripts: Do not de-duplicate the interfaces list

Using xargs with sort -u to de-duplicate this list was my idea and
causes a couple of things to go wrong.  The use of xargs causes
double-quotes to be lost.  The resulting $public_ifaces value also
contains newlines.  The newlines could be removed with an additional
xargs at the end of the pipeline... but that would add an extra level
of quote stripping.

I have unsuccessfully tried to find an alternative, but still elegant,
command pipeline that de-duplicates the list, while maintaining
quoting.

So, just drop the de-duplication.

This might make interface_ifindex_exists_with_options() slightly less
efficient.  However, that function walks the whole list, only
terminating early when a match is found on both interface and options,
so at least it will be correct.

Include an extra testcase.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Apr 18 09:08:34 UTC 2024 on atb-devel-224

38 hours agopython: Fix NtVer check for site_dn_for_machine() gitlab/master
Andreas Schneider [Mon, 15 Apr 2024 05:32:02 +0000 (07:32 +0200)] 
python: Fix NtVer check for site_dn_for_machine()

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

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

2 days agolib: Remove an obsolete comment
Volker Lendecke [Tue, 12 Mar 2024 14:06:33 +0000 (15:06 +0100)] 
lib: Remove an obsolete comment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Apr 17 09:01:34 UTC 2024 on atb-devel-224

2 days agosmbd: Remove sconn->using_smb2
Volker Lendecke [Tue, 13 Feb 2024 12:05:42 +0000 (13:05 +0100)] 
smbd: Remove sconn->using_smb2

We have the same information available via conn_using_smb2()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2 days agosmbd: Add conn_using_smb2()
Volker Lendecke [Tue, 13 Feb 2024 11:28:06 +0000 (12:28 +0100)] 
smbd: Add conn_using_smb2()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2 days agosmbd: Change protocol selection to not use "sconn->using_smb2"
Volker Lendecke [Tue, 13 Feb 2024 11:56:17 +0000 (12:56 +0100)] 
smbd: Change protocol selection to not use "sconn->using_smb2"

To me this is pretty confusing, it seems to overload this struct
element.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2 days agoctdb: Modernize a few DEBUGs
Volker Lendecke [Thu, 29 Feb 2024 15:11:16 +0000 (16:11 +0100)] 
ctdb: Modernize a few DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Apr 17 00:54:55 UTC 2024 on atb-devel-224

2 days agoctdb: Remove common/line.[ch]
Volker Lendecke [Fri, 1 Mar 2024 20:19:51 +0000 (21:19 +0100)] 
ctdb: Remove common/line.[ch]

This was an implementation of getline(3), use that instead.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2 days agoctdb: Use stdio's getline() in ctdb_connection_list_read()
Volker Lendecke [Fri, 1 Mar 2024 20:16:57 +0000 (21:16 +0100)] 
ctdb: Use stdio's getline() in ctdb_connection_list_read()

This is the only user of common/line.[ch], which can go next.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2 days agolib: Use fdopen_keepfd()
Volker Lendecke [Wed, 10 Apr 2024 11:11:11 +0000 (13:11 +0200)] 
lib: Use fdopen_keepfd()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2 days agorpc_server3: Use fdopen_keepfd()
Volker Lendecke [Wed, 10 Apr 2024 11:08:06 +0000 (13:08 +0200)] 
rpc_server3: Use fdopen_keepfd()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2 days agolib: Add fdopen_keepfd()
Volker Lendecke [Wed, 10 Apr 2024 11:07:56 +0000 (13:07 +0200)] 
lib: Add fdopen_keepfd()

Capture the dup/fdopen pattern

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2 days agolib: Give lib/util/util_file.c its own header file
Volker Lendecke [Wed, 10 Apr 2024 11:02:39 +0000 (13:02 +0200)] 
lib: Give lib/util/util_file.c its own header file

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2 days agoctdb-scripts: Add options to generate smb.conf interfaces include file
Vinit Agnihotri [Tue, 30 Jan 2024 09:50:20 +0000 (01:50 -0800)] 
ctdb-scripts: Add options to generate smb.conf interfaces include file

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agoctdb-scripts: Rename and relocate function get_all_interfaces()
Vinit Agnihotri [Tue, 30 Jan 2024 09:25:37 +0000 (01:25 -0800)] 
ctdb-scripts: Rename and relocate function get_all_interfaces()

get_all_interfaces() functions gets all names for all public interfaces.
However name is misleading. Thus renamed it to get_public_ifaces() and
moved it under functions.

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agosmbd-server: Process ip add/drop events for options:dynamic only
Vinit Agnihotri [Tue, 5 Mar 2024 11:03:25 +0000 (03:03 -0800)] 
smbd-server: Process ip add/drop events for options:dynamic only

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib-interface: Change API for interface 'options'
Vinit Agnihotri [Tue, 5 Mar 2024 10:32:23 +0000 (02:32 -0800)] 
lib-interface: Change API for interface 'options'

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib-interface: Add parsing for interface 'options'
Vinit Agnihotri [Tue, 5 Mar 2024 10:15:11 +0000 (02:15 -0800)] 
lib-interface: Add parsing for interface 'options'

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib-interface: Add extra parameter 'options' to interface definition
Vinit Agnihotri [Tue, 5 Mar 2024 10:27:04 +0000 (02:27 -0800)] 
lib-interface: Add extra parameter 'options' to interface definition

Signed-off-by: Vinit Agnihotri<vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agoparam: Add additional key 'options' for interfaces
Vinit Agnihotri [Tue, 5 Mar 2024 11:16:49 +0000 (03:16 -0800)] 
param: Add additional key 'options' for interfaces

The key 'options' specifies if server should spawn/kill listning sockets
in event of add/dropped ip addresses on specified interface.

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agosmbd-server: Use MSG_SMB_IP_DROPPED
Vinit Agnihotri [Thu, 29 Feb 2024 08:52:08 +0000 (00:52 -0800)] 
smbd-server: Use MSG_SMB_IP_DROPPED

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agomessaging: Add new SMBD message
Vinit Agnihotri [Thu, 29 Feb 2024 06:22:38 +0000 (22:22 -0800)] 
messaging: Add new SMBD message

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agosmbd-server: Handle ip drop event and close listening socket
Vinit Agnihotri [Wed, 28 Feb 2024 11:56:23 +0000 (03:56 -0800)] 
smbd-server: Handle ip drop event and close listening socket

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agosmbd-server: Open socket for additional ip address
Vinit Agnihotri [Wed, 21 Feb 2024 05:49:34 +0000 (21:49 -0800)] 
smbd-server: Open socket for additional ip address

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib-interface: Add new API to validate interface info for given interface index
Vinit Agnihotri [Tue, 20 Feb 2024 10:40:13 +0000 (02:40 -0800)] 
lib-interface: Add new API to validate interface info for given interface index

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agolib-addrchange: Change API to fill up if_index value from netlink msg
Vinit Agnihotri [Thu, 15 Feb 2024 13:23:37 +0000 (05:23 -0800)] 
lib-addrchange: Change API to fill up if_index value from netlink msg

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agosmbd-server: Set event callback for interface change notification
Vinit Agnihotri [Tue, 13 Feb 2024 11:30:50 +0000 (03:30 -0800)] 
smbd-server: Set event callback for interface change notification

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agodocs: Document new tdbdump -x option
Christof Schmitt [Thu, 7 Mar 2024 23:41:11 +0000 (16:41 -0700)] 
docs: Document new tdbdump -x option

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Tue Apr 16 18:37:17 UTC 2024 on atb-devel-224

2 days agotdb: Add test for tdbdump -x
Christof Schmitt [Fri, 12 Apr 2024 22:48:02 +0000 (15:48 -0700)] 
tdb: Add test for tdbdump -x

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agotdb: Add tdbdump option to output all data as hex values
Christof Schmitt [Thu, 7 Mar 2024 23:38:53 +0000 (16:38 -0700)] 
tdb: Add tdbdump option to output all data as hex values

This can be useful for debugging tdb databases, the hex output of the
key can be used for "net tdb" or ctdb commands.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agotdb: Add test for tdbdump command
Christof Schmitt [Fri, 12 Apr 2024 22:44:38 +0000 (15:44 -0700)] 
tdb: Add test for tdbdump command

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 days agotdb: Return failure as exit status from test_tdbbackup.sh
Christof Schmitt [Fri, 12 Apr 2024 22:22:06 +0000 (15:22 -0700)] 
tdb: Return failure as exit status from test_tdbbackup.sh

When this test is called from wscript, only the exit code is checked.
Track failures and return as non-zero exit code.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos3: winbindd: winbindd_pam: fix leak in extract_pac_vrfy_sigs
Shaleen Bathla [Wed, 10 Apr 2024 13:01:39 +0000 (18:31 +0530)] 
s3: winbindd: winbindd_pam: fix leak in extract_pac_vrfy_sigs

Add missing free for entry variable and its members : key and principal
Found definite memory leaks via valgrind as shown below.

Leak 1 :
==1686== 76,800 bytes in 2,400 blocks are definitely lost in loss record 432 of 433
==1686==    at 0x4C38185: malloc (vg_replace_malloc.c:431)
==1686==    by 0x79CBFED: krb5int_c_copy_keyblock_contents (keyblocks.c:101)
==1686==    by 0x621CFA3: krb5_mkt_get_next (kt_memory.c:500)
==1686==    by 0x141186: extract_pac_vrfy_sigs (winbindd_pam.c:3384)
==1686==    by 0x141186: winbindd_pam_auth_pac_verify (winbindd_pam.c:3434)
==1686==    by 0x17ED21: winbindd_pam_auth_crap_send (winbindd_pam_auth_crap.c:68)
==1686==    by 0x127F45: process_request_send (winbindd.c:502)
==1686==    by 0x127F45: winbind_client_request_read (winbindd.c:749)
==1686==    by 0x124AAF: wb_req_read_done (wb_reqtrans.c:126)
==1686==    by 0x66D4706: tevent_common_invoke_fd_handler (tevent_fd.c:142)
==1686==    by 0x66DAF4E: epoll_event_loop (tevent_epoll.c:737)
==1686==    by 0x66DAF4E: epoll_event_loop_once (tevent_epoll.c:938)
==1686==    by 0x66D8F5A: std_event_loop_once (tevent_standard.c:110)
==1686==    by 0x66D39B4: _tevent_loop_once (tevent.c:823)
==1686==    by 0x1232F3: main (winbindd.c:1718)

Leak 2 :
==1686==    at 0x4C38185: malloc (vg_replace_malloc.c:431)
==1686==    by 0x62255E4: krb5_copy_principal (copy_princ.c:38)
==1686==    by 0x621D003: krb5_mkt_get_next (kt_memory.c:503)
==1686==    by 0x141186: extract_pac_vrfy_sigs (winbindd_pam.c:3384)
==1686==    by 0x141186: winbindd_pam_auth_pac_verify (winbindd_pam.c:3434)
==1686==    by 0x17ED21: winbindd_pam_auth_crap_send (winbindd_pam_auth_crap.c:68)
==1686==    by 0x127F45: process_request_send (winbindd.c:502)
==1686==    by 0x127F45: winbind_client_request_read (winbindd.c:749)
==1686==    by 0x124AAF: wb_req_read_done (wb_reqtrans.c:126)
==1686==    by 0x66D4706: tevent_common_invoke_fd_handler (tevent_fd.c:142)
==1686==    by 0x66DAF4E: epoll_event_loop (tevent_epoll.c:737)
==1686==    by 0x66DAF4E: epoll_event_loop_once (tevent_epoll.c:938)
==1686==    by 0x66D8F5A: std_event_loop_once (tevent_standard.c:110)
==1686==    by 0x66D39B4: _tevent_loop_once (tevent.c:823)
==1686==    by 0x1232F3: main (winbindd.c:1718)

Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Apr 16 10:22:51 UTC 2024 on atb-devel-224

3 days agos4:dsdb: Implement msDS-ManagedPassword attribute
Jo Sutton [Tue, 13 Feb 2024 02:45:21 +0000 (15:45 +1300)] 
s4:dsdb: Implement msDS-ManagedPassword attribute

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Apr 16 05:02:30 UTC 2024 on atb-devel-224

3 days agos4:dsdb: Add extra attrs to search request even if replacement attribute is NULL
Jo Sutton [Tue, 9 Apr 2024 04:15:48 +0000 (16:15 +1200)] 
s4:dsdb: Add extra attrs to search request even if replacement attribute is NULL

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agopython:tests: Catch failures to authenticate with gMSA managed passwords
Jo Sutton [Tue, 9 Apr 2024 02:09:17 +0000 (14:09 +1200)] 
python:tests: Catch failures to authenticate with gMSA managed passwords

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agoselftest: Expand out knownfails for gMSA getpassword tests
Jo Sutton [Tue, 9 Apr 2024 01:55:58 +0000 (13:55 +1200)] 
selftest: Expand out knownfails for gMSA getpassword tests

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos4:dsdb: Set up passwords and password IDs of new gMSAs
Jo Sutton [Fri, 5 Apr 2024 00:23:18 +0000 (13:23 +1300)] 
s4:dsdb: Set up passwords and password IDs of new gMSAs

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos4:dsdb: Add functions for Group Managed Service Accounts implementation
Jo Sutton [Tue, 13 Feb 2024 03:09:57 +0000 (16:09 +1300)] 
s4:dsdb: Add functions for Group Managed Service Accounts implementation

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos4:dsdb: Factor out a function to remove all password related attributes
Jo Sutton [Tue, 9 Apr 2024 00:15:00 +0000 (12:15 +1200)] 
s4:dsdb: Factor out a function to remove all password related attributes

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agolib:crypto: Reformat source code
Jo Sutton [Mon, 1 Apr 2024 21:33:27 +0000 (10:33 +1300)] 
lib:crypto: Reformat source code

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agotests/krb5: Add tests for gMSAs
Jo Sutton [Fri, 5 Apr 2024 00:44:08 +0000 (13:44 +1300)] 
tests/krb5: Add tests for gMSAs

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agopython:nt_time: Add NT_TIME_MAX constant
Jo Sutton [Fri, 5 Apr 2024 00:43:46 +0000 (13:43 +1300)] 
python:nt_time: Add NT_TIME_MAX constant

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agopython:gkdi: Reformat code with ‘ruff’
Jo Sutton [Fri, 5 Apr 2024 00:43:30 +0000 (13:43 +1300)] 
python:gkdi: Reformat code with ‘ruff’

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agopython:gkdi: Add Gkdi.from_key_envelope() method
Jo Sutton [Fri, 5 Apr 2024 00:43:15 +0000 (13:43 +1300)] 
python:gkdi: Add Gkdi.from_key_envelope() method

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agopython:gkdi: Add notes on GKDI time periods
Jo Sutton [Fri, 5 Apr 2024 00:42:31 +0000 (13:42 +1300)] 
python:gkdi: Add notes on GKDI time periods

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agotests/gkdi: Change ‘current_gkid’ parameter to ‘current_time’
Jo Sutton [Mon, 1 Apr 2024 22:15:08 +0000 (11:15 +1300)] 
tests/gkdi: Change ‘current_gkid’ parameter to ‘current_time’

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agotests/gkdi: Remove implicit clock skew offset
Jo Sutton [Mon, 1 Apr 2024 22:13:37 +0000 (11:13 +1300)] 
tests/gkdi: Remove implicit clock skew offset

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agotests/gkdi: Allow current time to be overridden
Jo Sutton [Tue, 26 Mar 2024 03:25:31 +0000 (16:25 +1300)] 
tests/gkdi: Allow current time to be overridden

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agotests/krb5: Make use of ‘expect_edata’ parameter
Jo Sutton [Tue, 19 Mar 2024 01:27:00 +0000 (14:27 +1300)] 
tests/krb5: Make use of ‘expect_edata’ parameter

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agotests/krb5: Remove unused variable
Jo Sutton [Thu, 21 Mar 2024 23:32:46 +0000 (12:32 +1300)] 
tests/krb5: Remove unused variable

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agotests/krb5: Fix code spelling
Jo Sutton [Thu, 21 Mar 2024 23:32:25 +0000 (12:32 +1300)] 
tests/krb5: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agotests/krb5: Remove unused import
Jo Sutton [Thu, 21 Mar 2024 23:31:38 +0000 (12:31 +1300)] 
tests/krb5: Remove unused import

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agopython:tests: Fix typo
Jo Sutton [Tue, 9 Apr 2024 02:15:51 +0000 (14:15 +1200)] 
python:tests: Fix typo

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agopython:tests: Reformat code
Jo Sutton [Mon, 4 Mar 2024 00:38:10 +0000 (13:38 +1300)] 
python:tests: Reformat code

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agopython:tests: Fix set declaration
Jo Sutton [Tue, 9 Apr 2024 03:39:43 +0000 (15:39 +1200)] 
python:tests: Fix set declaration

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agopython:tests: Replace deprecated method assertRaisesRegexp()
Jo Sutton [Tue, 9 Apr 2024 03:31:15 +0000 (15:31 +1200)] 
python:tests: Replace deprecated method assertRaisesRegexp()

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos4:ldap_server: Consider ldapi connections to be encrypted
Jo Sutton [Tue, 16 Apr 2024 02:28:43 +0000 (14:28 +1200)] 
s4:ldap_server: Consider ldapi connections to be encrypted

Modifications to unicodePwd require an encrypted connection. This change
allows unicodePwd to be modified over an ldapi connection.

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

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos4:ldap_server: Store whether an LDAP connection is over ldapi
Jo Sutton [Tue, 16 Apr 2024 02:28:21 +0000 (14:28 +1200)] 
s4:ldap_server: Store whether an LDAP connection is over ldapi

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

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos4:ldap_server: Add copy of non‐privileged ops specifically for ldapi connections
Jo Sutton [Tue, 16 Apr 2024 02:27:41 +0000 (14:27 +1200)] 
s4:ldap_server: Add copy of non‐privileged ops specifically for ldapi connections

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

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos4:ldap_server: Rename privileged ops to indicate they are used for ldapi
Jo Sutton [Tue, 16 Apr 2024 02:31:11 +0000 (14:31 +1200)] 
s4:ldap_server: Rename privileged ops to indicate they are used for ldapi

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

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos4:ldap_server: Fix code spelling
Jo Sutton [Tue, 16 Apr 2024 02:17:33 +0000 (14:17 +1200)] 
s4:ldap_server: Fix code spelling

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

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos4:ldap_server: Remove trailing whitespace
Jo Sutton [Tue, 16 Apr 2024 02:17:02 +0000 (14:17 +1200)] 
s4:ldap_server: Remove trailing whitespace

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

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agoselftest: Move some KDS root key tests around to prepare for gMSA server side
Andrew Bartlett [Thu, 11 Apr 2024 04:26:49 +0000 (16:26 +1200)] 
selftest: Move some KDS root key tests around to prepare for gMSA server side

Once we have a gMSA server side the impact of deleting root keys becomes real
and so we must do this in a quiet place where it can not impact on other things.

Likewise, we want the samba.tests.dsdb_quiet_provision_tests tests to run
somewhere that is not doing other things, so we can see what a bare provision
will do.  We must not allow test ordering inside the file to cause tests that
create root keys to run before checking if provision created a usable root key.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
3 days agoselftest: Remove duplicate setup of "spn/upn namespaces" in the customdc testenv
Andrew Bartlett [Thu, 11 Apr 2024 02:33:16 +0000 (14:33 +1200)] 
selftest: Remove duplicate setup of "spn/upn namespaces" in the customdc testenv

The call to $self->setup_namespaces() was allways in error, as the design
is to have the in the state that it was backed up in, but before commit
08be28241b808845c4b51a4c47765a9416ca3aa7 the error return was not
checked and so this was harmless.

The customdc environment is not tested in selftest currently, as
it is intended to be used for manual testing of domains from backup
files not as an automatically constructed environment.

This makes:
 BACKUP_FILE=samba-backup-2024-04-11T14-10-20.437096.tar.bz2 SELFTEST_TESTENV=customdc make testenv
work again.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
3 days agos3:auth: Add support standalone server with MIT Keberos 1.21
Andreas Schneider [Thu, 11 Apr 2024 08:29:18 +0000 (10:29 +0200)] 
s3:auth: Add support standalone server with MIT Keberos 1.21

This adds support for MIT Kerberos minimal PAC. Tickets from pure
Kerberos realms with MIT Kerberos 1.21 or newer will always include a
minimal PAC. The PAC include the checksum buffers and a logon_name PAC
buffer.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos3:auth: Split auth3_generate_session_info_pac() into functions
Andreas Schneider [Thu, 11 Apr 2024 08:21:16 +0000 (10:21 +0200)] 
s3:auth: Split auth3_generate_session_info_pac() into functions

This gets rid of the multiple goto and just have a single destructor
goto.
Best view this commit with `git show -b <sha> --color-moved=zebra`

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos3:auth: Re-format auth3_generate_session_info_pac()
Andreas Schneider [Fri, 12 Apr 2024 12:36:32 +0000 (14:36 +0200)] 
s3:auth: Re-format auth3_generate_session_info_pac()

This is in preparation to split up the function into several functions.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agos3:auth: Remove trailing spaces
Andreas Schneider [Fri, 15 Mar 2024 11:41:19 +0000 (12:41 +0100)] 
s3:auth: Remove trailing spaces

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 days agosmbdotconf: Enable "winbind debug traceid" by default
Pavel Filipenský [Thu, 11 Apr 2024 11:01:28 +0000 (13:01 +0200)] 
smbdotconf: Enable "winbind debug traceid" by default

The traceid debug header field is a useful feature, let's make it
default.

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Mon Apr 15 18:47:41 UTC 2024 on atb-devel-224

3 days agos3:libsmb: Fix panic in cliconnect.c
Pavel Filipenský [Fri, 12 Apr 2024 12:57:11 +0000 (14:57 +0200)] 
s3:libsmb: Fix panic in cliconnect.c

This command line panics:

$ bin/rpcclient ncacn_np: -c epmlookup

0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
1  0x00007ffff64ae8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
2  0x00007ffff645c8ee in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
3  0x00007ffff64448ff in __GI_abort () at abort.c:79
4  0x00007ffff7b01524 in tevent_req_is_nterror (req=0x555555728610, status=0x7fffffff9bb4) at ../../lib/util/tevent_ntstatus.c:66
5  0x00007ffff7b9fd91 in cli_connect_nb_recv (req=0x555555728610, pcli=0x5555556fcb18) at ../../source3/libsmb/cliconnect.c:2731
6  0x00007ffff7ba02a8 in cli_start_connection_connected (subreq=0x555555728610) at ../../source3/libsmb/cliconnect.c:2882
7  0x00007ffff7aecb1a in _tevent_req_notify_callback (req=0x555555728610, location=0x7ffff7bde0e0 "../../source3/libsmb/cliconnect.c:2686") at ../../lib/tevent/tevent_req.c:177
8  0x00007ffff7aeccab in tevent_req_finish (req=0x555555728610, state=TEVENT_REQ_USER_ERROR, location=0x7ffff7bde0e0 "../../source3/libsmb/cliconnect.c:2686") at ../../lib/tevent/tevent_req.c:234
9  0x00007ffff7aecdda in tevent_req_trigger (ev=0x5555557182e0, im=0x555555728720, private_data=0x555555728610) at ../../lib/tevent/tevent_req.c:291
10 0x00007ffff7aeb513 in tevent_common_invoke_immediate_handler (im=0x555555728720, removed=0x0) at ../../lib/tevent/tevent_immediate.c:190
11 0x00007ffff7aeb685 in tevent_common_loop_immediate (ev=0x5555557182e0) at ../../lib/tevent/tevent_immediate.c:236
12 0x00007ffff7af7502 in epoll_event_loop_once (ev=0x5555557182e0, location=0x7ffff7af8ac0 "../../lib/tevent/tevent_req.c:342") at ../../lib/tevent/tevent_epoll.c:905
13 0x00007ffff7af2d22 in std_event_loop_once (ev=0x5555557182e0, location=0x7ffff7af8ac0 "../../lib/tevent/tevent_req.c:342") at ../../lib/tevent/tevent_standard.c:110
14 0x00007ffff7ae93ab in _tevent_loop_once (ev=0x5555557182e0, location=0x7ffff7af8ac0 "../../lib/tevent/tevent_req.c:342") at ../../lib/tevent/tevent.c:820
15 0x00007ffff7aecf9e in tevent_req_poll (req=0x555555728290, ev=0x5555557182e0) at ../../lib/tevent/tevent_req.c:342
16 0x00007ffff7b01647 in tevent_req_poll_ntstatus (req=0x555555728290, ev=0x5555557182e0, status=0x7fffffff9f4c) at ../../lib/util/tevent_ntstatus.c:109
17 0x00007ffff7ba246a in cli_full_connection_creds (output_cli=0x7fffffffa220, my_name=0x555555701990 "CLUSTEREDMEMBER", dest_host=0x0, dest_ss=0x0, port=0, service=0x5555556981d1 "IPC$", service_type=0x5555556981d6 "IPC", creds=0x5555556fa410, flags=4096) at ../../source3/libsmb/cliconnect.c:3807
18 0x0000555555619ae9 in main (argc=4, argv=0x7fffffffa3e8) at ../../source3/rpcclient/rpcclient.c:1308

tevent_req_is_nterror() expects error set by tevent_req_nterror()
- to have TEVENT_NTERROR_MAGIC, otherwise it calls abort().

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Mon Apr 15 14:55:21 UTC 2024 on atb-devel-224

6 days agos4:dns_server: less noisy, more informative debug messages
Douglas Bagnall [Wed, 10 Apr 2024 23:52:14 +0000 (11:52 +1200)] 
s4:dns_server: less noisy, more informative debug messages

This shouldn't have been DBG_ERR, and it might as well say something
about the tombstone.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Apr 12 15:18:05 UTC 2024 on atb-devel-224

8 days agos3:libsmb_xattr: ace_compare() uses NUMERIC_CMP()
Douglas Bagnall [Thu, 4 Apr 2024 01:33:47 +0000 (14:33 +1300)] 
s3:libsmb_xattr: ace_compare() uses NUMERIC_CMP()

the access_mask is the easiest to overflow with subtraction -- other
fields are 8 or 16 bit.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Apr 10 23:58:12 UTC 2024 on atb-devel-224

8 days agos3:util:sharesec ace_compare() uses NUMERIC_CMP()
Douglas Bagnall [Thu, 4 Apr 2024 01:08:02 +0000 (14:08 +1300)] 
s3:util:sharesec ace_compare() uses NUMERIC_CMP()

ace->access_mask is uint32_t, so can overflow a signed int.
This would be easy to trigger, as it is a flags field rather than an
allocation count.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos3:smbcacls: use NUMERIC_CMP in ace_compare
Douglas Bagnall [Tue, 2 Apr 2024 23:56:48 +0000 (12:56 +1300)] 
s3:smbcacls: use NUMERIC_CMP in ace_compare

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos3:util:net_registry: registry_value_cmp() uses NUMERIC_CMP()
Douglas Bagnall [Thu, 4 Apr 2024 01:25:54 +0000 (14:25 +1300)] 
s3:util:net_registry: registry_value_cmp() uses NUMERIC_CMP()

v->type is an int-sized enum, so overflow might be possible if it could
be arbitrarily set.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos4:wins: use NUMERIC_CMP in nbtd_wins_randomize1Clist_sort()
Douglas Bagnall [Tue, 2 Apr 2024 23:53:32 +0000 (12:53 +1300)] 
s4:wins: use NUMERIC_CMP in nbtd_wins_randomize1Clist_sort()

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos4:wins: winsdb_addr_sort_list() uses NUMERIC_CMP()
Douglas Bagnall [Thu, 4 Apr 2024 01:16:21 +0000 (14:16 +1300)] 
s4:wins: winsdb_addr_sort_list() uses NUMERIC_CMP()

expire_time is time_t, which is at least int-sized, so overflow is
possible (if this code ever runs).

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos4:wins: use NUMERIC_CMP in winsdb_addr_sort_list()
Douglas Bagnall [Tue, 2 Apr 2024 23:54:09 +0000 (12:54 +1300)] 
s4:wins: use NUMERIC_CMP in winsdb_addr_sort_list()

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos4:dns_server: use NUMERIC_CMP in rec_cmp()
Douglas Bagnall [Thu, 4 Apr 2024 01:22:24 +0000 (14:22 +1300)] 
s4:dns_server: use NUMERIC_CMP in rec_cmp()

dnsp_DnssrvRpcRecord.dwTimeStamp is uint32_t, making overflow possible.

dnsp_DnssrvRpcRecord.wType is an enum, which has the size of an int,
though it may be hard to set it to overflowing values.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos4:rpc_server: compare_SamEntry() uses NUMERIC_CMP()
Douglas Bagnall [Thu, 4 Apr 2024 01:10:45 +0000 (14:10 +1300)] 
s4:rpc_server: compare_SamEntry() uses NUMERIC_CMP()

SamEntry.idx is uint32_t.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos3:lib:util_tdb: use NUMERIC_CMP() in tdb_data_cmp()
Douglas Bagnall [Thu, 4 Apr 2024 01:01:24 +0000 (14:01 +1300)] 
s3:lib:util_tdb: use NUMERIC_CMP() in tdb_data_cmp()

Although these are size_t, in practice TDB data is limited to 32 bit.
Even so, overflow of a signed int is possible.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agolibcli/security: use NUMERIC_CMP in dom_sid_compare_auth()
Douglas Bagnall [Thu, 4 Apr 2024 00:53:58 +0000 (13:53 +1300)] 
libcli/security: use NUMERIC_CMP in dom_sid_compare_auth()

These numbers are all 8 bit, so overflow is unlikely.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agolibcli/security: use NUMERIC_CMP in dom_sid_compare()
Douglas Bagnall [Thu, 4 Apr 2024 00:43:47 +0000 (13:43 +1300)] 
libcli/security: use NUMERIC_CMP in dom_sid_compare()

sid->num_auths is always small (int8 < 16), so this is cosmetic only.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoldb: reduce non-transitive comparisons in ldb_msg_element_compare()
Douglas Bagnall [Wed, 3 Apr 2024 22:26:25 +0000 (11:26 +1300)] 
ldb: reduce non-transitive comparisons in ldb_msg_element_compare()

We can still have inconsistent comparisons, because two elements with
the same number of values will always return -1 if they are unequal,
which means they will sort differently depending on the order in which
they are compared.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoldb: avoid non-transitive comparison in ldb_val_cmp()
Douglas Bagnall [Wed, 3 Apr 2024 22:22:58 +0000 (11:22 +1300)] 
ldb: avoid non-transitive comparison in ldb_val_cmp()

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoutil:datablob: avoid non-transitive comparison in data_blob_cmp()
Douglas Bagnall [Wed, 3 Apr 2024 22:07:06 +0000 (11:07 +1300)] 
util:datablob: avoid non-transitive comparison in data_blob_cmp()

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoldb:attrib_handlers: ldb_comparison_binary uses NUMERIC_CMP()
Douglas Bagnall [Wed, 3 Apr 2024 04:43:03 +0000 (17:43 +1300)] 
ldb:attrib_handlers: ldb_comparison_binary uses NUMERIC_CMP()

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoldb:attrib_handlers: ldb_comparison_Boolean uses NUMERIC_CMP()
Douglas Bagnall [Wed, 3 Apr 2024 04:32:48 +0000 (17:32 +1300)] 
ldb:attrib_handlers: ldb_comparison_Boolean uses NUMERIC_CMP()

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoutil: charset:util_str: use NUMERIC_CMP in strncasecmp_m_handle
Douglas Bagnall [Wed, 3 Apr 2024 03:16:44 +0000 (16:16 +1300)] 
util: charset:util_str: use NUMERIC_CMP in strncasecmp_m_handle

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agolib/torture: add assert_int_{less,greater} macros
Douglas Bagnall [Fri, 5 Apr 2024 01:22:11 +0000 (14:22 +1300)] 
lib/torture: add assert_int_{less,greater} macros

In some situations, like comparison functions for qsort, we don't care
about the actual value, just whethger it was greater or less than
zero.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos3:libsmb:namequery: use NUMERIC_CMP in addr_compare
Douglas Bagnall [Wed, 3 Apr 2024 03:13:07 +0000 (16:13 +1300)] 
s3:libsmb:namequery: use NUMERIC_CMP in addr_compare

This one was OK, as the numbers are tightly bound, but there is no
real reason not to do it safely.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agos3:libsmb:namequery: note intransitivity in addr_compare()
Douglas Bagnall [Wed, 3 Apr 2024 03:10:38 +0000 (16:10 +1300)] 
s3:libsmb:namequery: note intransitivity in addr_compare()

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoutil:charset:codepoints: codepoint_cmpi warning about non-transitivity
Douglas Bagnall [Thu, 4 Apr 2024 01:56:16 +0000 (14:56 +1300)] 
util:charset:codepoints: codepoint_cmpi warning about non-transitivity

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoutil:charset:codepoints: condepoint_cmpi uses NUMERIC_CMP()
Douglas Bagnall [Wed, 3 Apr 2024 02:53:29 +0000 (15:53 +1300)] 
util:charset:codepoints: condepoint_cmpi uses NUMERIC_CMP()

If these are truly unicode codepoints (< ~2m) there is no overflow,
but the type is defined as uint32_t.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoutil:test: test_ms_fn_match_protocol_no_wildcard: allow -1
Douglas Bagnall [Thu, 4 Apr 2024 04:23:15 +0000 (17:23 +1300)] 
util:test: test_ms_fn_match_protocol_no_wildcard: allow -1

We have changed strcasecmp_m() to return -1 in a place where it used
to return -3. This upset a test, but it shouldn't have: the exact
value of the negative int is not guaranteed by the function.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agoutil:charset:util_str: use NUMERIC_CMP in strcasecmp_m_handle
Douglas Bagnall [Wed, 3 Apr 2024 02:49:55 +0000 (15:49 +1300)] 
util:charset:util_str: use NUMERIC_CMP in strcasecmp_m_handle

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agotorture:charset: test more of strcasecmp_m
Douglas Bagnall [Fri, 5 Apr 2024 01:46:48 +0000 (14:46 +1300)] 
torture:charset: test more of strcasecmp_m

We now test cases:

1. where the first string compares less
2. one of the strings ends before the other
3. the strings differ on a character other than the first.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agotorture:charset: use < and > assertions for strncasecmp_m
Douglas Bagnall [Fri, 5 Apr 2024 01:43:42 +0000 (14:43 +1300)] 
torture:charset: use < and > assertions for strncasecmp_m

strncasecmp_m is supposed to return a negative, zero, or positive
number, not necessarily the difference between the codepoints in
the first  character that differs, which we have been asserting up to
now.

This fixes a knownfail on 32 bit.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
8 days agotorture:charset: use < and > assertions for strcasecmp_m
Douglas Bagnall [Fri, 5 Apr 2024 00:14:38 +0000 (13:14 +1300)] 
torture:charset: use < and > assertions for strcasecmp_m

strcasecmp_m is supposed to return a negative, zero, or positive
number, depending on whether the first argument is less than, equal to,
or greater than the second argument (respectively).

We have been asserting that it returns exactly the difference between
the codepoints in the first character that differs.

This fixes a knownfail on 32 bit.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>