]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 months agolib/util: fix NONNULL(params) __attribute__((nonnull(params)))
Stefan Metzmacher [Sun, 6 Apr 2025 19:05:12 +0000 (21:05 +0200)] 
lib/util: fix NONNULL(params) __attribute__((nonnull(params)))

This should be set on the function prototype itself specifying
all non null arguments e.g.

NONNULL(1) NONNULL(3)
int foo(const char *arg1, int arg2, const char *arg3);

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:libsmb: rework smbsock_connect_* to work on smb_transports internally
Stefan Metzmacher [Fri, 4 Apr 2025 15:04:50 +0000 (17:04 +0200)] 
s3:libsmb: rework smbsock_connect_* to work on smb_transports internally

We try the first transport first and all others after 5msecs,
but if one fails we start the next one.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:lib: remove unused open_socket_out_defer_send/recv
Stefan Metzmacher [Fri, 4 Apr 2025 11:48:54 +0000 (13:48 +0200)] 
s3:lib: remove unused open_socket_out_defer_send/recv

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:lib: pass 'protocol' to open_socket_out_send()
Stefan Metzmacher [Fri, 4 Apr 2025 11:33:31 +0000 (13:33 +0200)] 
s3:lib: pass 'protocol' to open_socket_out_send()

For now this is always explicitly IPPROTO_TCP,
but that will change when we add support for IPPROTO_QUIC.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:lib: let open_socket_out_send() use samba_sockaddr to avoid strict-aliasing warnings
Stefan Metzmacher [Fri, 4 Apr 2025 11:24:32 +0000 (13:24 +0200)] 
s3:lib: let open_socket_out_send() use samba_sockaddr to avoid strict-aliasing warnings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: use open_socket_in_protocol() in smbd_open_one_socket()
Stefan Metzmacher [Tue, 8 Apr 2025 09:16:10 +0000 (11:16 +0200)] 
s3:smbd: use open_socket_in_protocol() in smbd_open_one_socket()

For now this is always explicitly IPPROTO_TCP,
but that will change when we add support for IPPROTO_QUIC.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:lib: split out open_socket_in_protocol()
Stefan Metzmacher [Thu, 3 Apr 2025 15:14:32 +0000 (17:14 +0200)] 
s3:lib: split out open_socket_in_protocol()

This will be useful if we want to listen on IPPROTO_QUIC
sockets.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agodocs-xml/smbdotconf: change 'smb ports' into a synonym for 'server smb transport'
Stefan Metzmacher [Wed, 2 Apr 2025 18:45:53 +0000 (20:45 +0200)] 
docs-xml/smbdotconf: change 'smb ports' into a synonym for 'server smb transport'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agoctdb:events: let 50.samba.script use 'server smb transports'
Stefan Metzmacher [Thu, 3 Apr 2025 14:55:19 +0000 (16:55 +0200)] 
ctdb:events: let 50.samba.script use 'server smb transports'

We can't only use 'server smb transports' as in ci runs
the 'testparm' binary is from the distribution and likely
be in older Samba version.

So we still fallback to 'smb ports'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agoctdb:events: let 50.samba.script normalize the transports to tcp ports
Stefan Metzmacher [Thu, 3 Apr 2025 14:55:19 +0000 (16:55 +0200)] 
ctdb:events: let 50.samba.script normalize the transports to tcp ports

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: setup parent->transports from 'server smb transports'
Stefan Metzmacher [Thu, 3 Apr 2025 13:39:40 +0000 (15:39 +0200)] 
s3:smbd: setup parent->transports from 'server smb transports'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:smb_server: make use of lpcfg_server_smb_transports() in smbsrv_add_socket()
Stefan Metzmacher [Thu, 3 Apr 2025 11:43:46 +0000 (13:43 +0200)] 
s4:smb_server: make use of lpcfg_server_smb_transports() in smbsrv_add_socket()

