]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
5 weeks agos3:utils: Fix memory leaks in test_lm_ntlm_broken()
Andreas Schneider [Fri, 25 Oct 2024 13:12:26 +0000 (15:12 +0200)] 
s3:utils: Fix memory leaks in test_lm_ntlm_broken()

Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825
    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982
    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784
    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58
    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40
    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375
    #8 0x55b8512fe1a1 in test_lm_ntlm_broken ../../source3/utils/ntlm_auth_diagnostics.c:63
    #9 0x55b8512fec4e in test_lm_ntlm ../../source3/utils/ntlm_auth_diagnostics.c:477
    #10 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #11 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #12 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8513000c1 in test_lmv2_ntlmv2_broken ../../source3/utils/ntlm_auth_diagnostics.c:379\n    #9 0x55b851300926 in test_lmv2_ntlmv2 ../../source3/utils/ntlm_auth_diagnostics.c:454\n    #10 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #11 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #12 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8512ff72c in test_ntlm_in_lm ../../source3/utils/ntlm_auth_diagnostics.c:202\n    #9 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #10 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #11 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8512fee10 in test_ntlm_in_both ../../source3/utils/ntlm_auth_diagnostics.c:291\n    #9 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #10 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #11 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8513000c1 in test_lmv2_ntlmv2_broken ../../source3/utils/ntlm_auth_diagnostics.c:379\n    #9 0x55b851300936 in test_ntlmv2 ../../source3/utils/ntlm_auth_diagnostics.c:472\n    #10 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #11 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #12 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8512fe1a1 in test_lm_ntlm_broken ../../source3/utils/ntlm_auth_diagnostics.c:63\n    #9 0x55b8512fec3a in test_ntlm ../../source3/utils/ntlm_auth_diagnostics.c:185\n    #10 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #11 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #12 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8513000c1 in test_lmv2_ntlmv2_broken ../../source3/utils/ntlm_auth_diagnostics.c:379\n    #9 0x55b851300916 in test_lmv2 ../../source3/utils/ntlm_auth_diagnostics.c:463\n    #10 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #11 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #12 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8513000c1 in test_lmv2_ntlmv2_broken ../../source3/utils/ntlm_auth_diagnostics.c:379\n    #9 0x55b851300906 in test_ntlmv2_lmv2_broken ../../source3/utils/ntlm_auth_diagnostics.c:492\n    #10 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #11 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #12 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8513000c1 in test_lmv2_ntlmv2_broken ../../source3/utils/ntlm_auth_diagnostics.c:379\n    #9 0x55b8513008f6 in test_ntlmv2_ntlmv2_broken ../../source3/utils/ntlm_auth_diagnostics.c:497\n    #10 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #11 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #12 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8512fe1a1 in test_lm_ntlm_broken ../../source3/utils/ntlm_auth_diagnostics.c:63\n    #9 0x55b8512fec26 in test_ntlm_lm_broken ../../source3/utils/ntlm_auth_diagnostics.c:482\n    #10 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #11 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #12 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\nDirect leak of 104 byte(s) in 1 object(s) allocated from:\n    #0 0x7f72126fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69\n    #1 0x7f72122e8c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783\n    #2 0x7f72122eaacf in __talloc ../../lib/talloc/talloc.c:825\n    #3 0x7f72122eaacf in _talloc_named_const ../../lib/talloc/talloc.c:982\n    #4 0x7f72122eaacf in _talloc_array ../../lib/talloc/talloc.c:2784\n    #5 0x7f72118f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58\n    #6 0x7f72118f6b1b in data_blob_named ../../lib/util/data_blob.c:40\n    #7 0x55b8512f889c in get_challenge ../../source3/utils/ntlm_auth.c:375\n    #8 0x55b8512fe1a1 in test_lm_ntlm_broken ../../source3/utils/ntlm_auth_diagnostics.c:63\n    #9 0x55b8512fec62 in test_lm ../../source3/utils/ntlm_auth_diagnostics.c:176\n    #10 0x55b8513009b6 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:716\n    #11 0x55b8512fcefd in main ../../source3/utils/ntlm_auth.c:2855\n    #12 0x7f720ee2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58\n\n-----------------------------------------------------\nSuppressions used:\n  count      bytes template\n      1        125 libpopt.so\n-----------------------------------------------------\n\nSUMMARY: AddressSanitizer: 1144 byte(s) leaked in 11 allocation(s).\n''; message: expected return code 0; got 1

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
5 weeks agos3:utils: Fix memory leaks in test_ntlm_in_both()
Andreas Schneider [Fri, 25 Oct 2024 05:56:46 +0000 (07:56 +0200)] 
s3:utils: Fix memory leaks in test_ntlm_in_both()

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7ff61d8fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7ff61d450c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
    #2 0x7ff61d452acf in __talloc ../../lib/talloc/talloc.c:825
    #3 0x7ff61d452acf in _talloc_named_const ../../lib/talloc/talloc.c:982
    #4 0x7ff61d452acf in _talloc_array ../../lib/talloc/talloc.c:2784
    #5 0x7ff61c9f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58
    #6 0x7ff61c9f6b1b in data_blob_named ../../lib/util/data_blob.c:40
    #7 0x561cafffad96 in test_ntlm_in_both ../../source3/utils/ntlm_auth_diagnostics.c:285
    #8 0x561cafffc8d4 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:714
    #9 0x561cafff8efd in main ../../source3/utils/ntlm_auth.c:2855
    #10 0x7ff61a02a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
