]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 months agos3/locking: add a comment to share_mode_data_ltdb_store()
Ralph Boehme [Tue, 28 Jan 2025 05:45:29 +0000 (06:45 +0100)] 
s3/locking: add a comment to share_mode_data_ltdb_store()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Apr  2 19:03:50 UTC 2025 on atb-devel-224

4 months agos3/locking: add a comment to put_share_mode_lock_internal()
Ralph Boehme [Tue, 28 Jan 2025 05:20:53 +0000 (06:20 +0100)] 
s3/locking: add a comment to put_share_mode_lock_internal()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agos3/locking: simplify get_static_share_mode_data_fn()
Ralph Boehme [Tue, 28 Jan 2025 05:13:15 +0000 (06:13 +0100)] 
s3/locking: simplify get_static_share_mode_data_fn()

One if less and tighter coupling of logic. No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agos3/locking: locking_tdb_data_get() -> locking_tdb_data_parse()
Ralph Boehme [Tue, 28 Jan 2025 05:04:43 +0000 (06:04 +0100)] 
s3/locking: locking_tdb_data_get() -> locking_tdb_data_parse()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agos3/locking: parse_share_modes() -> parse_share_mode_data()
Ralph Boehme [Tue, 28 Jan 2025 04:52:59 +0000 (05:52 +0100)] 
s3/locking: parse_share_modes() -> parse_share_mode_data()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agos3:rpc_server/srvsvc: use brl_get_locks_readonly() instead of brl_get_locks()
Ralph Boehme [Tue, 28 Jan 2025 13:48:39 +0000 (14:48 +0100)] 
s3:rpc_server/srvsvc: use brl_get_locks_readonly() instead of brl_get_locks()

No need to keep the record locked longer then needed.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agosmbd: use share_mode_do_locked_brl() in vfs_default_durable_reconnect()
Ralph Boehme [Wed, 2 Apr 2025 12:52:03 +0000 (14:52 +0200)] 
smbd: use share_mode_do_locked_brl() in vfs_default_durable_reconnect()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agosmbd: use share_mode_do_locked_brl() in vfs_default_durable_disconnect()
Ralph Boehme [Tue, 28 Jan 2025 10:19:05 +0000 (11:19 +0100)] 
smbd: use share_mode_do_locked_brl() in vfs_default_durable_disconnect()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agosmbd: use share_mode_do_locked_brl() in strict_lock_check_default()
Ralph Boehme [Thu, 30 Jan 2025 06:40:32 +0000 (07:40 +0100)] 
smbd: use share_mode_do_locked_brl() in strict_lock_check_default()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agosmbd: check can_lock in strict_lock_check_default()
Ralph Boehme [Wed, 2 Apr 2025 10:43:15 +0000 (12:43 +0200)] 
smbd: check can_lock in strict_lock_check_default()

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 months agos3/locking: prepare brl_locktest() for upgradable read-only locks
Ralph Boehme [Thu, 30 Jan 2025 16:35:26 +0000 (17:35 +0100)] 
s3/locking: prepare brl_locktest() for upgradable read-only locks

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agosmbd: call locking_close_file() while still holding a glock on the locking.tdb record
Ralph Boehme [Mon, 27 Jan 2025 14:22:26 +0000 (15:22 +0100)] 
smbd: call locking_close_file() while still holding a glock on the locking.tdb record

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agos3/brlock: remove brl_get_locks_for_locking()
Stefan Metzmacher [Wed, 8 Jan 2025 11:51:37 +0000 (12:51 +0100)] 
s3/brlock: remove brl_get_locks_for_locking()

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

Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 months agosmbd: use share_mode_do_locked_brl()
Ralph Boehme [Wed, 29 Jan 2025 05:13:44 +0000 (06:13 +0100)] 
smbd: use share_mode_do_locked_brl()

Fix a deadlock that can happen if two clients happen to open and byte-range-lock
two different files whos record in locking.tdb and brlock.tdb happen to sit on
the same hashchain.

The deadlock was introduced by commit
680c7907325b433856ac1dd916ab63e671fbe4ab. Before, we used share_mode_do_locked()
in do_lock() which meant we acquired a chainlock on locking.tdb before getting a
chainlock on brlock.tdb via brl_get_locks_for_locking(), so the TDB chainlock
order invariant was always uphold.

The following race between specific client requests lead to the deadlock.

Client A) issues a byte-range-lock request on a file:

A1) glock locking.tdb (via _share_mode_do_locked_vfs_allowed())
A2) chainlock brlock.tdb (via brl_lock())
A3) attempt to chainlock locking.tdb (via share_mode_g_lock_dump())
[1]

Client B) opens a different (!) file:

B1) glock and chainlock locking.tdb (via _share_mode_entry_prepare_lock())
B2) attempt to chainlock brlock.tdb (via file_has_brlocks())
[2]

The glock from A1 is per record and hence doesn't synchronize with the glock
from B1 as it is for a different file and hence a different record, subsequently
A2 and A3 violate the lock order constraint

To avoid the chainlock lock order violation in the second client we modify the
br-lock code to not take the brlock.tdb chainlock from step A2 via
br_get_locks() for the whole time we process the request. Instead we just fetch
the br-locks via br_get_locks_readonly(), so when running into
contend_level2_oplocks_begin_default() to check for leases and looking into
locking.tdb we don't hold a brlock.tdb chainlock.

Or im simpler terms, we only ever take at most one low-level TDB chainlock at a
time:

Byte-range-lock code calls share_mode_do_locked_brl(..., cb_fn, ...):
1) chainlock locking.tdb
2) glock locking.tdb (via share_mode_do_locked_vfs_allowed())
3) chainunlock locking.tdb
4) share_mode_do_locked_brl_fn() -> brl_get_locks_readonly_parse():
   a) chainlock brlock.tdb
   b) parse record and store in-memory copy
   c) chainunlock brlock.tdb
5) run cb_fn()
6) chainlock brlock.tdb:
   a) br_lck->record = dbwrap_fetch_locked(brlock_db, ...)
   b) store modifed br_lck from 5) via byte_range_lock_flush()
7) chainunlock brlock.tdb
8) chainlock locking.tdb
9) gunlock locking.tdb
10) chainunlock locking.tdb

All access to brlock.tdb is synchronized correctly via glocks on the locking.tdb
record of the file (step 3)), so operations still appear atomic to clients.

As a result of using share_mode_do_locked_brl(), the functions do_[un]lock() ->
brl_[un]lock() now loop over the same br_lck object in memory, avoiding
repeatedly fetching and storing the locks per loop.