Here we still only support tcp and nbt...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agodocs-xml/smbdotconf: add 'server smb transport' option
Stefan Metzmacher [Wed, 2 Apr 2025 18:45:53 +0000 (20:45 +0200)] 
docs-xml/smbdotconf: add 'server smb transport' option

In the next commits 'smb ports' will become just
a synonym for 'server smb transport'...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:torture: map --smb-ports option to 'client smb transports'
Stefan Metzmacher [Thu, 3 Apr 2025 13:02:57 +0000 (15:02 +0200)] 
s4:torture: map --smb-ports option to 'client smb transports'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:param: let lpcfg_smbcli_options() use lpcfg_client_smb_transports()
Stefan Metzmacher [Thu, 3 Apr 2025 10:26:48 +0000 (12:26 +0200)] 
s4:param: let lpcfg_smbcli_options() use lpcfg_client_smb_transports()

It means we'll use 'client smb transports' instead of 'smb ports'
for the client side.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agodocs-xml/smbdotconf: add 'client smb transports' option
Stefan Metzmacher [Wed, 2 Apr 2025 19:03:22 +0000 (21:03 +0200)] 
docs-xml/smbdotconf: add 'client smb transports' option

This will replace the use of 'smb ports' for source4 clients.

In future it will be used for all smb client connections
and it will allow to add other transports as 'quic' or 'smbdirect.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:smb_server: make use of smb_transports_parse() in smbsrv_add_socket()
Stefan Metzmacher [Thu, 3 Apr 2025 11:43:46 +0000 (13:43 +0200)] 
s4:smb_server: make use of smb_transports_parse() in smbsrv_add_socket()

Here we will only support tcp and nbt...,
but that will simplify the global transition from 'smb ports' to
'server smb transports'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: use parent->transports instead of 'smb ports' strings
Stefan Metzmacher [Thu, 3 Apr 2025 14:10:58 +0000 (16:10 +0200)] 
s3:smbd: use parent->transports instead of 'smb ports' strings

This will simplify adding new transports as 'quic' or 'smbdirect'
in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: setup parent->transports from 'smb ports'
Stefan Metzmacher [Thu, 3 Apr 2025 13:39:40 +0000 (15:39 +0200)] 
s3:smbd: setup parent->transports from 'smb ports'