5 weeks agovfs_ceph_new: Handle the special case of UTIME_NOW
Anoop C S [Sat, 14 Jun 2025 09:02:28 +0000 (14:32 +0530)] 
vfs_ceph_new: Handle the special case of UTIME_NOW

As per utimensat(2)[1]:
. . .
If the tv_nsec field of one of the timespec structures has the special
value UTIME_NOW, then the corresponding file timestamp is set to the
current time.
. . .

Instead of utimes() or futimes() we make use of ceph_ll_setattr() with
appropriate mask to update timsestamps. It is also important to note
that ceph_ll_setattr() does not handle timestamps in pairs of timespec
structs. This had a shortcoming that the special consideration for the
magic value UTIME_NOW was left unattended resulting in epoch timestamps.
Therefore we reset those timestamps where UTIME_NOW is set in tv_nsec
with the current time.

[1] https://www.man7.org/linux/man-pages/man2/utimensat.2.html

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jun 30 14:16:52 UTC 2025 on atb-devel-224

5 weeks agovfs_ceph: Handle the special case of UTIME_NOW
Anoop C S [Sat, 14 Jun 2025 09:24:52 +0000 (14:54 +0530)] 
vfs_ceph: Handle the special case of UTIME_NOW

As per utimensat(2)[1]:
. . .
If the tv_nsec field of one of the timespec structures has the special
value UTIME_NOW, then the corresponding file timestamp is set to the
current time.
. . .

Instead of utimes() or futimes() we make use of ceph_setattrx() with
appropriate mask to update timsestamps. It is also important to note
that ceph_setattrx() does not handle timestamps in pairs of timespec
structs. This had a shortcoming that the special consideration for the
magic value UTIME_NOW was left unattended resulting in epoch timestamps.
Therefore we reset those timestamps where UTIME_NOW is set in tv_nsec
with the current time.

[1] https://www.man7.org/linux/man-pages/man2/utimensat.2.html

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 weeks agovfs_ceph: Add ctime processing to SMB_VFS_FNTIMES
Anoop C S [Sat, 14 Jun 2025 08:59:00 +0000 (14:29 +0530)] 
vfs_ceph: Add ctime processing to SMB_VFS_FNTIMES

ctime was only missing from the list of timestamps processed for various
checks.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 weeks agos3:winbind: Correct spelling in debug messages related to ADS
Daniel Widrick [Tue, 24 Jun 2025 02:07:44 +0000 (22:07 -0400)] 
s3:winbind: Correct spelling in debug messages related to ADS

Corrected spelling of 'security' from 'secuirity' in debug messages related to ADS

Signed-off-by: Daniel Widrick <daniel@widrick.net>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Sat Jun 28 09:04:56 UTC 2025 on atb-devel-224

6 weeks agos3/smbd: Conditionally define smb2_request_to_snum()
Anoop C S [Tue, 24 Jun 2025 09:48:34 +0000 (15:18 +0530)] 
s3/smbd: Conditionally define smb2_request_to_snum()

As of now smb2_request_to_snum() is only meaningful when profiling is
enabled.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Jun 24 14:24:57 UTC 2025 on atb-devel-224

6 weeks agos3:winbind: Delegate normalize_name_unmap to the idmap child in winbindd_getgroups
Samuel Cabrero [Tue, 27 May 2025 11:46:45 +0000 (13:46 +0200)] 
s3:winbind: Delegate normalize_name_unmap to the idmap child in winbindd_getgroups

Delegate name unmapping to the idmap child to avoid blocking the parent while
querying the LDAP server, depending on the idmap configuration.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jun 24 08:51:39 UTC 2025 on atb-devel-224

6 weeks agos3:winbind: Delegate normalize_name_unmap to the idmap child in winbindd_getpwnam
Samuel Cabrero [Tue, 27 May 2025 11:31:33 +0000 (13:31 +0200)] 
s3:winbind: Delegate normalize_name_unmap to the idmap child in winbindd_getpwnam