[1]
Full SBT:

  #0  0x00007fffa0cecbb0 in __pthread_mutex_lock_full () from /lib64/glibc-hwcaps/power9/libpthread-2.28.so
  #1  0x00007fffa0a73cf8 in chain_mutex_lock (m=<optimized out>, m@entry=0x7fff9ae071b0, waitflag=<optimized out>, waitflag@entry=true) at ../../lib/tdb/common/mutex.c:182
  #2  0x00007fffa0a7432c in tdb_mutex_lock (tdb=0x1543ba120, rw=<optimized out>, off=<optimized out>, len=<optimized out>, waitflag=<optimized out>, pret=0x7fffd7df3858) at ../../lib/tdb/common/mutex.c:234
  #3  0x00007fffa0a6812c in fcntl_lock (waitflag=<optimized out>, len=1, off=376608, rw=0, tdb=0x1543ba120) at ../../lib/tdb/common/lock.c:200
  #4  tdb_brlock (tdb=0x1543ba120, rw_type=<optimized out>, offset=<optimized out>, len=1, flags=<optimized out>) at ../../lib/tdb/common/lock.c:200
  #5  0x00007fffa0a68af8 in tdb_nest_lock (flags=<optimized out>, ltype=0, offset=<optimized out>, tdb=0x1543ba120) at ../../lib/tdb/common/lock.c:390
  #6  tdb_nest_lock (tdb=0x1543ba120, offset=<optimized out>, ltype=<optimized out>, flags=<optimized out>) at ../../lib/tdb/common/lock.c:336
  #7  0x00007fffa0a69088 in tdb_lock_list (tdb=0x1543ba120, list=<optimized out>, ltype=<optimized out>, waitflag=<optimized out>) at ../../lib/tdb/common/lock.c:482
  #8  0x00007fffa0a69198 in tdb_lock (tdb=0x1543ba120, list=<optimized out>, ltype=<optimized out>) at ../../lib/tdb/common/lock.c:500
  #9  0x00007fffa0a64b50 in tdb_find_lock_hash (tdb=<optimized out>, tdb@entry=0x1543ba120, key=..., hash=<optimized out>, locktype=<optimized out>, locktype@entry=0, rec=<optimized out>, rec@entry=0x7fffd7df3ab0) at ../../lib/tdb/common/tdb.c:165
  #10 0x00007fffa0a64ed0 in tdb_parse_record (tdb=0x1543ba120, key=..., parser=0x7fffa0e74470 <db_ctdb_ltdb_parser>, private_data=0x7fffd7df3b18) at ../../lib/tdb/common/tdb.c:329
  #11 0x00007fffa0e74cbc in db_ctdb_ltdb_parse (db=<optimized out>, private_data=0x7fffd7df3b70, parser=0x7fffa0e76470 <db_ctdb_parse_record_parser_nonpersistent>, key=...) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:170
  #12 db_ctdb_try_parse_local_record (ctx=ctx@entry=0x1543d4580, key=..., state=state@entry=0x7fffd7df3b70) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1385
  #13 0x00007fffa0e76024 in db_ctdb_parse_record (db=<optimized out>, key=..., parser=0x7fffa1313910 <dbwrap_watched_parse_record_parser>, private_data=0x7fffd7df3c08) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1425
  #14 0x00007fffa0884760 in dbwrap_parse_record (db=<optimized out>, key=..., parser=<optimized out>, private_data=<optimized out>) at ../../lib/dbwrap/dbwrap.c:454
  #15 0x00007fffa1313ab4 in dbwrap_watched_parse_record (db=0x1543a7160, key=..., parser=0x7fffa13187d0 <g_lock_dump_fn>, private_data=0x7fffd7df3ce8) at ../../source3/lib/dbwrap/dbwrap_watch.c:783
  #16 0x00007fffa0884760 in dbwrap_parse_record (db=<optimized out>, key=..., parser=<optimized out>, private_data=<optimized out>) at ../../lib/dbwrap/dbwrap.c:454
  #17 0x00007fffa131c004 in g_lock_dump (ctx=<error reading variable: value has been optimized out>, key=..., fn=0x7fffa14f3d70 <fsp_update_share_mode_flags_fn>, private_data=0x7fffd7df3dd8) at ../../source3/lib/g_lock.c:1653
  #18 0x00007fffa14f434c in share_mode_g_lock_dump (key=..., fn=0x7fffa14f3d70 <fsp_update_share_mode_flags_fn>, private_data=0x7fffd7df3dd8) at ../../source3/locking/share_mode_lock.c:96
  #19 0x00007fffa14f8d44 in fsp_update_share_mode_flags (fsp=0x15433c550) at ../../source3/locking/share_mode_lock.c:1181
  #20 file_has_read_lease (fsp=0x15433c550) at ../../source3/locking/share_mode_lock.c:1207
  #21 0x00007fffa15ccc98 in contend_level2_oplocks_begin_default (type=<optimized out>, fsp=0x15433c550) at ../../source3/smbd/smb2_oplock.c:1282
  #22 smbd_contend_level2_oplocks_begin (fsp=0x15433c550, type=<optimized out>) at ../../source3/smbd/smb2_oplock.c:1338
  #23 0x00007fffa0dd0b54 in contend_level2_oplocks_begin (fsp=<optimized out>, type=<optimized out>) at ../../source3/lib/smbd_shim.c:72
  #24 0x00007fffa14ecfd0 in brl_lock_windows_default (br_lck=0x154421330, plock=0x7fffd7df4250) at ../../source3/locking/brlock.c:457
  #25 0x00007fffa150b70c in vfswrap_brl_lock_windows (handle=<optimized out>, br_lck=<optimized out>, plock=<optimized out>) at ../../source3/modules/vfs_default.c:3424
  #26 0x00007fffa1561910 in smb_vfs_call_brl_lock_windows (handle=<optimized out>, br_lck=<optimized out>, plock=<optimized out>) at ../../source3/smbd/vfs.c:2686
  #27 0x00007fff9c0a7350 in smb_time_audit_brl_lock_windows (handle=<optimized out>, br_lck=0x154421330, plock=0x7fffd7df4250) at ../../source3/modules/vfs_time_audit.c:1740
  #28 0x00007fffa1561910 in smb_vfs_call_brl_lock_windows (handle=<optimized out>, br_lck=<optimized out>, plock=<optimized out>) at ../../source3/smbd/vfs.c:2686
  #29 0x00007fffa14ed410 in brl_lock (br_lck=0x154421330, smblctx=3102281601, pid=..., start=0, size=18446744073709551615, lock_type=<optimized out>, lock_flav=WINDOWS_LOCK, blocker_pid=0x7fffd7df4540, psmblctx=0x7fffd7df4558) at ../../source3/locking/brlock.c:1004
  #30 0x00007fffa14e7b18 in do_lock_fn (lck=<optimized out>, private_data=0x7fffd7df4508) at ../../source3/locking/locking.c:271
  #31 0x00007fffa14fcd94 in _share_mode_do_locked_vfs_allowed (id=..., fn=0x7fffa14e7a60 <do_lock_fn>, private_data=0x7fffd7df4508, location=<optimized out>) at ../../source3/locking/share_mode_lock.c:2927
  #32 0x00007fffa14e918c in do_lock (fsp=0x15433c550, req_mem_ctx=<optimized out>, req_guid=<optimized out>, smblctx=<optimized out>, count=18446744073709551615, offset=0, lock_type=<optimized out>, lock_flav=<optimized out>, pblocker_pid=0x7fffd7df46f0,
      psmblctx=0x7fffd7df46d8) at ../../source3/locking/locking.c:335
  #33 0x00007fffa155381c in smbd_do_locks_try (fsp=0x15433c550, num_locks=<optimized out>, locks=0x1543bc310, blocker_idx=0x7fffd7df46d6, blocking_pid=0x7fffd7df46f0, blocking_smblctx=0x7fffd7df46d8) at ../../source3/smbd/blocking.c:46
  #34 0x00007fffa159dc90 in smbd_smb2_lock_try (req=req@entry=0x1543bc080) at ../../source3/smbd/smb2_lock.c:590
  #35 0x00007fffa159ee8c in smbd_smb2_lock_send (in_locks=<optimized out>, in_lock_count=1, in_lock_sequence=<optimized out>, fsp=0x15433c550, smb2req=0x1543532e0, ev=0x154328120, mem_ctx=0x1543532e0) at ../../source3/smbd/smb2_lock.c:488
  #36 smbd_smb2_request_process_lock (req=0x1543532e0) at ../../source3/smbd/smb2_lock.c:150
  #37 0x00007fffa158a368 in smbd_smb2_request_dispatch (req=0x1543532e0) at ../../source3/smbd/smb2_server.c:3515
  #38 0x00007fffa158c540 in smbd_smb2_io_handler (fde_flags=<optimized out>, xconn=0x154313f30) at ../../source3/smbd/smb2_server.c:5112
  #39 smbd_smb2_connection_handler (ev=<optimized out>, fde=<optimized out>, flags=<optimized out>, private_data=<optimized out>) at ../../source3/smbd/smb2_server.c:5150
  #40 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x1543670f0, flags=<optimized out>, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #41 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4b28, epoll_ev=0x1543b4e80) at ../../lib/tevent/tevent_epoll.c:730
  #42 epoll_event_loop_once (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent_epoll.c:946
  #43 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:110
  #44 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent.c:823
  #45 0x00007fffa1197884 in tevent_common_loop_wait (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent.c:950
  #46 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:141
  #47 0x00007fffa1197978 in _tevent_loop_wait (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent.c:971
  #48 0x00007fffa15737fc in smbd_process (ev_ctx=0x154328120, msg_ctx=<optimized out>, sock_fd=<optimized out>, interactive=<optimized out>) at ../../source3/smbd/smb2_process.c:2158
  #49 0x000000011db5c554 in smbd_accept_connection (ev=0x154328120, fde=<optimized out>, flags=<optimized out>, private_data=<optimized out>) at ../../source3/smbd/server.c:1150
  #50 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x1543ac2d0, flags=<optimized out>, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #51 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4f98, epoll_ev=0x154328350) at ../../lib/tevent/tevent_epoll.c:730
  #52 epoll_event_loop_once (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent_epoll.c:946
  #53 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:110
  #54 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent.c:823
  #55 0x00007fffa1197884 in tevent_common_loop_wait (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent.c:950
  #56 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:141
  #57 0x00007fffa1197978 in _tevent_loop_wait (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent.c:971
  #58 0x000000011db58c54 in smbd_parent_loop (parent=<optimized out>, ev_ctx=0x154328120) at ../../source3/smbd/server.c:1499
  #59 main (argc=<optimized out>, argv=<optimized out>) at ../../source3/smbd/server.c:2258