This will be used in the next commits and in the
end derived from the 'server smb transports' option.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: let open_sockets_smbd() use smbd_open_socket_for_ip()
Stefan Metzmacher [Thu, 3 Apr 2025 13:15:33 +0000 (15:15 +0200)] 
s3:smbd: let open_sockets_smbd() use smbd_open_socket_for_ip()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: remove unused msg_ctx argument from smbd_open_socket_for_ip()
Stefan Metzmacher [Thu, 3 Apr 2025 13:07:05 +0000 (15:07 +0200)] 
s3:smbd: remove unused msg_ctx argument from smbd_open_socket_for_ip()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: let smbd_open_socket_for_ip() return the number of successful binds
Stefan Metzmacher [Thu, 3 Apr 2025 12:47:13 +0000 (14:47 +0200)] 
s3:smbd: let smbd_open_socket_for_ip() return the number of successful binds

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: simplify binding to wildcard addresses
Stefan Metzmacher [Thu, 3 Apr 2025 12:42:44 +0000 (14:42 +0200)] 
s3:smbd: simplify binding to wildcard addresses

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: only do dns_port logic in one central place.
Stefan Metzmacher [Thu, 3 Apr 2025 12:37:02 +0000 (14:37 +0200)] 
s3:smbd: only do dns_port logic in one central place.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: remove unused dns_port variable from smbd_open_socket_for_ip()
Stefan Metzmacher [Thu, 3 Apr 2025 12:33:14 +0000 (14:33 +0200)] 
s3:smbd: remove unused dns_port variable from smbd_open_socket_for_ip()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: let smbd_{addr_changed,close_socket_for_ip}() use samba_sockaddr to avoid...
Stefan Metzmacher [Thu, 3 Apr 2025 13:23:48 +0000 (15:23 +0200)] 
s3:smbd: let smbd_{addr_changed,close_socket_for_ip}() use samba_sockaddr to avoid strict-aliasing warnings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3:smbd: let smbd_accept_connection() use samba_sockaddr to avoid strict-aliasing...
Stefan Metzmacher [Thu, 3 Apr 2025 11:50:47 +0000 (13:50 +0200)] 
s3:smbd: let smbd_accept_connection() use samba_sockaddr to avoid strict-aliasing warnings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:client: remove unused ports from do_connect()
Stefan Metzmacher [Thu, 3 Apr 2025 08:56:13 +0000 (10:56 +0200)] 
s4:client: remove unused ports from do_connect()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:torture: remove unused ports from masktests.c
Stefan Metzmacher [Thu, 3 Apr 2025 08:55:00 +0000 (10:55 +0200)] 
s4:torture: remove unused ports from masktests.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:client: remove unused ports from cifsdd* functions
Stefan Metzmacher [Thu, 3 Apr 2025 08:53:35 +0000 (10:53 +0200)] 
s4:client: remove unused ports from cifsdd* functions

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused ports from smbcli_full_connection()
Stefan Metzmacher [Thu, 3 Apr 2025 08:49:30 +0000 (10:49 +0200)] 
s4:libcli: remove unused ports from smbcli_full_connection()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:client: remove unused destports from do_message_op()
Stefan Metzmacher [Thu, 3 Apr 2025 08:41:59 +0000 (10:41 +0200)] 
s4:client: remove unused destports from do_message_op()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused ports from smbcli_socket_connect()
Stefan Metzmacher [Thu, 3 Apr 2025 08:40:51 +0000 (10:40 +0200)] 
s4:libcli: remove unused ports from smbcli_socket_connect()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused dest_ports from smbcli_tree_full_connection()
Stefan Metzmacher [Thu, 3 Apr 2025 08:38:15 +0000 (10:38 +0200)] 
s4:libcli: remove unused dest_ports from smbcli_tree_full_connection()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused dest_ports struct smb_composite_fsinfo
Stefan Metzmacher [Thu, 3 Apr 2025 08:35:05 +0000 (10:35 +0200)] 
s4:libcli: remove unused dest_ports struct smb_composite_fsinfo

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused ports from struct smb_composite_fetchfile
Stefan Metzmacher [Thu, 3 Apr 2025 08:33:32 +0000 (10:33 +0200)] 
s4:libcli: remove unused ports from struct smb_composite_fetchfile

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:torture/raw: remove unused dest_port handling from openbench.c
Stefan Metzmacher [Thu, 3 Apr 2025 08:31:05 +0000 (10:31 +0200)] 
s4:torture/raw: remove unused dest_port handling from openbench.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused dest_ports from struct smb_composite_connect
Stefan Metzmacher [Thu, 3 Apr 2025 08:28:26 +0000 (10:28 +0200)] 
s4:libcli: remove unused dest_ports from struct smb_composite_connect

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused ports from smb2_connect()
Stefan Metzmacher [Thu, 3 Apr 2025 08:21:42 +0000 (10:21 +0200)] 
s4:libcli: remove unused ports from smb2_connect()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused ports argument from smb2_connect_ext()
Stefan Metzmacher [Thu, 3 Apr 2025 06:46:27 +0000 (08:46 +0200)] 
s4:libcli: remove unused ports argument from smb2_connect_ext()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused ports argument from smb2_connect_send
Stefan Metzmacher [Thu, 3 Apr 2025 06:44:24 +0000 (08:44 +0200)] 
s4:libcli: remove unused ports argument from smb2_connect_send

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: remove unused dest_ports from smb_connect_nego_send()
Stefan Metzmacher [Thu, 3 Apr 2025 06:40:24 +0000 (08:40 +0200)] 
s4:libcli: remove unused dest_ports from smb_connect_nego_send()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: pass struct smbcli_options to smbcli_sock_connect() instead of port strings
Stefan Metzmacher [Thu, 3 Apr 2025 06:35:40 +0000 (08:35 +0200)] 
s4:libcli: pass struct smbcli_options to smbcli_sock_connect() instead of port strings

