The branch, master has been updated
       via  5af7a7a3718 smbd: reshuffle requested/granted lease level logic of 
Directory Leases
       via  d42a4179415 smbd: distinguish "no record" from "bad record" in 
smbXsrv_open_global_lookup()
       via  7b5e87ba35f net/serverid: initialize state->open_db
       via  6ac002d231a smbXsrvdump: catch exception from unparsable records
       via  653da099fb8 smbtorture: fix a test rundown
      from  46791989a94 vfs_gpfs: Fix CID 1666430 Control flow issues (DEADCODE)

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5af7a7a37183f974868703918b46691ee32d648c
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 10 15:24:31 2025 +0200

    smbd: reshuffle requested/granted lease level logic of Directory Leases
    
    This moves the logic to adjust the lease levels for Directory Leases to the 
same
    place where we do it for other cases.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>
    
    Autobuild-User(master): Volker Lendecke <[email protected]>
    Autobuild-Date(master): Thu Nov 27 10:04:47 UTC 2025 on atb-devel-224

commit d42a41794152d0f78989b6c5cb29befbc8504e8a
Author: Ralph Boehme <[email protected]>
Date:   Sat Oct 18 12:45:49 2025 +0200

    smbd: distinguish "no record" from "bad record" in 
smbXsrv_open_global_lookup()
    
    Allows callers to distinguish between "no record" and "bad record" when
    smbXsrv_open_global_parse_record() fails.
    
    No change in behaviour, but might be useful in the future.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>

commit 7b5e87ba35fe63674fc5da43d8c20a8319007e44
Author: Ralph Boehme <[email protected]>
Date:   Mon Nov 24 08:25:16 2025 +0100

    net/serverid: initialize state->open_db
    
    Fixes a crash that happens when smbXsrv_open_global.tdb contains only replay
    records.
    
      #0  0x00007ffff70a718a in dbwrap_exists (db=0x0, key=...) at 
../../lib/dbwrap/dbwrap.c:347
      #1  0x00000000002dc7f2 in wipedbs_traverse_replay_records 
(rec=0x7fffffffd180, wipedbs_state=0x362d70)
          at ../../source3/utils/net_serverid.c:710
      #2  0x00007ffff70aa932 in db_rbt_traverse_internal (db=0x37e940, 
f=0x2dc749 <wipedbs_traverse_replay_records>, private_data=0x362d70,
          count=0x7fffffffd220, rw=false) at ../../lib/dbwrap/dbwrap_rbt.c:472
      #3  0x00007ffff70aaa0e in db_rbt_traverse_read (db=0x37e940, f=0x2dc749 
<wipedbs_traverse_replay_records>, private_data=0x362d70)
          at ../../lib/dbwrap/dbwrap_rbt.c:499
      #4  0x00007ffff70a7433 in dbwrap_traverse_read (db=0x37e940, f=0x2dc749 
<wipedbs_traverse_replay_records>, private_data=0x362d70, count=0x0)
          at ../../lib/dbwrap/dbwrap.c:437
      #5  0x00000000002dcedf in net_serverid_wipedbs (c=0x34c0d0, argc=0, 
argv=0x365380) at ../../source3/utils/net_serverid.c:840
      #6  0x00000000002c9675 in net_run_function (c=0x34c0d0, argc=1, 
argv=0x365378, whoami=0x258c96 "net tdb smbXsrv", table=0x7fffffffd360)
          at ../../source3/utils/net_util.c:451
      #7  0x00000000002e6e2c in net_tdb_smbXsrv (c=0x34c0d0, argc=1, 
argv=0x365378) at ../../source3/utils/net_tdb.c:105
      #8  0x00000000002c9675 in net_run_function (c=0x34c0d0, argc=2, 
argv=0x365370, whoami=0x258d45 "net tdb", table=0x7fffffffd440)
          at ../../source3/utils/net_util.c:451
      #9  0x00000000002e6f04 in net_tdb (c=0x34c0d0, argc=2, argv=0x365370) at 
../../source3/utils/net_tdb.c:128
      #10 0x00000000002c9675 in net_run_function (c=0x34c0d0, argc=3, 
argv=0x365368, whoami=0x22ca4b "net", table=0x323640 <net_func>)
          at ../../source3/utils/net_util.c:451
      #11 0x0000000000277227 in main (argc=6, argv=0x7fffffffe2a8)
          at ../../source3/utils/net.c:1481
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>

commit 6ac002d231af82c17e00bd73c91c14842c389fd4
Author: Ralph Boehme <[email protected]>
Date:   Sat Oct 18 16:34:00 2025 +0200

    smbXsrvdump: catch exception from unparsable records
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>

commit 653da099fb8f08ea522e512ead4380bc53d4efa1
Author: Ralph Boehme <[email protected]>
Date:   Thu Oct 9 19:31:33 2025 +0200

    smbtorture: fix a test rundown
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 examples/scripts/debugging/smbXsrvdump | 11 +++++++++--
 source3/smbd/open.c                    | 19 ++++++++++---------
 source3/smbd/smbXsrv_open.c            | 10 ++++++++++
 source3/utils/net_serverid.c           |  2 ++
 source4/torture/smb2/lease.c           |  2 +-
 5 files changed, 32 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/scripts/debugging/smbXsrvdump 
