1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-26 01:49:31 +03:00

63095 Commits

Author SHA1 Message Date
737f4583ca libsmb: Save a few lines of ZERO_STRUCTP with SMB_CALLOC_ARRAY
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-15 14:03:34 +00:00
38be1103a4 vfs: Fix some whitespace
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-15 14:03:34 +00:00
8d5f03956e smbd: Replace talloc_zero() with a struct initialization
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-15 14:03:34 +00:00
f6695a5bb9 libsmb: Reduce indentation in SMB_open_ctx()
The "else" branch does not fall through to the opendir-retry. Best
reviewed with "git sh -b".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-15 14:03:34 +00:00
cdb9fa71db source3/wscript: Remove extra config WITH_PROMETHEUS_EXPORTER
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri May  9 12:04:16 UTC 2025 on atb-devel-224
2025-05-09 12:04:16 +00:00
b543aa99e2 source3/wscript: Configure prometheus exporter only with profiling
Prometheus endpoint is only built when profiling is enabled during
configure step. Therefore bail out early if this is not the case.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-05-09 11:03:37 +00:00
ea4dcbdc26 smbd: Simplify synthetic_smb_fname_split()
Remove the "posix_path" parameter, all callers just passed in "false".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri May  9 11:02:41 UTC 2025 on atb-devel-224
2025-05-09 11:02:41 +00:00
0bcd86c3db smbd: Handle the "posix" special case outside of synthetic_smb_fname_split
See next patch

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-09 09:59:32 +00:00
c312e6285b smbd: Remove the "posix_pathnames" global variable
This was only set from the smb1 trans2 call negotiating smb1 unix
extensions. This means for none of the callers in cmd_vfs and pysmbd
this could ever have been set to "true". The only real caller is
init_smb1_request(), and there we have the originating xconn with its
flags available for direct query.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-09 09:59:32 +00:00
95a2b50b19 vfs_ceph_snapshots: Always calculate absolute snapshot path
Use the same logic from shadow_copy2 module to always prepend the
connectpath to the relative snapshot path so as to return converted
path corresponding to the file's share root.

Please note that with the current working directory staying at the
connectpath level we are safe to prefix it to the smb_filename. In
other words it seems we never get past the connectpath internally
during normal file system operations via chdir(). Since all relative
paths are now based on dirfsp we could constitute absolute path by
prepending the connectpath to full_path_from_dirfsp_atname() output
ignoring the current working directory.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Apr 30 11:32:59 UTC 2025 on atb-devel-224
2025-04-30 11:32:59 +00:00
ad8b2dbb67 vfs_ceph_snapshots: Use full path from dirfsp at smb_fname
In ceph_snap_gmt_openat() we hand in the incoming smb_fname as it is
to ceph_snap_gmt_strip_snapshot() which is then passed on to derive
the actual snapshot path using ceph_snap_gmt_convert(). But this can
go wrong in ceph_snap_gmt_convert_dir() while opening the snapdir.
Unless we constitute the full path from dirfsp at the first place we
always end up opening the snapdir from the parent directory with
OpenDir().

For example with dirfsp("foobar") and smb_fname("shift.txt"), we open
snapdir from share root because parent is calculated as empty string
via ceph_snap_get_parent_path(). Instead we could construct the full
path from dirfsp using full_path_from_dirfsp_atname() to ensure we
don't open the wrong snapdir.

Since we have access to the twrp token at VFS layer it doesn't make
much sense to make use of ceph_snap_gmt_strip_snapshot() in openat.
We could instead directly act based on already available twrp token
avoiding an extra copy of incoming smb_filename.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: David Disseldorp ddiss@samba.org
2025-04-30 10:32:36 +00:00
50a958ff1d pysmbd: fix samba.tests.samba_tool.ntacl failure due to errno overwrite
some functions in source3/smbd/pysmbd.c when deleting stack frame
can modify errno. (and in one case causes failure with
test samba.tests.samba_tool.ntacl)

this is related to newer versions of lmdb (at least version 0.9.30)

[1(0)/1 at 20s] samba.tests.samba_tool.ntacl(ad_dc:local)
2025-04-23T16:18:23.341528+00:00 addc.addom.samba.example.com [13640]: set_nt_acl_conn: init_files_struct failed: NT_STATUS_OBJECT_NAME_NOT_FOUND
UNEXPECTED(failure): samba.tests.samba_tool.ntacl.samba.tests.samba_tool.ntacl.NtACLCmdGetSetTestCase.test_set_expect_file_not_found(ad_dc:local)
REASON: Exception: Exception: Traceback (most recent call last):
  File "/home/npower/samba-temp/bin/python/samba/tests/samba_tool/ntacl.py", line 142, in test_set_expect_file_not_found
    "No such file or directory expected")
AssertionError: 'No such file or directory' not found in "ERROR: Could not set acl for setExpectFileNotFound-a94c241d9550d581e51d: [Errno 11] Resource temporarily unavailable: 'setExpectFileNotFound-a94c241d9550d581e51d'\n" : No such file or directory expected
teardown_env(ad_dc)