This allows us to build the ports array from options.transports.

Pair-Programmed-With: Ralph Boehme <slow@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli: introduce smbcli_options.transports based on lpcfg_smb_ports()
Stefan Metzmacher [Wed, 2 Apr 2025 19:14:10 +0000 (21:14 +0200)] 
s4:libcli: introduce smbcli_options.transports based on lpcfg_smb_ports()

This will allow us to avoid passing lpcfg_smb_ports() explicitly
in a lot of places in the following commits.

Once that's done we will change away from "smb ports" to
something like "client smb transports".

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agolibcli/smb: add struct smb_transports infrastructure
Stefan Metzmacher [Wed, 2 Apr 2025 17:51:50 +0000 (19:51 +0200)] 
libcli/smb: add struct smb_transports infrastructure

This will be able to use a structure instead of
a string array with int string values for 'smb ports'.

We'll soon add support for smb over quic, so
we need something better than tcp ports with
139 being special.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos4:libcli/smb_composite: remove unused struct smb_composite_connectmulti
Stefan Metzmacher [Wed, 2 Apr 2025 17:16:48 +0000 (19:16 +0200)] 
s4:libcli/smb_composite: remove unused struct smb_composite_connectmulti

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agolibcli/smb: make smb2_lease_{pull,push} endian safe
Stefan Metzmacher [Wed, 16 Apr 2025 13:18:12 +0000 (15:18 +0200)] 
libcli/smb: make smb2_lease_{pull,push} endian safe

smbd_smb2_send_lease_break() is already endian safe,
which means we'll get a mismatch on big endian systems,
so that smbd_smb2_send_lease_break() sends the lease key
in reversed order.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Apr 17 11:30:58 UTC 2025 on atb-devel-224

4 months agolibcli/smb: convert smb2_lease_push() to PUSH_LE_U*
Stefan Metzmacher [Wed, 16 Apr 2025 13:18:12 +0000 (15:18 +0200)] 
libcli/smb: convert smb2_lease_push() to PUSH_LE_U*

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
4 months agolibcli/smb: make the last 2 reserved bytes explicit in smb2_lease_push()
Stefan Metzmacher [Wed, 16 Apr 2025 13:18:12 +0000 (15:18 +0200)] 
libcli/smb: make the last 2 reserved bytes explicit in smb2_lease_push()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
4 months agolibcli/smb: convert smb2_lease_pull() to PULL_LE_U*
Stefan Metzmacher [Wed, 16 Apr 2025 13:18:12 +0000 (15:18 +0200)] 
libcli/smb: convert smb2_lease_pull() to PULL_LE_U*

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
4 months agos3:smbd: work around broken "vfs mkdir use tmp name" on FAT
Stefan Metzmacher [Wed, 16 Apr 2025 09:51:28 +0000 (11:51 +0200)] 
s3:smbd: work around broken "vfs mkdir use tmp name" on FAT

"vfs mkdir use tmp name" creates a name with ":" because the file should
be invisible for Windows clients. ":" however is an invalid character on
FAT filesystems and we get EINVAL back. In that case we fall back to not
using tmp names for mkdir.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
4 months agovfs: Fix "wide links = yes"
Volker Lendecke [Thu, 3 Apr 2025 08:04:42 +0000 (10:04 +0200)] 
vfs: Fix "wide links = yes"

vfs_wide_links hides symlinks from the rest of smbd, and it implicitly
follows symlinks. Also, O_PATH will expose symlinks to the rest of
smbd, remove that.

We also need to do this for posix paths, as deep inside
rename_internals we want to avoid case-insensitive lookups by setting
SMB_FILENAME_POSIX_PATH.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15841

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 16 20:56:33 UTC 2025 on atb-devel-224

4 months agolib:cmdline: POPT_CALLBACK_REASON_POST should handle if we skip the password callback
Andreas Schneider [Fri, 11 Apr 2025 08:56:43 +0000 (10:56 +0200)] 
lib:cmdline: POPT_CALLBACK_REASON_POST should handle if we skip the password callback

