]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_default: check for missing lease create context
authorRalph Boehme <slow@samba.org>
Fri, 19 Jun 2026 12:01:01 +0000 (14:01 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:36 +0000 (10:18 +0000)
MS-SMB2: 3.3.5.9.7 Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create
Context tells us:

...

If any of the following conditions is TRUE, the server MUST fail the request
with STATUS_OBJECT_NAME_NOT_FOUND:

- Open.Lease is not NULL and the SMB2_CREATE_REQUEST_LEASE_V2 or the
  SMB2_CREATE_REQUEST_LEASE create context is not present.

...

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/smbd/durable.c

index b4821e56970ceb3d9752f4bc042f36cdae64781a..c4409d6d524db022f3b5f93e2566d13d9e78142a 100644 (file)
@@ -691,6 +691,17 @@ static void vfs_default_durable_reconnect_fn(struct share_mode_lock *lck,
                goto fail;
        }
 
+       if ((e.op_type == LEASE_OPLOCK) && (state->lease == NULL)) {
+               /*
+                * The client didn't send a lease context when reconnecting,
+                * although the handle did have a lease.
+                */
+               DBG_WARNING("Trying to reconnect handle with lease without lease context on [%s]\n",
+                           fsp_str_dbg(fsp));
+               state->status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+               goto fail;
+       }
+
        fsp_apply_share_entry_flags(fsp, e.flags);
        fsp->open_time = e.time;
        fsp->access_mask = e.access_mask;