[2]
Full SBT:

  #0  0x00007fffa0cecbb0 in __pthread_mutex_lock_full () from /lib64/glibc-hwcaps/power9/libpthread-2.28.so
  #1  0x00007fffa0a73cf8 in chain_mutex_lock (m=<optimized out>, m@entry=0x7fff9b3a71b0, waitflag=<optimized out>, waitflag@entry=true) at ../../lib/tdb/common/mutex.c:182
  #2  0x00007fffa0a7432c in tdb_mutex_lock (tdb=0x1543c6900, rw=<optimized out>, off=<optimized out>, len=<optimized out>, waitflag=<optimized out>, pret=0x7fffd7df2e28) at ../../lib/tdb/common/mutex.c:234
  #3  0x00007fffa0a6812c in fcntl_lock (waitflag=<optimized out>, len=1, off=376608, rw=0, tdb=0x1543c6900) at ../../lib/tdb/common/lock.c:200
  #4  tdb_brlock (tdb=0x1543c6900, rw_type=<optimized out>, offset=<optimized out>, len=1, flags=<optimized out>) at ../../lib/tdb/common/lock.c:200
  #5  0x00007fffa0a68af8 in tdb_nest_lock (flags=<optimized out>, ltype=0, offset=<optimized out>, tdb=0x1543c6900) at ../../lib/tdb/common/lock.c:390
  #6  tdb_nest_lock (tdb=0x1543c6900, offset=<optimized out>, ltype=<optimized out>, flags=<optimized out>) at ../../lib/tdb/common/lock.c:336
  #7  0x00007fffa0a69088 in tdb_lock_list (tdb=0x1543c6900, list=<optimized out>, ltype=<optimized out>, waitflag=<optimized out>) at ../../lib/tdb/common/lock.c:482
  #8  0x00007fffa0a69198 in tdb_lock (tdb=0x1543c6900, list=<optimized out>, ltype=<optimized out>) at ../../lib/tdb/common/lock.c:500
  #9  0x00007fffa0a64b50 in tdb_find_lock_hash (tdb=<optimized out>, tdb@entry=0x1543c6900, key=..., hash=<optimized out>, locktype=<optimized out>, locktype@entry=0, rec=<optimized out>, rec@entry=0x7fffd7df3080) at ../../lib/tdb/common/tdb.c:165
  #10 0x00007fffa0a64ed0 in tdb_parse_record (tdb=0x1543c6900, key=..., parser=0x7fffa0e74470 <db_ctdb_ltdb_parser>, private_data=0x7fffd7df30e8) at ../../lib/tdb/common/tdb.c:329
  #11 0x00007fffa0e74cbc in db_ctdb_ltdb_parse (db=<optimized out>, private_data=0x7fffd7df3140, parser=0x7fffa0e76470 <db_ctdb_parse_record_parser_nonpersistent>, key=...) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:170
  #12 db_ctdb_try_parse_local_record (ctx=ctx@entry=0x154328fc0, key=..., state=state@entry=0x7fffd7df3140) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1385
  #13 0x00007fffa0e76024 in db_ctdb_parse_record (db=<optimized out>, key=..., parser=0x7fffa14ec820 <brl_get_locks_readonly_parser>, private_data=0x7fffd7df3218) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1425
  #14 0x00007fffa0884760 in dbwrap_parse_record (db=<optimized out>, key=..., parser=<optimized out>, private_data=<optimized out>) at ../../lib/dbwrap/dbwrap.c:454
  #15 0x00007fffa14ef5bc in brl_get_locks_readonly (fsp=0x1543d01e0) at ../../source3/locking/brlock.c:1884
  #16 0x00007fffa1546968 in file_has_brlocks (fsp=0x1543d01e0) at ../../source3/smbd/open.c:2232
  #17 delay_for_oplock (pgranted=<synthetic pointer>, poplock_type=<synthetic pointer>, first_open_attempt=<optimized out>, create_disposition=1, have_sharing_violation=false, lck=0x7fffd7df3ce8, lease=0x0, oplock_request=0, fsp=0x1543d01e0) at ../../source3/smbd/open.c:2749
  #18 handle_share_mode_lease (pgranted=<synthetic pointer>, poplock_type=<synthetic pointer>, first_open_attempt=<optimized out>, lease=0x0, oplock_request=0, share_access=7, access_mask=131201, create_disposition=1, lck=0x7fffd7df3ce8, fsp=0x1543d01e0) at ../../source3/smbd/open.c:2865
  #19 check_and_store_share_mode (first_open_attempt=<optimized out>, lease=0x0, oplock_request=0, share_access=7, access_mask=131201, create_disposition=1, lck=0x7fffd7df3ce8, req=0x154414800, fsp=0x1543d01e0) at ../../source3/smbd/open.c:3333
  #20 open_ntcreate_lock_add_entry (lck=0x7fffd7df3ce8, keep_locked=0x7fffd7df3ad0, private_data=0x7fffd7df3cc8) at ../../source3/smbd/open.c:3688
  #21 0x00007fffa14f6248 in share_mode_entry_prepare_lock_fn (glck=0x7fffd7df35b8, cb_private=0x7fffd7df3a88) at ../../source3/locking/share_mode_lock.c:2978
  #22 0x00007fffa1317680 in g_lock_lock_cb_run_and_store (cb_state=cb_state@entry=0x7fffd7df35b8) at ../../source3/lib/g_lock.c:597
  #23 0x00007fffa1319df8 in g_lock_lock_simple_fn (rec=0x7fffd7df3798, value=..., private_data=0x7fffd7df39a0) at ../../source3/lib/g_lock.c:1212
  #24 0x00007fffa13160e0 in dbwrap_watched_do_locked_fn (backend_rec=<optimized out>, backend_value=..., private_data=0x7fffd7df3768) at ../../source3/lib/dbwrap/dbwrap_watch.c:458
  #25 0x00007fffa0884e48 in dbwrap_do_locked (db=<optimized out>, key=..., fn=0x7fffa1316080 <dbwrap_watched_do_locked_fn>, private_data=0x7fffd7df3768) at ../../lib/dbwrap/dbwrap.c:602
  #26 0x00007fffa1315274 in dbwrap_watched_do_locked (db=0x1543a7160, key=..., fn=0x7fffa1319ca0 <g_lock_lock_simple_fn>, private_data=0x7fffd7df39a0) at ../../source3/lib/dbwrap/dbwrap_watch.c:480
  #27 0x00007fffa0884d60 in dbwrap_do_locked (db=<optimized out>, key=..., fn=<optimized out>, private_data=<optimized out>) at ../../lib/dbwrap/dbwrap.c:582
  #28 0x00007fffa131b458 in g_lock_lock (ctx=0x1543cc630, key=..., type=<optimized out>, timeout=..., cb_fn=0x7fffa14f6190 <share_mode_entry_prepare_lock_fn>, cb_private=0x7fffd7df3a88) at ../../source3/lib/g_lock.c:1267
  #29 0x00007fffa14fd060 in _share_mode_entry_prepare_lock (prepare_state=0x7fffd7df3cc8, id=..., servicepath=<optimized out>, smb_fname=<optimized out>, old_write_time=<optimized out>, fn=<optimized out>, private_data=0x7fffd7df3cc8, location=0x7fffa165b880 "../../source3/smbd/open.c:4292") at ../../source3/locking/share_mode_lock.c:3033
  #30 0x00007fffa15491e0 in open_file_ntcreate (conn=conn@entry=0x154382050, req=req@entry=0x154414800, access_mask=<optimized out>, access_mask@entry=131201, share_access=share_access@entry=7, create_disposition=create_disposition@entry=1, create_options=create_options@entry=0, new_dos_attributes=<optimized out>, new_dos_attributes@entry=128, oplock_request=oplock_request@entry=0, lease=<optimized out>, lease@entry=0x0, private_flags=<optimized out>, private_flags@entry=0, parent_dir_fname=<optimized out>, smb_fname_atname=<optimized out>, pinfo=<optimized out>, pinfo@entry=0x7fffd7df3f1c, fsp=<optimized out>, fsp@entry=0x1543d01e0) at ../../source3/smbd/open.c:4286
  #31 0x00007fffa154b94c in create_file_unixpath (conn=conn@entry=0x154382050, req=req@entry=0x154414800, dirfsp=dirfsp@entry=0x15439a7f0, smb_fname=smb_fname@entry=0x154416300, access_mask=access_mask@entry=131201, share_access=share_access@entry=7, create_disposition=create_disposition@entry=1, create_options=create_options@entry=0, file_attributes=file_attributes@entry=128, oplock_request=<optimized out>, oplock_request@entry=0, lease=<optimized out>, lease@entry=0x0, allocation_size=allocation_size@entry=0, private_flags=private_flags@entry=0, sd=sd@entry=0x0, ea_list=ea_list@entry=0x0, result=result@entry=0x7fffd7df4168, pinfo=pinfo@entry=0x7fffd7df4160) at ../../source3/smbd/open.c:6290
  #32 0x00007fffa154dfac in create_file_default (conn=0x154382050, req=0x154414800, dirfsp=0x15439a7f0, smb_fname=0x154416300, access_mask=<optimized out>, share_access=<optimized out>, create_disposition=<optimized out>, create_options=<optimized out>, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/smbd/open.c:6609
  #33 0x00007fffa150972c in vfswrap_create_file (handle=<optimized out>, req=<optimized out>, dirfsp=<optimized out>, smb_fname=<optimized out>, access_mask=<optimized out>, share_access=<optimized out>, create_disposition=<optimized out>, create_options=<optimized out>, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/modules/vfs_default.c:776
  #34 0x00007fffa1559cbc in smb_vfs_call_create_file (handle=<optimized out>, req=<optimized out>, dirfsp=<optimized out>, smb_fname=<optimized out>, access_mask=<optimized out>, share_access=<optimized out>, create_disposition=<optimized out>, create_options=<optimized out>, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/smbd/vfs.c:1560
  #35 0x00007fff9c0a9ec4 in smb_time_audit_create_file (handle=0x154426820, req=0x154414800, dirfsp=0x15439a7f0, fname=0x154416300, access_mask=<optimized out>, share_access=<optimized out>, create_disposition=<optimized out>, create_options=<optimized out>, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result_fsp=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/modules/vfs_time_audit.c:634
  #36 0x00007fffa1559cbc in smb_vfs_call_create_file (handle=<optimized out>, req=<optimized out>, dirfsp=<optimized out>, smb_fname=<optimized out>, access_mask=<optimized out>, share_access=<optimized out>, create_disposition=<optimized out>, create_options=<optimized out>, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/smbd/vfs.c:1560
  #37 0x00007fffa1597aa8 in smbd_smb2_create_send (in_context_blobs=..., in_name=0x154413ca0, in_create_options=<optimized out>, in_create_disposition=<optimized out>, in_share_access=<optimized out>, in_file_attributes=<optimized out>, in_desired_access=<optimized out>, in_impersonation_level=<optimized out>, in_oplock_level=<optimized out>, smb2req=0x154413770, ev=0x154328120, mem_ctx=0x154413770) at ../../source3/smbd/smb2_create.c:1115
  #38 smbd_smb2_request_process_create (smb2req=0x154413770) at ../../source3/smbd/smb2_create.c:291
  #39 0x00007fffa158a628 in smbd_smb2_request_dispatch (req=0x154413770) at ../../source3/smbd/smb2_server.c:3485
  #40 0x00007fffa158c540 in smbd_smb2_io_handler (fde_flags=<optimized out>, xconn=0x154313f30) at ../../source3/smbd/smb2_server.c:5112
  #41 smbd_smb2_connection_handler (ev=<optimized out>, fde=<optimized out>, flags=<optimized out>, private_data=<optimized out>) at ../../source3/smbd/smb2_server.c:5150
  #42 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x15435add0, flags=<optimized out>, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #43 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4b28, epoll_ev=0x1543b4e80) at ../../lib/tevent/tevent_epoll.c:730
  #44 epoll_event_loop_once (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent_epoll.c:946
  #45 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:110
  #46 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent.c:823
  #47 0x00007fffa1197884 in tevent_common_loop_wait (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent.c:950
  #48 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:141
  #49 0x00007fffa1197978 in _tevent_loop_wait (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent.c:971
  #50 0x00007fffa15737fc in smbd_process (ev_ctx=0x154328120, msg_ctx=<optimized out>, sock_fd=<optimized out>, interactive=<optimized out>) at ../../source3/smbd/smb2_process.c:2158
  #51 0x000000011db5c554 in smbd_accept_connection (ev=0x154328120, fde=<optimized out>, flags=<optimized out>, private_data=<optimized out>) at ../../source3/smbd/server.c:1150
  #52 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x1543ac2d0, flags=<optimized out>, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #53 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4f98, epoll_ev=0x154328350) at ../../lib/tevent/tevent_epoll.c:730
  #54 epoll_event_loop_once (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent_epoll.c:946
  #55 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:110
  #56 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent.c:823
  #57 0x00007fffa1197884 in tevent_common_loop_wait (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent.c:950
  #58 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:141
  #59 0x00007fffa1197978 in _tevent_loop_wait (ev=<optimized out>, location=<optimized out>) at ../../lib/tevent/tevent.c:971
  #60 0x000000011db58c54 in smbd_parent_loop (parent=<optimized out>, ev_ctx=0x154328120) at ../../source3/smbd/server.c:1499
  #61 main (argc=<optimized out>, argv=<optimized out>) at ../../source3/smbd/server.c:2258

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 months agos3/locking: add brl_set_modified()
Ralph Boehme [Wed, 29 Jan 2025 05:13:29 +0000 (06:13 +0100)] 
s3/locking: add brl_set_modified()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agos3/brlock: don't increment current_lock_count if do_lock_fn() failed
Ralph Boehme [Wed, 8 Jan 2025 14:43:04 +0000 (15:43 +0100)] 
s3/brlock: don't increment current_lock_count if do_lock_fn() failed