It is already checking if there is a valid ccache and disabling the callback.
In case of IAKerb we specify a ccache but might to fill one with a krbtgt.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Apr 15 12:54:57 UTC 2025 on atb-devel-224

4 months agolib:cmdline: Make sure --use-krb5-ccache sets the ccache
Andreas Schneider [Fri, 4 Apr 2025 08:27:50 +0000 (10:27 +0200)] 
lib:cmdline: Make sure --use-krb5-ccache sets the ccache

Pair-Programmed-With: Alexander Bokovoy <ab@samba.org>
Signed-off-by: Alexander Bokovoy <ab@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agoauth:creds: Do a kinit if we have a password and the ccache is empty
Andreas Schneider [Fri, 11 Apr 2025 11:49:22 +0000 (13:49 +0200)] 
auth:creds: Do a kinit if we have a password and the ccache is empty

This implements the same behaviour for s4 clients as we have with s3
clients.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 months agos3-wscript: make sure to build with selftest without libevent
Günther Deschner [Tue, 18 Mar 2025 13:41:46 +0000 (14:41 +0100)] 
s3-wscript: make sure to build with selftest without libevent

No need to stop running selftest in absence of libevent anymore.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Apr 11 19:47:24 UTC 2025 on atb-devel-224

4 months agos3-selftest: only run prometheus exporter tests when configured
Günther Deschner [Tue, 18 Mar 2025 13:41:08 +0000 (14:41 +0100)] 
s3-selftest: only run prometheus exporter tests when configured

Extract the configure info for building with prometheus exporter and
only run the blackbox test in case it is enabled.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agobuild: use '--with-prometheus-exporter' configure option
Shachar Sharon [Mon, 10 Mar 2025 12:23:01 +0000 (14:23 +0200)] 
build: use '--with-prometheus-exporter' configure option

Prefer '--with-prometheus-exporter' configure option over
'--with-libevent', which in turn, requires libevent.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agoselftest: Add test for smb_prometheus_endpoint utility
Shachar Sharon [Wed, 5 Feb 2025 14:20:10 +0000 (16:20 +0200)] 
selftest: Add test for smb_prometheus_endpoint utility

Basic test for smb_prometheus_endpoint utility. Requires valid metrics
output using 'curl'. Start/stop the endpoint utility from within the
test script itself.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agos3/smb_prometheus_endpoint: add authentication metrics
Ralph Boehme [Mon, 5 Feb 2024 17:19:31 +0000 (18:19 +0100)] 
s3/smb_prometheus_endpoint: add authentication metrics

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agosmbprofile: add authentication metrics
Ralph Boehme [Mon, 5 Feb 2024 17:04:57 +0000 (18:04 +0100)] 
smbprofile: add authentication metrics

"authentication" is the total number of requests and "authentication_failed" is
obviously the number of failed authentications.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agosmbprofile: SMB2-READ result NT_STATUS_END_OF_FILE is not an error
Ralph Boehme [Mon, 29 Jan 2024 15:33:41 +0000 (16:33 +0100)] 
smbprofile: SMB2-READ result NT_STATUS_END_OF_FILE is not an error

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agosmbprofile: Count failed requests
Volker Lendecke [Tue, 9 Jan 2024 15:12:20 +0000 (16:12 +0100)] 
smbprofile: Count failed requests

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agoutils: Initial version of smb_prometheus_endpoint
Volker Lendecke [Fri, 17 Nov 2023 14:15:13 +0000 (15:15 +0100)] 
utils: Initial version of smb_prometheus_endpoint

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agoprofile: Add number of sessions, tcons and files to smbstatus -P
Volker Lendecke [Wed, 22 Nov 2023 15:12:01 +0000 (16:12 +0100)] 
profile: Add number of sessions, tcons and files to smbstatus -P

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agoprofile: Add sessions, tcons and files to profile data
Volker Lendecke [Tue, 21 Nov 2023 12:34:03 +0000 (13:34 +0100)] 
profile: Add sessions, tcons and files to profile data

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agoprofile: Pass dummy smbd_server_connection to smbprofile_dump()
Volker Lendecke [Tue, 21 Nov 2023 11:34:02 +0000 (12:34 +0100)] 
profile: Pass dummy smbd_server_connection to smbprofile_dump()

