]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_default: make disconnect a no-op for Persistent Handles
authorRalph Boehme <slow@samba.org>
Tue, 2 Dec 2025 18:44:44 +0000 (19:44 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:36 +0000 (10:18 +0000)
Basically just copy the existing initial cookie and call it a day. That way the
resulting overall disconnect/reconnect behaviour is the same for Persistent
Handles regardless of a server side process or node crash, or a TCP disconnect.

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

index e55a0c0d6bc38a065f828d1b6d197ff64bcf4ecd..c5eef93ae41fed6e8adc46824bef515d0371d87b 100644 (file)
@@ -218,6 +218,14 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
+       if (fsp->op->global->persistent) {
+               new_cookie_blob = data_blob_dup_talloc(mem_ctx, old_cookie);
+               if (new_cookie_blob.data == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+               goto do_close;
+       }
+
        if ((fsp_lease_type(fsp) & SMB2_LEASE_HANDLE) == 0) {
                return NT_STATUS_NOT_SUPPORTED;
        }
@@ -308,6 +316,7 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
                NDR_PRINT_DEBUG(vfs_default_durable_cookie, &cookie);
        }
 
+do_close:
        status = fd_close(fsp);
        if (!NT_STATUS_IS_OK(status)) {
                data_blob_free(&new_cookie_blob);