Also only assign psmblctx and pblocker_pid if the lock request failed.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agos3/brlock: add share_mode_do_locked_brl()
Ralph Boehme [Sat, 1 Feb 2025 09:37:40 +0000 (10:37 +0100)] 
s3/brlock: add share_mode_do_locked_brl()

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 months agos3/brlock: add brl_req_set()
Stefan Metzmacher [Mon, 6 Jan 2025 16:07:11 +0000 (17:07 +0100)] 
s3/brlock: add brl_req_set()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agos3/brlock: split out brl_get_locks_readonly_parse()
Stefan Metzmacher [Mon, 6 Jan 2025 14:59:27 +0000 (15:59 +0100)] 
s3/brlock: split out brl_get_locks_readonly_parse()

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

Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 months agosmbtorture: add test "open-brlock-deadlock"
Ralph Boehme [Thu, 9 Jan 2025 11:27:43 +0000 (12:27 +0100)] 
smbtorture: add test "open-brlock-deadlock"

smbtorture reproducer for bug 15767. As it needs a very specific setup that
can't easily be done in selftest, the test is only executed when manually called
with

  --option=torture:open_brlock_deadlock_timemout=SEC

To prepare the setup for the test set:

  tdb_hash_size:locking.tdb = 1
  tdb_hash_size:brlock.tdb = 1