It will need access to its fields soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agoprofile: Return number of workers from smbprofile_collect_tdb()
Volker Lendecke [Wed, 22 Nov 2023 14:11:09 +0000 (15:11 +0100)] 
profile: Return number of workers from smbprofile_collect_tdb()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agoprofile: Add time buckets to smbprofile_stats_iobytes
Volker Lendecke [Fri, 17 Nov 2023 14:14:33 +0000 (15:14 +0100)] 
profile: Add time buckets to smbprofile_stats_iobytes

Enable a histogram of time taken for smb2 requests. This puts all smb2
requests into buckets of <1, <2, <4, ... <256 msecs duration and
beyond.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agobuild: Detect libevent
Ralph Boehme [Thu, 16 Jan 2025 08:35:22 +0000 (09:35 +0100)] 
build: Detect libevent

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 months agotestprogs: Use 'sync machine password to keytab' for keytab creation
Andreas Schneider [Fri, 11 Apr 2025 07:32:30 +0000 (09:32 +0200)] 
testprogs: Use 'sync machine password to keytab' for keytab creation

We want to get rid of dedicatedkeytabfile for writing keytabs.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Apr 11 08:38:49 UTC 2025 on atb-devel-224

4 months agotestprogs: Remove dead code
Andreas Schneider [Fri, 11 Apr 2025 07:27:02 +0000 (09:27 +0200)] 
testprogs: Remove dead code

The test for this has been removed already, this is just leftover.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
4 months agodocs-xml: Document 'net ads keytab list'
Andreas Schneider [Thu, 10 Apr 2025 15:34:10 +0000 (17:34 +0200)] 
docs-xml: Document 'net ads keytab list'

Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
4 months agos3:net: 'net ads keytab list' should only list default keytab
Andreas Schneider [Thu, 10 Apr 2025 14:13:42 +0000 (16:13 +0200)] 
s3:net: 'net ads keytab list' should only list default keytab

If you don't specify a keytab, assume we just want the default keytab. This will
make upcoming changes to the code easier.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
4 months agos3:net: Remove `net ads keytab flush`
Andreas Schneider [Thu, 10 Apr 2025 14:07:46 +0000 (16:07 +0200)] 
s3:net: Remove `net ads keytab flush`

This removes all entries from a keytab *and* removes all SPNs from the AD
machine account. We should not do that and if you want to get rid of the keytab
you can use `rm`.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
4 months agosmbd: convert all fsp->fh->private_options to fsp_flags
Ralph Boehme [Fri, 28 Mar 2025 12:22:22 +0000 (13:22 +0100)] 
smbd: convert all fsp->fh->private_options to fsp_flags

Use fsp_apply_private_ntcreatex_flags() to store the private_flags as fsp_flags
and convert all users to check the fsp_flags.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Apr  9 14:39:26 UTC 2025 on atb-devel-224

4 months agosmbd: remove broken initial-delete-on-close logic from rename_internals_fsp()
Ralph Boehme [Fri, 28 Mar 2025 14:04:52 +0000 (15:04 +0100)] 
smbd: remove broken initial-delete-on-close logic from rename_internals_fsp()

fh_get_private_options() return private_flags, not create_options and thus can
never contain FILE_DELETE_ON_CLOSE.

Afaict fsp_flags.initial_delete_on_close is already correctly filled in
open_file_ntcreate():

        /* Handle strange delete on close create semantics. */
        if (create_options & FILE_DELETE_ON_CLOSE) {
                if (!new_file_created) {
                        status = can_set_delete_on_close(fsp,
                                         existing_dos_attributes);

                        if (!NT_STATUS_IS_OK(status)) {
                                /* Remember to delete the mode we just added. */
                                lck_state.cleanup_fn =
                                        open_ntcreate_lock_cleanup_entry;
                                goto unlock;
                        }
                }
                /* Note that here we set the *initial* delete on close flag,
                   not the regular one. The magic gets handled in close. */
                fsp->fsp_flags.initial_delete_on_close = true;
        }