b/examples/scripts/debugging/smbXsrvdump
index f5c3091dc0d..30bf1a57b9f 100755
--- a/examples/scripts/debugging/smbXsrvdump
+++ b/examples/scripts/debugging/smbXsrvdump
@@ -47,8 +47,15 @@ def print_record(data, ndr_type, watched, ctdb):
             print_watchers(num_watched, blob)
             blob = blob[num_watched*4:]
 
-    unpacked = ndr_unpack(ndr_type, blob, allow_remaining=True)
-    print(ndr_print(unpacked))
+    try:
+        unpacked = ndr_unpack(ndr_type, blob, allow_remaining=True)
+    except Exception:
+        unpacked = None
+        pass
+    if unpacked is not None:
+        print(ndr_print(unpacked))
+    else:
+        print("<failed to parse>")
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser()
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 02f3c53598f..83bdf67f671 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2516,15 +2516,6 @@ static NTSTATUS delay_for_oplock(files_struct *fsp,
                }
 
                requested = lease->lease_state;
-               if (fsp->fsp_flags.is_directory) {
-                       /*
-                        * According to "MS-FSA 2.1.5.18 Server Requests an
-                        * Oplock" this should fail with
-                        * STATUS_INVALID_PARAMETER, but Windows 2022 just
-                        * ignores the SMB2_LEASE_WRITE bit.
-                        */
-                       requested &= ~SMB2_LEASE_WRITE;
-               }
        } else {
                requested = map_oplock_to_lease_type(
                        oplock_request & ~SAMBA_PRIVATE_OPLOCK_MASK);
@@ -2584,6 +2575,16 @@ grant:
 
        granted = requested;
 
+       if (fsp->fsp_flags.is_directory) {
+               /*
+                * According to "MS-FSA 2.1.5.18 Server Requests an
+                * Oplock" this should fail with
+                * STATUS_INVALID_PARAMETER, but Windows 2022 just
+                * ignores the SMB2_LEASE_WRITE bit.
+                */
+               granted &= ~SMB2_LEASE_WRITE;
+       }
+
        if (oplock_request == LEASE_OPLOCK) {
                if (lp_kernel_oplocks(SNUM(fsp->conn))) {
                        DEBUG(10, ("No lease granted because kernel oplocks are 
enabled\n"));
diff --git a/source3/smbd/smbXsrv_open.c b/source3/smbd/smbXsrv_open.c
index 17424300f12..c33508fd525 100644
--- a/source3/smbd/smbXsrv_open.c
+++ b/source3/smbd/smbXsrv_open.c
@@ -303,6 +303,12 @@ static void smbXsrv_open_global_lookup_fn(struct db_record 
*rec,
        struct smbXsrv_open_global_lookup_state *state = private_data;
        TDB_DATA key = dbwrap_record_get_key(rec);
 
+       if (val.dsize == 0) {
+               /* Likely a ctdb tombstone record */
+               state->status = NT_STATUS_NOT_FOUND;
+               return;
+       }
+
        state->status = smbXsrv_open_global_parse_record(state->mem_ctx,
                                                         key,
                                                         val,
@@ -330,6 +336,10 @@ static NTSTATUS smbXsrv_open_global_lookup(
                DBG_ERR("dbwrap_do_locked failed\n");
                return status;
        }
+       if (NT_STATUS_EQUAL(state.status, NT_STATUS_NOT_FOUND)) {
+               DBG_DEBUG("smbXsrv_open record not found\n");
+               return state.status;
+       }
        if (!NT_STATUS_IS_OK(state.status)) {
                DBG_ERR("smbXsrv_open_global_lookup_fn failed\n");
                return state.status;
diff --git a/source3/utils/net_serverid.c b/source3/utils/net_serverid.c
index 07d784f310f..115147586ed 100644
--- a/source3/utils/net_serverid.c
+++ b/source3/utils/net_serverid.c
@@ -286,6 +286,8 @@ static int wipedbs_traverse_open_replay(struct db_record 
*db_rec,
        }
        ret = 0;
 
+       state->open_db = dbwrap_record_get_db(db_rec);
+
 done:
        return ret;
 }
diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c
index ec97ae6b59c..5b915907523 100644
--- a/source4/torture/smb2/lease.c
+++ b/source4/torture/smb2/lease.c
@@ -7281,7 +7281,7 @@ done:
                smb2_util_close(tree, h1);
        }
        if (!smb2_util_handle_empty(h2)) {
-               smb2_util_close(tree, h2);
+               smb2_util_close(tree2, h2);
        }
        if (!smb2_util_handle_empty(dirh1)) {
                smb2_util_close(tree, dirh1);


-- 
Samba Shared Repository

Reply via email to