This patch saves/sets errno explicitly before calling PyErr_SetFromErrno to
ensure the correct errno is used.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Apr 28 14:31:15 UTC 2025 on atb-devel-224
2025-04-28 14:31:15 +00:00
783ca9dc43 s3:rpc_server: make sure we can bind to the same port on all ip addresses
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15851

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2025-04-28 13:30:30 +00:00
5cab6a9be7 vfs_ceph_new: Enhance logging for improved debugging and code flow visibility (part 2)
This commit introduces significant enhancements to our logging system to
improve debugging capabilities and provide better visibility into the
code's execution flow. 

This is part 2 for logging improvement. There have already been some
logging improvements done in the past.

https://gitlab.com/samba-team/samba/-/merge_requests/3948

This commit includes following key changes.
Expanded a logging message
	1) Every function entry and exit point.
	2) Error Path / Error handling blocks.
	3) Key decision branches (if/else statements).
Consistent logging.
	1) Logging message to print either the file/dir name its
	   feasible.
	2) Standardized log message formatting to ensure consistency and
	   readability. This makes it easier to scan and understand log
	   output.

Impact
This enhancement will reduce the time required to diagnose and resolve
issues. It will provide valuable insights into the system's behavior,
enabling us to optimize performance and improve user experience.

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Apr 28 07:04:15 UTC 2025 on atb-devel-224
2025-04-28 07:04:15 +00:00
daea4ad9f4 s3:lib: map EPROTONOSUPPORT to NT_STATUS_PROTOCOL_NOT_SUPPORTED
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): Fri Apr 18 11:18:42 UTC 2025 on atb-devel-224
2025-04-18 11:18:42 +00:00
306c2838fb s3:libsmb: pass struct loadparm_context to smbsock_connect_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:30 +00:00
959640c33d s3:libsmb: pass struct loadparm_context to smbsock_connect()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:30 +00:00
290ed5e333 s3:libsmb: pass struct loadparm_context to smbsock_any_connect_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:30 +00:00
56f8352eb4 s3:libsmb: pass struct loadparm_context to smbsock_any_connect()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:30 +00:00
9f76585754 s3:libsmb: introduce smbsock_connect.h
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:30 +00:00
3e0d1478f4 s3:smbstatus: provide the transport type via json output
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:30 +00:00
10e4aa6a6d s3:smbd: store transport_type in smbXsrv_channel_global0
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:30 +00:00
307146f785 s3:smbd: expand scope of lp_ctx variable in main()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:30 +00:00
e6002830fc s3:libsmb: pass struct smb_transports to cli_full_connection_creds()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
ef21ac394d s3:libsmb: pass struct smb_transports to cli_full_connection_creds_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
36cdd086c3 s3:pylibsmb: add stackframe to py_cli_state_init()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
272fbb1c9c s3:libsmb: pass struct smb_transports to cli_cm_connect() and cli_cm_open()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
9dbe5499c5 s3:libsmb: pass struct smb_transports to do_connect()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
aa3e840baa s3:libsmb: pass struct smb_transports to SMBC_server_internal()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
d1147ddd01 s3:smbspool: pass struct smb_transports to smb_connect()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
3b52d73482 s3:smbspool: pass struct smb_transports to smb_complete_connection()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
7a3647fda8 s3:libsmb: pass struct smb_transports to cli_start_connection()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
18028beb9f s3:libsmb: pass struct smb_transports to cli_start_connection_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
425d3ce7b5 s3:libsmb: pass struct smb_transports to cli_connect_nb()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
0e6db83ff1 s3:libsmb: pass struct smb_transports to cli_connect_nb_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
3d3bef6196 s3:libsmb: pass struct smb_transports to cli_connect_sock_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
ffa72afa65 s3:libsmb: pass struct smb_transports to smbsock_any_connect()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
74d79a6bf6 s3:libsmb: pass struct smb_transports to smbsock_any_connect_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
d337404876 s3:libsmb: pass struct smb_transports to smbsock_connect()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
c39b11b482 s3:libsmb: pass struct smb_transports to smbsock_connect_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
d00755ca4b 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>
2025-04-18 10:17:29 +00:00
9725668d63 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>
2025-04-18 10:17:29 +00:00
6934c7ae40 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>
2025-04-18 10:17:29 +00:00
714409b49c 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>
2025-04-18 10:17:29 +00:00
6bbcf1114c 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>
2025-04-18 10:17:29 +00:00
681a637781 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>
2025-04-18 10:17:29 +00:00
ae85b9c878 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>
2025-04-18 10:17:29 +00:00
5fc5218257 s3:smbd: setup parent->transports from 'server smb transports'
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18 10:17:29 +00:00
6a835ec933 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>
2025-04-18 10:17:29 +00:00
da9cb65214 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>
2025-04-18 10:17:29 +00:00