so we can just remove the broken handling here.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agosmbd: add fsp_apply_private_ntcreatex_flags()
Ralph Boehme [Fri, 28 Mar 2025 12:10:13 +0000 (13:10 +0100)] 
smbd: add fsp_apply_private_ntcreatex_flags()

Not used yet, comes next.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agovfs: add fsp_flags ntcreatex_deny_[dos|fcb] and ntcreatex_stream_baseopen
Ralph Boehme [Thu, 27 Mar 2025 18:39:52 +0000 (19:39 +0100)] 
vfs: add fsp_flags ntcreatex_deny_[dos|fcb] and ntcreatex_stream_baseopen

Not used for now.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agosmbd: remove unused private_flags from open_file()
Ralph Boehme [Thu, 27 Mar 2025 17:42:22 +0000 (18:42 +0100)] 
smbd: remove unused private_flags from open_file()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3/locking: remove now unused private_options from share_mode_entry
Ralph Boehme [Mon, 17 Mar 2025 11:44:45 +0000 (12:44 +0100)] 
s3/locking: remove now unused private_options from share_mode_entry

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3/locking: store NTCREATEX_FLAG_DENY_[DOS|FCB] as share_entry_flags
Ralph Boehme [Mon, 17 Mar 2025 13:59:49 +0000 (14:59 +0100)] 
s3/locking: store NTCREATEX_FLAG_DENY_[DOS|FCB] as share_entry_flags

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3/locking: store NTCREATEX_FLAG_STREAM_BASEOPEN as share_entry_flag
Ralph Boehme [Mon, 17 Mar 2025 13:56:24 +0000 (14:56 +0100)] 
s3/locking: store NTCREATEX_FLAG_STREAM_BASEOPEN as share_entry_flag

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3/locking: add and use fsp_[get|apply]_share_entry_flags()
Ralph Boehme [Thu, 3 Apr 2025 20:01:09 +0000 (22:01 +0200)] 
s3/locking: add and use fsp_[get|apply]_share_entry_flags()

Prepares for converting private_options to flags.

Fixes Durable Handle reconnect of POSIX opens which weren't setting the fsp_flags
when reconnecting, so fsp_flags.posix_open wasn't set.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agos3/librpc: open_files.idl: move flag definition into open_files.idl
Ralph Boehme [Mon, 17 Mar 2025 11:20:02 +0000 (12:20 +0100)] 
s3/librpc: open_files.idl: move flag definition into open_files.idl

Nice to have everything in one place. No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agosmbd: rename SHARE_MODE_FLAG_POSIX_OPEN to SHARE_ENTRY_FLAG_POSIX_OPEN
Ralph Boehme [Mon, 17 Mar 2025 11:16:40 +0000 (12:16 +0100)] 
smbd: rename SHARE_MODE_FLAG_POSIX_OPEN to SHARE_ENTRY_FLAG_POSIX_OPEN

share_mode_data has flags and share_mode_entry has flags, this change allows
to distinguish between both more easily. No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 months agowinbindd: let update_trusted_domains_dc() also call pdb_filter_hints()
Stefan Metzmacher [Sat, 22 Mar 2025 00:03:26 +0000 (01:03 +0100)] 
winbindd: let update_trusted_domains_dc() also call pdb_filter_hints()

On an AD DC we need to update sam_domain->fti, so that
find_routing_from_namespace_noinit() uses the correct
uPNSuffixes and msDS-SPNSuffixes values for the local forest.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Apr  3 10:35:10 UTC 2025 on atb-devel-224