Delegate name unmapping to the idmap child to avoid blocking the parent while
querying the LDAP server, depending on the idmap configuration.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 weeks agos3:winbind: Delegate normalize_name_unmap to the idmap child in winbindd_getgrnam
Samuel Cabrero [Mon, 26 May 2025 13:23:19 +0000 (15:23 +0200)] 
s3:winbind: Delegate normalize_name_unmap to the idmap child in winbindd_getgrnam

Delegate name unmapping to the idmap child to avoid blocking the parent while
querying the LDAP server, depending on the idmap configuration.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 weeks agos3:winbind: Remove unused fill_grent()
Samuel Cabrero [Fri, 23 May 2025 12:26:08 +0000 (14:26 +0200)] 
s3:winbind: Remove unused fill_grent()

This function is no longer used.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 weeks agos3:winbind: Delegate normalize_name_map to the idmap child in winbindd_getgrgid
Samuel Cabrero [Fri, 23 May 2025 12:23:57 +0000 (14:23 +0200)] 
s3:winbind: Delegate normalize_name_map to the idmap child in winbindd_getgrgid

Delegate mapping to the idmap child to avoid blocking the parent while querying the
LDAP server, depending on the idmap configuration.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 weeks agos3:winbind: Delegate normalize_name_map to the idmap child in winbindd_getgrnam
Samuel Cabrero [Fri, 23 May 2025 11:40:32 +0000 (13:40 +0200)] 
s3:winbind: Delegate normalize_name_map to the idmap child in winbindd_getgrnam

Delegate mapping to the idmap child to avoid blocking the parent while querying the
LDAP server, depending on the idmap configuration.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 weeks agos3:winbind: Delegate normalize_name_map to the idmap child in wb_next_grent
Samuel Cabrero [Mon, 26 May 2025 05:54:38 +0000 (07:54 +0200)] 
s3:winbind: Delegate normalize_name_map to the idmap child in wb_next_grent

Delegate mapping to the idmap child to avoid blocking the parent while querying the
LDAP server, depending on the idmap configuration.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 weeks agopython:tests/nss: Add NSS group enumeration test
Samuel Cabrero [Mon, 26 May 2025 09:20:13 +0000 (11:20 +0200)] 
python:tests/nss: Add NSS group enumeration test

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 weeks agos3:winbind: Fix debug message
Samuel Cabrero [Fri, 23 May 2025 11:23:01 +0000 (13:23 +0200)] 
s3:winbind: Fix debug message

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 weeks agovfs_ceph_new: use per-share profile macros
Shachar Sharon [Mon, 12 May 2025 09:14:52 +0000 (12:14 +0300)] 
vfs_ceph_new: use per-share profile macros

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Jun 23 14:01:51 UTC 2025 on atb-devel-224

6 weeks agovfs_default: use per-share profile macros
Shachar Sharon [Mon, 28 Apr 2025 18:36:39 +0000 (21:36 +0300)] 
vfs_default: use per-share profile macros

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agos3/smb_prometheus_endpoint: export per-share profile stats
Shachar Sharon [Mon, 26 May 2025 08:51:04 +0000 (11:51 +0300)] 
s3/smb_prometheus_endpoint: export per-share profile stats

Iterate over per-share TDB entries (is exists) and export as Prometheus
metrics via call-back function.