and remove both tdb from disk which is needed so the TDBs get recreated with the
new hash_size.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agodbwrap: check for option "tdb_hash_size:DBNAME.tdb" in db_open()
Ralph Boehme [Thu, 9 Jan 2025 07:57:17 +0000 (08:57 +0100)] 
dbwrap: check for option "tdb_hash_size:DBNAME.tdb" in db_open()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agos3: Fix use of dbwrap_transaction_cancel() in machine_account_secrets.c
Pavel Filipenský [Thu, 20 Feb 2025 19:33:19 +0000 (20:33 +0100)] 
s3: Fix use of dbwrap_transaction_cancel() in machine_account_secrets.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Mar 29 19:02:35 UTC 2025 on atb-devel-224

4 months agopylibsmb: avoid unnecessary check of sid/gid counts
Douglas Bagnall [Thu, 6 Mar 2025 23:01:14 +0000 (12:01 +1300)] 
pylibsmb: avoid unnecessary check of sid/gid counts

This causes compiler conniptions because the check is tautologically
false with 64 bit size_t, while a 32 bit ssize_t that wraps to a
negative number is rejected by PyList_New(). Besides which, out of
bounds access is blocked by PyList_SetItem(), and talloc won't create
arrays that large.

The trouble is picky compilers can say things like:

../../source3/libsmb/pylibsmb.c: In function ‘py_smb_posix_whoami’:
../../source3/libsmb/pylibsmb.c:2226:22: warning: comparison is always
false due to limited range of data type [-Wtype-limits]
 2226 |         if (num_gids > PY_SSIZE_T_MAX) {

 which draws endless but useless developer attention.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agoldb_tdb: wrap can cope with NULL path
Douglas Bagnall [Wed, 27 Nov 2024 20:33:16 +0000 (09:33 +1300)] 
ldb_tdb: wrap can cope with NULL path

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopython:join: do not suppress unexpected DNS enum errors
Douglas Bagnall [Fri, 9 Aug 2024 22:37:24 +0000 (10:37 +1200)] 
python:join: do not suppress unexpected DNS enum errors

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopyldb: consistent results in py_ldb_msg_richcmp
Douglas Bagnall [Mon, 24 Jun 2024 11:02:45 +0000 (23:02 +1200)] 
pyldb: consistent results in py_ldb_msg_richcmp

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agodsdb:group_audit: log_membership_changes: match doxygen to code
Douglas Bagnall [Tue, 17 Jan 2023 21:13:23 +0000 (10:13 +1300)] 
dsdb:group_audit: log_membership_changes: match doxygen to code

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agolib/compression: add a windows python script for test vectors
Douglas Bagnall [Fri, 23 Dec 2022 08:36:26 +0000 (21:36 +1300)] 
lib/compression: add a windows python script for test vectors

The C program we have (generate-windows-test-vectors.c) uses a higher
level API than MS-XCA refers to, which plays tricks like refusing to
do compression if the result would be larger than the original. It
does that because I could not successfully compile something using the
correct RtlCompressBuffer API in Cygwin.

It turns out you don't need to compile anything; using the Python
ctypes library, the Windows libraries are available to Python.

The compression *is* the same, which is what we expected.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agos4/dns/dlz: log when falling back to obsolete dns ldb path
Douglas Bagnall [Fri, 20 Jan 2023 00:07:43 +0000 (13:07 +1300)] 
s4/dns/dlz: log when falling back to obsolete dns ldb path

Prior to 4.8 or so, the dlz dns files were kept in samba/private, but
sharing those files is a bit less than private so a new bind-dns
directory was added. As part of that patch set efforts were made to
fallback gracefully to the old locations. But now that silent grace is
causing confusion; the time has come to fallback resentfully.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months ago.github: CodeQL triggers on current branches
Douglas Bagnall [Fri, 14 Mar 2025 03:53:42 +0000 (16:53 +1300)] 
.github: CodeQL triggers on current branches

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Mar 29 12:38:10 UTC 2025 on atb-devel-224

4 months ago.gitlab: CodeQL runner runs a bootstrap.sh
Douglas Bagnall [Fri, 14 Mar 2025 03:45:18 +0000 (16:45 +1300)] 
.gitlab: CodeQL runner runs a bootstrap.sh

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 months ago.github: add CodeQL workflow
Douglas Bagnall [Fri, 14 Mar 2025 03:21:41 +0000 (16:21 +1300)] 
.github: add CodeQL workflow

This is the automatically generated config file for CodeQL, a code
query language, which can be used to run bespoke static analysis
tasks.

It is currently set to "autobuild" mode, which in Github's terminology
means it tries `./configure && make`, which fails because configure
looks for packages that aren't installed.

In another commit or two we'll add the necessary bootstrap lines, and
perhaps remove some of the unneeded bits.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 months agoctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn"
Martin Schwenke [Fri, 14 Mar 2025 06:28:43 +0000 (17:28 +1100)] 
ctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn"

Best reviewed with "git show -w".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agoctdb-scripts: Add ctdb_diagnostics -l option
yogita72 [Tue, 11 Mar 2025 23:55:19 +0000 (23:55 +0000)] 
ctdb-scripts: Add ctdb_diagnostics -l option

Allows ctdb_diagnostics to be run on the local node without onnode.

Signed-off-by: yogita72 <yogita.bijani@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agosamba-tool backup restore: cope with no sysvol
Douglas Bagnall [Wed, 26 Mar 2025 02:55:33 +0000 (15:55 +1300)] 
samba-tool backup restore: cope with no sysvol

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15661
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Mar 29 08:25:39 UTC 2025 on atb-devel-224

4 months agosamba-tool testparm: avoid lowering debug level
Douglas Bagnall [Wed, 19 Mar 2025 00:53:37 +0000 (13:53 +1300)] 
samba-tool testparm: avoid lowering debug level

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agosamba-tool testparm: drop unsupported options
Douglas Bagnall [Wed, 19 Mar 2025 00:52:34 +0000 (13:52 +1300)] 
samba-tool testparm: drop unsupported options

These have been useless since 2011.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agosamba-tool gpo: use a real XML parser to check entity validity
Douglas Bagnall [Wed, 19 Mar 2025 00:16:12 +0000 (13:16 +1300)] 
samba-tool gpo: use a real XML parser to check entity validity

The expat parser comes with the Python standard library, so we can use
it to check the entities work, rather than relying on a fragile
regular expression.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agosamba-tool gpo: separate function for dtd header generation
Douglas Bagnall [Tue, 18 Mar 2025 23:50:31 +0000 (12:50 +1300)] 
samba-tool gpo: separate function for dtd header generation

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopytest: source_tree_topdir() checks more thoroughly
Douglas Bagnall [Thu, 20 Mar 2025 03:43:41 +0000 (16:43 +1300)] 
pytest: source_tree_topdir() checks more thoroughly

We are more certain of how many ../ steps we are from top than we are
that the existence of a thing called 'source4' is a definite sign
that this is a full source tree. So we check fewer depths and more
subdirectories.

This also modernises the return type to be a pathlib.Path, which works
without change for current callers.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopython: make source_tree_topdir() test-only
Douglas Bagnall [Tue, 18 Mar 2025 23:04:26 +0000 (12:04 +1300)] 
python: make source_tree_topdir() test-only

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopython: remove unused in_source_tree() function
Douglas Bagnall [Tue, 18 Mar 2025 23:00:02 +0000 (12:00 +1300)] 
python: remove unused in_source_tree() function

We don't use it and don't want non-tests changing their behaviour
based on this kind of thing anyway.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agovfs: Fix Bug 15791, vfs_acl_tdb unlinkat()
Volker Lendecke [Tue, 28 Jan 2025 13:03:49 +0000 (14:03 +0100)] 
vfs: Fix Bug 15791, vfs_acl_tdb unlinkat()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15791
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agovfs: Fix a lock order violation in unlinkat_acl_tdb()
Volker Lendecke [Wed, 26 Feb 2025 15:04:01 +0000 (16:04 +0100)] 
vfs: Fix a lock order violation in unlinkat_acl_tdb()

unlinkat is called when the share mode record is locked.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15791
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agovfs_vxfs: pathref fixes
Saurabh Singh [Wed, 12 Mar 2025 09:18:07 +0000 (14:48 +0530)] 
vfs_vxfs: pathref fixes

These fixes are required as after the pathref changes done in vxfs code, set
and get attribute was not working. fsp_get_io_fd(fsp) was returing -1 always.

Signed-off-by: Saurabh Singh <saurabh.singh@veritas.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Mar 28 09:02:10 UTC 2025 on atb-devel-224

4 months agosmbd: fix handling of directory leases and oplock levels
Ralph Boehme [Sat, 22 Mar 2025 15:59:07 +0000 (16:59 +0100)] 
smbd: fix handling of directory leases and oplock levels

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Mar 28 07:53:25 UTC 2025 on atb-devel-224

4 months agosmbtorture: add test smb2.dirlease.oplocks
Ralph Boehme [Sat, 22 Mar 2025 15:57:13 +0000 (16:57 +0100)] 
smbtorture: add test smb2.dirlease.oplocks

Verifies server correctly ignores oplock on directories and only grants leases.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agolib: Slightly simplify ad_alloc()
Volker Lendecke [Tue, 25 Feb 2025 16:31:16 +0000 (17:31 +0100)] 
lib: Slightly simplify ad_alloc()

Use a struct initialization to avoid talloc_zero()

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

4 months agolib: Simplify ad_alloc()
Volker Lendecke [Tue, 25 Feb 2025 16:27:20 +0000 (17:27 +0100)] 
lib: Simplify ad_alloc()

I don't see how "adsize" can be 0 here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agotevent: Fix some whitespace
Volker Lendecke [Sat, 22 Feb 2025 07:12:06 +0000 (08:12 +0100)] 
tevent: Fix some whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Remove some dead code from ad_init()
Volker Lendecke [Tue, 25 Feb 2025 16:35:53 +0000 (17:35 +0100)] 
lib: Remove some dead code from ad_init()

"rc" was never set to anything but 0.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agotevent: Fix some whitespace
Volker Lendecke [Mon, 10 Mar 2025 19:35:59 +0000 (20:35 +0100)] 
tevent: Fix some whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolibcli: Fix whitespace
Volker Lendecke [Tue, 11 Mar 2025 07:30:37 +0000 (08:30 +0100)] 
libcli: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agoloadparm: move log message to a higher log level
Bjoern Jacke [Mon, 10 Mar 2025 10:53:38 +0000 (10:53 +0000)] 
loadparm: move log message to a higher log level

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agoreplace: fix hex_upper -> hexchars_upper
Bjoern Jacke [Thu, 20 Feb 2025 16:14:54 +0000 (16:14 +0000)] 
replace: fix hex_upper -> hexchars_upper

It seems we don't have many systems without a working snprintf anymore...

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Implement snapper_gmt_fstatat()
Volker Lendecke [Fri, 24 Jan 2025 15:37:42 +0000 (16:37 +0100)] 
vfs: Implement snapper_gmt_fstatat()

Make snapper_gmt_stat() and snapper_gmt_lstat() use that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Implement dfq_fstatat()
Volker Lendecke [Tue, 28 Jan 2025 17:38:18 +0000 (18:38 +0100)] 
vfs: Implement dfq_fstatat()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Implement catia_fstatat()
Volker Lendecke [Tue, 28 Jan 2025 11:44:05 +0000 (12:44 +0100)] 
vfs: Implement catia_fstatat()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Implement cap_fstatat()
Volker Lendecke [Tue, 28 Jan 2025 04:58:24 +0000 (05:58 +0100)] 
vfs: Implement cap_fstatat()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Fix typos.
Volker Lendecke [Thu, 20 Mar 2025 17:42:37 +0000 (18:42 +0100)] 
vfs: Fix typos.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Fix whitespace
Volker Lendecke [Thu, 20 Mar 2025 17:38:54 +0000 (18:38 +0100)] 
vfs: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agonet: Remove a call to SMB_VFS_STAT and dirfsp==NULL in create_file
Volker Lendecke [Thu, 20 Mar 2025 16:59:55 +0000 (17:59 +0100)] 
net: Remove a call to SMB_VFS_STAT and dirfsp==NULL in create_file

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months 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: Anoop C S <anoopcs@samba.org>
4 months agolib: Pass "dirfsp" to ad_collect_one_stream()
Volker Lendecke [Thu, 20 Mar 2025 08:47:15 +0000 (09:47 +0100)] 
lib: Pass "dirfsp" to ad_collect_one_stream()

Avoid a call to SMB_VFS_CREATE_FILE with dirfsp==NULL

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Use dirfsp/relname in ad_unconvert()
Volker Lendecke [Thu, 20 Mar 2025 08:32:39 +0000 (09:32 +0100)] 
lib: Use dirfsp/relname in ad_unconvert()

Replace a call to SMB_VFS_STAT with SMB_VFS_FSTATAT, avoid a call to
SMB_VFS_CREATE_FILE with "dirfsp == NULL".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Add adouble_name()
Volker Lendecke [Thu, 20 Mar 2025 08:30:39 +0000 (09:30 +0100)] 
lib: Add adouble_name()

Just prepend "._" to a relname.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Avoid a VFS_STAT call in "net vfs stream2adouble"
Volker Lendecke [Wed, 19 Mar 2025 16:45:59 +0000 (17:45 +0100)] 
lib: Avoid a VFS_STAT call in "net vfs stream2adouble"

Call filename_convert_dirfsp() in ad_unconvert, which takes care of
proper symlink redirects. This will be used more in further patches.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Convert ad_unconvert() to NTSTATUS
Volker Lendecke [Wed, 19 Mar 2025 16:29:40 +0000 (17:29 +0100)] 
lib: Convert ad_unconvert() to NTSTATUS

Drop error information later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Convert ad_collect_one_stream() to NTSTATUS
Volker Lendecke [Wed, 19 Mar 2025 16:11:49 +0000 (17:11 +0100)] 
lib: Convert ad_collect_one_stream() to NTSTATUS

Drop error information later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Convert ad_unconvert_open_ad() to NTSTATUS
Volker Lendecke [Wed, 19 Mar 2025 16:09:58 +0000 (17:09 +0100)] 
lib: Convert ad_unconvert_open_ad() to NTSTATUS

Drop error information later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Convert ad_unconvert_get_streams() to NTSTATUS
Volker Lendecke [Wed, 19 Mar 2025 14:49:21 +0000 (15:49 +0100)] 
lib: Convert ad_unconvert_get_streams() to NTSTATUS

Drop error information later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agosmbd: implement modern write time update logic
Ralph Boehme [Mon, 10 Mar 2025 15:31:13 +0000 (16:31 +0100)] 
smbd: implement modern write time update logic

The gist of this is:

1. A write or other modifications as per MS-FSA "2.1.4.17 Algorithm for Noting
that a File Has Been Modified" immediately update the file times, there's no
delayed update.

2. Setting a timestamp on a handle only disables further timestamp updates via
that handle. Modifications via other handles must still update the timestamps.

This can not be implemented by storing the sticky writetime in the
share_mode_data record for performance reasons, as from 2 it follows that the
record would have to be checked and updated for every write on all handles.

Instead, writes on handles with sticky writetime in effect, record the current
timestamp before the modification and reset the filesystem timestamp to the
recorded value after doing the modification.

For reference, these are the relevant pieces from MS-FSA:

2.1.1.6 Abstract Date Model: Per Open

- UserSetModificationTime: A Boolean that is TRUE if a user has explicitly set
File.LastModificationTime through this Open.

- UserSetChangeTime: A Boolean that is TRUE if a user has explicitly set
File.LastChangeTime through this Open.

- UserSetAccessTime: A Boolean that is TRUE if a user has explicitly set
File.LastAccessTime through this Open.

2.1.4.17 Algorithm for Noting That a File Has Been Modified

The inputs for this algorithm are as follows:
- Open: The Open through which the file was modified.

The pseudocode for the algorithm is as follows:

The object store SHOULD<43>:

- If Open.UserSetModificationTime is FALSE, set Open.File.LastModificationTime
to the current system time.

- If Open.UserSetChangeTime is FALSE, set Open.File.LastChangeTime to the
current system time.

- If Open.UserSetAccessTime is FALSE, set Open.File.LastAccessTime to the
current system time.

- Set Open.File.FileAttributes.FILE_ATTRIBUTE_ARCHIVE to TRUE.

This then gets used for eg writes:

2.1.5.4 Server Requests a Write

...

- The object store MUST note that the file has been modified as specified in
section 2.1.4.17 with Open equal to Open.

...

Note the following differences between Windows behaviour and current
MS-FSA, these are documentation bugs that will be fixed in later
releases as discussed here:

https://lists.samba.org/archive/cifs-protocol/2025-March/004453.html

* When processing FileEndOfFileInformation timestamps must be updated
if new size equals current size

* When processing FileAllocationInformation timestamps must be updated
if new size equals current size

* When processing FileAllocationInformation,
  If (the new allocation size is less than the existing allocation)
    Set the modification time (which will also updates the change time)
  Else
    Update the LastChangeTime

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Mar 27 06:37:31 UTC 2025 on atb-devel-224

4 months agosmbtorture: add "smb2.timestamps.modern_write_time_update-2"
Ralph Boehme [Mon, 10 Mar 2025 18:03:42 +0000 (19:03 +0100)] 
smbtorture: add "smb2.timestamps.modern_write_time_update-2"

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: add "smb2.timestamps.modern_write_time_update-1"
Ralph Boehme [Mon, 3 Mar 2025 15:36:24 +0000 (16:36 +0100)] 
smbtorture: add "smb2.timestamps.modern_write_time_update-1"

This checks for modern Windows timestamp update behaviour over
SMB2. Same as "base.delaywrite.modern_write_time_update-1" but for
SMB2.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: add "base.delaywrite.modern_write_time_update-1"
Ralph Boehme [Thu, 6 Mar 2025 11:01:20 +0000 (12:01 +0100)] 
smbtorture: add "base.delaywrite.modern_write_time_update-1"

The test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "smb2.timestamps.delayed-2write" for modern SMB delayed write
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "smb2.timestamps.delayed-2write" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "smb2.timestamps.delayed-write-vs-setbasic" for modern SMB delayed...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "smb2.timestamps.delayed-write-vs-setbasic" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "smb2.timestamps.delayed-write-vs-flush" for modern SMB delayed...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "smb2.timestamps.delayed-write-vs-flush" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "smb2.timestamps.delayed-write-vs-seteof" for modern SMB delayed...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "smb2.timestamps.delayed-write-vs-seteof" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 6" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 6" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 5b" for modern SMB...
Ralph Boehme [Thu, 6 Mar 2025 17:48:59 +0000 (18:48 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 5b" for modern SMB delayed write

No need to run the loops for so long with modern write time behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 5" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 5" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 4" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 4" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 3c" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 3c" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 3b" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 3b" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 3a" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 3a" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 3" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 3" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time using 2 connections...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time using 2 connections" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.update of write time using SET_ALLOCATION_SIZE...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.update of write time using SET_ALLOCATION_SIZE" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.update of write time using SET_END_OF_FILE" for...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.update of write time using SET_END_OF_FILE" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.update of write time and SMBwrite truncate expand...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.update of write time and SMBwrite truncate expand" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.update of write time and SMBwrite truncate" for...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.update of write time and SMBwrite truncate" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.finfo update on close" for modern SMB delayed...
Ralph Boehme [Mon, 3 Mar 2025 20:19:55 +0000 (21:19 +0100)] 
smbtorture: adjust "base.delaywrite.finfo update on close" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: change variable name in SET_INFO_FILE_EX macro
Ralph Boehme [Mon, 10 Mar 2025 15:18:30 +0000 (16:18 +0100)] 
smbtorture: change variable name in SET_INFO_FILE_EX macro

Allows using the variable name sfinfo in functions that use the macro. No change
in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: whitespace in test_delayed_write_update2()
Ralph Boehme [Wed, 5 Mar 2025 05:09:40 +0000 (06:09 +0100)] 
smbtorture: whitespace in test_delayed_write_update2()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agolibtorture: add torture_assert_nttime_not_equal[_goto]()
Ralph Boehme [Thu, 6 Mar 2025 11:41:57 +0000 (12:41 +0100)] 
libtorture: add torture_assert_nttime_not_equal[_goto]()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: remove get_change_timespec()
Ralph Boehme [Fri, 14 Mar 2025 06:59:33 +0000 (07:59 +0100)] 
smbd: remove get_change_timespec()

Return ctime from the filesystem instead of mtime. Adjust existing tests
by removing ctime check.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: check allocsize change request against current allocsize
Ralph Boehme [Mon, 10 Mar 2025 13:03:33 +0000 (14:03 +0100)] 
smbd: check allocsize change request against current allocsize

Cf MS-FSA 2.1.5.15.1 FileAllocationInformation:

  If Open.Stream.AllocationSize is equal to NewAllocationSize,
  the operation MUST return STATUS_SUCCESS.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agomanpages:smb.conf: disable roaming profiles with 'logon path ='
Douglas Bagnall [Thu, 20 Mar 2025 21:28:23 +0000 (10:28 +1300)] 
manpages:smb.conf: disable roaming profiles with 'logon path ='

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Mar 26 01:51:40 UTC 2025 on atb-devel-224