4 months agowinbindd: add find_local_sam_domain() helper
Stefan Metzmacher [Fri, 21 Mar 2025 16:38:35 +0000 (17:38 +0100)] 
winbindd: add find_local_sam_domain() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agowinbindd: pass for_netlogon to winbind_dual_SamLogon to avoid caching
Stefan Metzmacher [Fri, 21 Mar 2025 17:49:16 +0000 (18:49 +0100)] 
winbindd: pass for_netlogon to winbind_dual_SamLogon to avoid caching

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agos4:auth/ntlm: let auth_winbind pass WB_SAMLOGON_FOR_NETLOGON
Stefan Metzmacher [Fri, 21 Mar 2025 17:37:49 +0000 (18:37 +0100)] 
s4:auth/ntlm: let auth_winbind pass WB_SAMLOGON_FOR_NETLOGON

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agos4:auth: let auth_context_create_for_netlogon() remember for_netlogon = true;
Stefan Metzmacher [Fri, 21 Mar 2025 17:34:03 +0000 (18:34 +0100)] 
s4:auth: let auth_context_create_for_netlogon() remember for_netlogon = true;

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agos3:auth: let auth_winbind pass WBC_AUTH_PARAM_FLAGS_FOR_NETLOGON if needed
Stefan Metzmacher [Fri, 21 Mar 2025 16:08:24 +0000 (17:08 +0100)] 
s3:auth: let auth_winbind pass WBC_AUTH_PARAM_FLAGS_FOR_NETLOGON if needed

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agos3:auth: remember make_auth3_context_for_netlogon() was used
Stefan Metzmacher [Fri, 21 Mar 2025 16:04:05 +0000 (17:04 +0100)] 
s3:auth: remember make_auth3_context_for_netlogon() was used

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agowinbind.idl: add WB_SAMLOGON_FOR_NETLOGON
Stefan Metzmacher [Fri, 21 Mar 2025 17:36:02 +0000 (18:36 +0100)] 
winbind.idl: add WB_SAMLOGON_FOR_NETLOGON

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agolibwbclient: add WBC_AUTH_PARAM_FLAGS_FOR_NETLOGON to pass WBFLAG_PAM_FOR_NETLOGON
Stefan Metzmacher [Fri, 21 Mar 2025 17:19:34 +0000 (18:19 +0100)] 
libwbclient: add WBC_AUTH_PARAM_FLAGS_FOR_NETLOGON to pass WBFLAG_PAM_FOR_NETLOGON

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agowinbind_struct_protocol.h: add WBFLAG_PAM_FOR_NETLOGON
Stefan Metzmacher [Fri, 21 Mar 2025 16:06:26 +0000 (17:06 +0100)] 
winbind_struct_protocol.h: add WBFLAG_PAM_FOR_NETLOGON

This will be used when auth_winbind is used with
make_auth3_context_for_netlogon().

This will allow winbindd to use different rules
for LogonSamLogon requests compared to
local authentications for smbd.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agos4:librpc/idl: remove unused legacy copy of winbind.idl
Stefan Metzmacher [Fri, 21 Mar 2025 17:06:25 +0000 (18:06 +0100)] 
s4:librpc/idl: remove unused legacy copy of winbind.idl

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agoauth: let make_user_info_dc_pac() cross check PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID
Stefan Metzmacher [Wed, 12 Mar 2025 14:23:11 +0000 (15:23 +0100)] 
auth: let make_user_info_dc_pac() cross check PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID

If there's a mismatch someone doing strange things...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopython:tests/krb5: let _{get,modify}_tgt() also change the objectsid in UPN_DNS_INFO
Stefan Metzmacher [Wed, 12 Mar 2025 20:02:03 +0000 (21:02 +0100)] 
python:tests/krb5: let _{get,modify}_tgt() also change the objectsid in UPN_DNS_INFO

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopython:tests/krb5: allow set_pac_sids() to take upn_dns_sid
Stefan Metzmacher [Wed, 12 Mar 2025 14:42:58 +0000 (15:42 +0100)] 
python:tests/krb5: allow set_pac_sids() to take upn_dns_sid

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>