Allow passing share-name as additional label to Prometheus metrics. By
default, use empty label to follow OpenMetrics[1] conventions ("Empty
label values SHOULD be treated as if the label was not present").

[1] https://github.com/prometheus/OpenMetrics/blob/main/specification/OpenMetrics.md

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agostatus: dump only relevant sections of per-share
Shachar Sharon [Tue, 20 May 2025 07:27:23 +0000 (10:27 +0300)] 
status: dump only relevant sections of per-share

Some profile sections are not relevant for per-share profile counters.
Ignore non-implemented section with all-zeros (avoid confusion).

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agostatus: dump per-share profile counters
Shachar Sharon [Mon, 28 Apr 2025 18:30:22 +0000 (21:30 +0300)] 
status: dump per-share profile counters

When dumping profile information, try to iterate also on per-share
profile entries and emit (json format).

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agosmbd: smb2-operations per-share profile counters
Shachar Sharon [Tue, 13 May 2025 09:24:15 +0000 (12:24 +0300)] 
smbd: smb2-operations per-share profile counters

Allow per-share profile counters for SMB2 operations.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agosmbd: init per-share profile counters
Shachar Sharon [Mon, 28 Apr 2025 12:11:06 +0000 (15:11 +0300)] 
smbd: init per-share profile counters

When per-share profile counters are enabled, setup/teardown the
profiling entry for specific 'snum' before/after VFS connect/disconnect.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agoparam: allow per-share profiling mode
Shachar Sharon [Sun, 27 Apr 2025 09:18:09 +0000 (12:18 +0300)] 
param: allow per-share profiling mode

Allow per-share profile counters by setting a configure option
'smbd profiling share = yes' on each share which wants this option
enabled. Requires global profiling to be enabled.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agoprofile: reset per-share counters
Shachar Sharon [Thu, 29 May 2025 12:31:46 +0000 (15:31 +0300)] 
profile: reset per-share counters

Allow zero-reset dynamic per-share profile counters when sending
'smbcontrol smbd profile flush' to active smbd.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agoprofile: collect per-share counters from TDB
Shachar Sharon [Mon, 28 Apr 2025 12:06:59 +0000 (15:06 +0300)] 
profile: collect per-share counters from TDB

Helper functions to iterate over per-share profile counters from TDB
file using callback function.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agoprofile: defined helper macros for per-share counters
Shachar Sharon [Mon, 28 Apr 2025 12:00:43 +0000 (15:00 +0300)] 
profile: defined helper macros for per-share counters

Helper macros the use per-share profile counters, using 'snum' as
lookup key.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Co-Authored-By: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agoprofile: dynamic per-share in-memory counters
Shachar Sharon [Mon, 28 Apr 2025 09:05:25 +0000 (12:05 +0300)] 
profile: dynamic per-share in-memory counters

Mechanism to support per-share per-process run-time profiling counters.
Use in-memory cache for storing run-time entries, using 'snum' as key.
When storing in TDB file, uses unique key for each per-share profile
entry.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agoauth: Direct variable initialization
Volker Lendecke [Thu, 19 Jun 2025 15:44:31 +0000 (17:44 +0200)] 
auth: Direct variable initialization

talloc_stackframe() panics on failure

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Jun 20 11:12:14 UTC 2025 on atb-devel-224

6 weeks agoauth: Remove unused session_info_set_session_key()
Volker Lendecke [Thu, 19 Jun 2025 15:04:35 +0000 (17:04 +0200)] 
auth: Remove unused session_info_set_session_key()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agolibsmb: Slightly simplify cli_tcon_andx_done()
Volker Lendecke [Thu, 19 Jun 2025 11:11:27 +0000 (13:11 +0200)] 
libsmb: Slightly simplify cli_tcon_andx_done()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agolibsmb: Move cli_smb() to source3/torture
Volker Lendecke [Thu, 19 Jun 2025 11:02:17 +0000 (13:02 +0200)] 
libsmb: Move cli_smb() to source3/torture

Only used there

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agolibsmb: Move cli_smbwrite() to source3/torture
Volker Lendecke [Thu, 19 Jun 2025 11:00:18 +0000 (13:00 +0200)] 
libsmb: Move cli_smbwrite() to source3/torture

Only used there

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agotevent: Fix 1649525 Use of 32-bit time_t
Volker Lendecke [Fri, 20 Jun 2025 07:27:23 +0000 (09:27 +0200)] 
tevent: Fix 1649525 Use of 32-bit time_t

Coverity ID "1649525 Use of 32-bit time_t" is correct. What Coverity
does not see is that this routine is the only one assigning to
ev->wait_timeout. Make Coverity happy with the MIN().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agotevent: Fix Coverity ID 1649524 Dereference before null check
Volker Lendecke [Fri, 20 Jun 2025 07:15:56 +0000 (09:15 +0200)] 
tevent: Fix Coverity ID 1649524 Dereference before null check

The only caller of epoll_event_loop gives a non-NULL pointer.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agotevent: Fix Coverity ID 1649526 Dereference before null check
Volker Lendecke [Fri, 20 Jun 2025 07:12:47 +0000 (09:12 +0200)] 
tevent: Fix Coverity ID 1649526 Dereference before null check

The only caller of poll_event_loop_poll gives a non-NULL pointer.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agolibrpc/idl: Add idl for msDS-KeyCredentialLink
Gary Lockyer [Tue, 10 Jun 2025 21:04:01 +0000 (09:04 +1200)] 
librpc/idl: Add idl for msDS-KeyCredentialLink

Idl and supporting helpers for msDS-KeyCredentialLinks.
See [MS-ADTS] 2.2.20 Key Credential Link Structures

Currently the KeyMaterial is treated as a binary blob

The naming and casing of the variable names is close as is possible to
those in the specification.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Jun 19 00:08:31 UTC 2025 on atb-devel-224

7 weeks agos3:selftest: run smb2.{bench,connect,credits,ioctl,rw} over bsd-tstream
Stefan Metzmacher [Thu, 22 May 2025 08:59:46 +0000 (10:59 +0200)] 
s3:selftest: run smb2.{bench,connect,credits,ioctl,rw} over bsd-tstream

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jun 18 19:02:29 UTC 2025 on atb-devel-224

7 weeks agoselftest: don't skip smb2.bench
Stefan Metzmacher [Wed, 30 Apr 2025 11:56:17 +0000 (13:56 +0200)] 
selftest: don't skip smb2.bench

This runs each test for 10 seconds and is a good
stress test for the transport layer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:libsmb: add 'client smb transport:force_bsd_tstream = yes' option
Stefan Metzmacher [Fri, 16 May 2025 09:46:36 +0000 (11:46 +0200)] 
s3:libsmb: add 'client smb transport:force_bsd_tstream = yes' option

This can be used to force the tstream based code path in smbXcli_conn.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: add smbXcli_transport_bsd_tstream()
Stefan Metzmacher [Fri, 16 May 2025 09:34:37 +0000 (11:34 +0200)] 
libcli/smb: add smbXcli_transport_bsd_tstream()

This can be used to force the usage of the tstream code path even
for bsd sockets.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: add smbXcli_transport_tstream()
Stefan Metzmacher [Wed, 7 May 2025 18:29:55 +0000 (20:29 +0200)] 
libcli/smb: add smbXcli_transport_tstream()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: make read_smb_more non-static
Stefan Metzmacher [Wed, 7 May 2025 19:37:16 +0000 (21:37 +0200)] 
libcli/smb: make read_smb_more non-static

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: abstract transport function calls
Stefan Metzmacher [Wed, 7 May 2025 19:15:20 +0000 (21:15 +0200)] 
libcli/smb: abstract transport function calls

In future we'll have transports without a bsd
socket fd.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:client: make use of smbXcli_conn_monitor_once()
Stefan Metzmacher [Thu, 15 May 2025 11:59:00 +0000 (13:59 +0200)] 
s3:client: make use of smbXcli_conn_monitor_once()

This makes it possible to run checks based on
a tevent_context in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: add smbXcli_conn_monitor_{send,recv,once}()
Stefan Metzmacher [Thu, 15 May 2025 11:48:20 +0000 (13:48 +0200)] 
libcli/smb: add smbXcli_conn_monitor_{send,recv,once}()

smbXcli_conn_monitor_{send,recv} can be used to monitor
a connection over a long time. It will only come back
if there's a connection error.

smbXcli_conn_monitor_once() will be used by sync callers
without a long term tevent context and needs to be called
multiple times per second in order to work correctly.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: let smbXcli_transport_bsd() take an fd by reference
Stefan Metzmacher [Wed, 21 May 2025 13:25:26 +0000 (15:25 +0200)] 
libcli/smb: let smbXcli_transport_bsd() take an fd by reference

This allows it to set the callers value to -1 when it was moved.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:libsmb: let smbsock_connect_recv() return smbXcli_transport
Stefan Metzmacher [Wed, 7 May 2025 15:41:14 +0000 (17:41 +0200)] 
s3:libsmb: let smbsock_connect_recv() return smbXcli_transport

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:libsmb: let smbsock_connect() return smbXcli_transport
Stefan Metzmacher [Wed, 7 May 2025 15:11:49 +0000 (17:11 +0200)] 
s3:libsmb: let smbsock_connect() return smbXcli_transport

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:libsmb: let smbsock_any_connect_recv return smbXcli_transport
Stefan Metzmacher [Wed, 7 May 2025 13:38:34 +0000 (15:38 +0200)] 
s3:libsmb: let smbsock_any_connect_recv return smbXcli_transport

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos4:libcli: let struct smbcli_socket hold struct smbXcli_transport instead of sockfd
Stefan Metzmacher [Wed, 7 May 2025 14:46:55 +0000 (16:46 +0200)] 
s4:libcli: let struct smbcli_socket hold struct smbXcli_transport instead of sockfd

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:libsmb: let smbsock_any_connect() return smbXcli_transport
Stefan Metzmacher [Wed, 7 May 2025 13:44:28 +0000 (15:44 +0200)] 
s3:libsmb: let smbsock_any_connect() return smbXcli_transport

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:winbindd: let find_dc() call smbXcli_transport_bsd()
Stefan Metzmacher [Wed, 7 May 2025 14:11:15 +0000 (16:11 +0200)] 
s3:winbindd: let find_dc() call smbXcli_transport_bsd()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:winbindd: let cm_open_connection() call smbXcli_transport_bsd()
Stefan Metzmacher [Wed, 7 May 2025 13:57:05 +0000 (15:57 +0200)] 
s3:winbindd: let cm_open_connection() call smbXcli_transport_bsd()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:libsmb: let cli_connect_sock_recv() return smbXcli_transport
Stefan Metzmacher [Wed, 7 May 2025 13:22:48 +0000 (15:22 +0200)] 
s3:libsmb: let cli_connect_sock_recv() return smbXcli_transport

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:libsmb: pass smbXcli_transport to cli_state_create()
Stefan Metzmacher [Wed, 7 May 2025 13:01:20 +0000 (15:01 +0200)] 
s3:libsmb: pass smbXcli_transport to cli_state_create()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: pass smbXcli_transport to smbXcli_conn_create()
Stefan Metzmacher [Wed, 7 May 2025 12:30:08 +0000 (14:30 +0200)] 
libcli/smb: pass smbXcli_transport to smbXcli_conn_create()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: let smbXcli_conn_create() call smbXcli_transport_bsd()
Stefan Metzmacher [Wed, 7 May 2025 20:15:40 +0000 (22:15 +0200)] 
libcli/smb: let smbXcli_conn_create() call smbXcli_transport_bsd()

The next step will pass struct smbXcli_transport from the caller.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: introduce smbXcli_transport_bsd
Stefan Metzmacher [Wed, 7 May 2025 12:21:31 +0000 (14:21 +0200)] 
libcli/smb: introduce smbXcli_transport_bsd

The next commits will pass an smbXcli_transport to
smbXcli_conn_create() instead of a plain 'int fd'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/smb: merge smb_transport library into cli_smb_common
Stefan Metzmacher [Wed, 7 May 2025 19:35:24 +0000 (21:35 +0200)] 
libcli/smb: merge smb_transport library into cli_smb_common

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agoasync_sock: add wait_for_error_send/recv
Stefan Metzmacher [Tue, 20 May 2025 18:20:30 +0000 (20:20 +0200)] 
async_sock: add wait_for_error_send/recv

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agoasync_sock: move samba_socket_{poll,sock,poll_or_sock}_error() from util_net.c to...
Stefan Metzmacher [Thu, 22 May 2025 08:06:53 +0000 (10:06 +0200)] 
async_sock: move samba_socket_{poll,sock,poll_or_sock}_error() from util_net.c to async_sock.c

The change to LGPL is also intended.

It will be used in the the next commit that adds
wait_for_error_send/recv.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolibcli/named_pipe_auth: add tstream_npa_monitor_send/recv
Stefan Metzmacher [Wed, 21 May 2025 13:08:42 +0000 (15:08 +0200)] 
libcli/named_pipe_auth: add tstream_npa_monitor_send/recv

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolib/tsocket: implement tstream_bsd_monitor_send/recv
Stefan Metzmacher [Wed, 21 May 2025 12:57:15 +0000 (14:57 +0200)] 
lib/tsocket: implement tstream_bsd_monitor_send/recv

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolib/tsocket: add tstream_monitor_send/recv infrastructure
Stefan Metzmacher [Thu, 15 May 2025 10:01:12 +0000 (12:01 +0200)] 
lib/tsocket: add tstream_monitor_send/recv infrastructure

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolib/tsocket: allow only one tstream_disconnect_send/recv
Stefan Metzmacher [Fri, 16 May 2025 08:04:25 +0000 (10:04 +0200)] 
lib/tsocket: allow only one tstream_disconnect_send/recv

And don't allow readv and writev anymore.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolib/tsocket: make use of tevent_req_set_cleanup_fn() instead of talloc_set_destructor()
Stefan Metzmacher [Thu, 15 May 2025 12:32:01 +0000 (14:32 +0200)] 
lib/tsocket: make use of tevent_req_set_cleanup_fn() instead of talloc_set_destructor()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos4:torture/smb2: add explicit timeout handling to async_credits tests
Stefan Metzmacher [Mon, 26 May 2025 11:14:53 +0000 (13:14 +0200)] 
s4:torture/smb2: add explicit timeout handling to async_credits tests

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos4:torture/smb2: force a disconnect on all connections as async_credits tests
Stefan Metzmacher [Mon, 26 May 2025 11:01:48 +0000 (13:01 +0200)] 
s4:torture/smb2: force a disconnect on all connections as async_credits tests

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos4:torture/smb2: let max_async_credits tests start the loop only when everything...
Stefan Metzmacher [Mon, 26 May 2025 10:21:08 +0000 (12:21 +0200)] 
s4:torture/smb2: let max_async_credits tests start the loop only when everything is ready

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agotevent: version 0.17.0 tevent-0.17.0
Stefan Metzmacher [Fri, 23 May 2025 12:46:15 +0000 (14:46 +0200)] 
tevent: version 0.17.0

- add tevent_context_set_wait_timeout()
- add tevent_reset_immediate()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agotevent: add tevent_reset_immediate()
Stefan Metzmacher [Fri, 23 May 2025 12:26:38 +0000 (14:26 +0200)] 
tevent: add tevent_reset_immediate()

This is a much better api than using
tevent_schedule_immediate() with a NULL handler,
while the tevent_context is still required as argument.

Note the tevent-0.16.2.sigs changes will be reverted in
the 'tevent 0.17.0' commit.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agotevent: Add tevent_context_set_wait_timeout()
Volker Lendecke [Mon, 10 Mar 2025 20:12:28 +0000 (21:12 +0100)] 
tevent: Add tevent_context_set_wait_timeout()

Mainly to make tevent_loop_once() return immediately with
-1/errno=EAGAIN for polling behaviour.

Note the tevent-0.16.2.sigs changes will be reverted in
the 'tevent 0.17.0' commit.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agolib:util: Disable logging to syslog for startup messages
Andreas Schneider [Tue, 10 Jun 2025 11:46:13 +0000 (13:46 +0200)] 
lib:util: Disable logging to syslog for startup messages

D_ERR also is sent to syslog!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jun 18 12:10:03 UTC 2025 on atb-devel-224

7 weeks agoEnable clang 20 cast-qual warnings
Gary Lockyer [Tue, 17 Jun 2025 21:03:55 +0000 (09:03 +1200)] 
Enable clang 20 cast-qual warnings

Now that pam_wrapper has been upgraded to 1.1.8, it compiles without
cast-qual warnings.  So lets re-enable the warnings.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Jun 18 06:26:53 UTC 2025 on atb-devel-224

7 weeks agothird_party: Update pam_wrapper to version 1.1.8
Andreas Schneider [Mon, 16 Jun 2025 05:45:21 +0000 (07:45 +0200)] 
third_party: Update pam_wrapper to version 1.1.8

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jun 17 08:38:35 UTC 2025 on atb-devel-224

7 weeks agopython: Do not interpret 16 character group names as GUIDs
Douglas Bagnall [Fri, 13 Jun 2025 00:29:02 +0000 (12:29 +1200)] 
python: Do not interpret 16 character group names as GUIDs

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Baumbach <bb@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Mon Jun 16 22:22:27 UTC 2025 on atb-devel-224

7 weeks agopytest: samba-tool group: test with 16 character name
Douglas Bagnall [Thu, 12 Jun 2025 23:38:22 +0000 (11:38 +1200)] 
pytest: samba-tool group: test with 16 character name

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Baumbach <bb@samba.org>
7 weeks agopytest:samba-tool group: test addmembers
Douglas Bagnall [Fri, 13 Jun 2025 00:23:30 +0000 (12:23 +1200)] 
pytest:samba-tool group: test addmembers

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Baumbach <bb@samba.org>
7 weeks agolibsmbclient: Intercept "smb311_posix.statinfo" attribute
Volker Lendecke [Tue, 10 Jun 2025 17:10:42 +0000 (19:10 +0200)] 
libsmbclient: Intercept "smb311_posix.statinfo" attribute

Directly get a "struct stat" plus a 32-bit uint32 for the dosatts

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jun 16 16:08:20 UTC 2025 on atb-devel-224

7 weeks agolibsmbclient: Intercept "posix.attr.enabled" for fgetxattr
Volker Lendecke [Mon, 2 Jun 2025 13:24:04 +0000 (15:24 +0200)] 
libsmbclient: Intercept "posix.attr.enabled" for fgetxattr

Local call to find out whether the file was opened with smb311 posix
extensions.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 weeks agolibsmbclient: Request posix file handles on demand
Volker Lendecke [Wed, 4 Jun 2025 06:19:56 +0000 (08:19 +0200)] 
libsmbclient: Request posix file handles on demand

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 weeks agolibsmbclient: Allow O_PATH for smbc_open()
Volker Lendecke [Tue, 29 Apr 2025 12:04:26 +0000 (14:04 +0200)] 
libsmbclient: Allow O_PATH for smbc_open()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 weeks agolibsmbclient: Add fgetxattr
Volker Lendecke [Wed, 11 Jun 2025 10:28:09 +0000 (12:28 +0200)] 
libsmbclient: Add fgetxattr

Just boilerplate so far

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 weeks agolibsmb: Remove "source3/libsmb/libsmb.h"
Volker Lendecke [Tue, 13 May 2025 14:25:07 +0000 (16:25 +0200)] 
libsmb: Remove "source3/libsmb/libsmb.h"

libsmb.h added ads_status.h and cli_smb2_fnum.h. Only few users need
either.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 weeks agosmbd: Modernize DBGs
Volker Lendecke [Mon, 31 Mar 2025 08:27:13 +0000 (10:27 +0200)] 
smbd: Modernize DBGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat Jun 14 09:49:16 UTC 2025 on atb-devel-224

7 weeks agosmbd: Avoid a ZERO_STRUCT with an explicit initialization
Volker Lendecke [Mon, 24 Feb 2025 20:04:32 +0000 (21:04 +0100)] 
smbd: Avoid a ZERO_STRUCT with an explicit initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agosmbd: Fix CID 1508939 Use of 32-bit time_t
Volker Lendecke [Wed, 2 Apr 2025 10:30:25 +0000 (12:30 +0200)] 
smbd: Fix CID 1508939 Use of 32-bit time_t

This will pop up somewhere else, but this one was easy to fix.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agorpc_server: Remove a leftover from before str_list_add_printf()
Volker Lendecke [Sun, 23 Mar 2025 16:57:37 +0000 (17:57 +0100)] 
rpc_server: Remove a leftover from before str_list_add_printf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agosmbd: Make safe_symlink_target_path() static
Volker Lendecke [Sun, 30 Mar 2025 18:28:11 +0000 (20:28 +0200)] 
smbd: Make safe_symlink_target_path() static

Only used once

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agolibrpc: Fix whitespace
Volker Lendecke [Sun, 23 Mar 2025 16:03:16 +0000 (17:03 +0100)] 
librpc: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agolibcli: Avoid a ZERO_STRUCT with a direct initialization
Volker Lendecke [Tue, 10 Jun 2025 07:55:58 +0000 (09:55 +0200)] 
libcli: Avoid a ZERO_STRUCT with a direct initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agonet: Fix a panic in "net vfs getntacl"
Volker Lendecke [Thu, 20 Mar 2025 16:57:11 +0000 (17:57 +0100)] 
net: Fix a panic in "net vfs getntacl"

We have to explicitly free smb_fname, because after openat_pathref_fsp
we have a file descriptor around. If we then later talloc_free() the
connection_struct, fd_handle_destructor() panics because talloc_free()
does not free smb_fname before the connection_struct.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agolibndr: Simplify indentation in ndr_print
Volker Lendecke [Sat, 7 Jun 2025 09:34:18 +0000 (11:34 +0200)] 
libndr: Simplify indentation in ndr_print

printf can take care of the for-loop

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agolib: Use metadata_fsp() where appropriate
Volker Lendecke [Sat, 7 Jun 2025 08:54:56 +0000 (10:54 +0200)] 
lib: Use metadata_fsp() where appropriate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agosmbd: Fix whitespace
Volker Lendecke [Sat, 7 Jun 2025 09:05:55 +0000 (11:05 +0200)] 
smbd: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 weeks agos3:auth: Fix Coverity ID 1646934: memory leak in make_pw_chat
Shachar Sharon [Wed, 11 Jun 2025 12:04:31 +0000 (15:04 +0300)] 
s3:auth: Fix Coverity ID 1646934: memory leak in make_pw_chat

make_pw_chat may succeed in the first call to SMB_CALLOC_ARRAY but fail
in one of the following loop iterations, in which the list is already
populated with dynamically allocated entries. Make sure that we free the
list before bailing out with NULL.

Fixes Coverity issue 1646934

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Jun 14 07:41:48 UTC 2025 on atb-devel-224

7 weeks agolib: Refactor fgets usage, fix resource leaks
Shwetha K Acharya [Tue, 20 May 2025 07:59:59 +0000 (13:29 +0530)] 
lib: Refactor fgets usage, fix resource leaks

This commit refactors the code by replacing fgets with
getline for more reliable line reading.

Additionally this PR,
- Corrects the error message for calloc failure.
- Ensures that resources are properly freed and
  closed before calling errx(), fixing potential
  resource leaks.
- Adds a check to gracefully skip newlines and
  comment lines(starting with #)
- simplifies error handling by grouping repetitive
  free statements under goto block

Signed-off-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 13 16:46:33 UTC 2025 on atb-devel-224

7 weeks agosmbd: Fix Coverity ID 1648344: print work-dir properly
Shachar Sharon [Tue, 3 Jun 2025 08:31:20 +0000 (11:31 +0300)] 
smbd: Fix Coverity ID 1648344: print work-dir properly

Commit 509081e7e ("smbd: expand logging in contend_dirleases()") added a
log-trace which calls get_current_dir_name() on-the-fly, which caused a
Coverity issue (memory-leak). Replace this call with the proper call to
SMB_VFS_GETWD (+ release memory).

Fixes Coverity issue 1648344

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 13 09:55:09 UTC 2025 on atb-devel-224

7 weeks agosmbd: Fix coverity#1646864 Move variable init code in checked block
Vinit Agnihotri [Thu, 12 Jun 2025 10:30:26 +0000 (16:00 +0530)] 
smbd: Fix coverity#1646864 Move variable init code in checked block

xconn was getting dereference outside NULL check block, causing
'Dereference after null check' issue.

Fix moves offeding initialisation in NULL check blog.

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Jun 12 16:49:02 UTC 2025 on atb-devel-224