]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: fail replay operation on handle that has been used
authorRalph Boehme <slow@samba.org>
Mon, 25 Aug 2025 16:48:20 +0000 (18:48 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:37 +0000 (10:18 +0000)
Using a handle, eg processing an SMB2_WRITE operation, removes the replay cache
record associated with open.

If the handle is a Persistent Handle, the replay must fail with
NT_STATUS_FILE_NOT_AVAILABLE in this case, whereas for a Durable Handle without
persistency, the replay would be handled as a new create.

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

index 98c715a00c8fbac4aea99543e0352321db7eb3c6..0c0ab48868b7de83ccc082880e1943f2d80b1b07 100644 (file)
@@ -1181,6 +1181,13 @@ NTSTATUS smb2srv_open_lookup_replay_cache(struct smbXsrv_connection *conn,
        if (val.dsize == 0) {
                struct smbXsrv_open_global_key_buf open_key_buf;
 
+               if (replay_operation && persistent_requested) {
+                       DBG_DEBUG("Replay on Persistent Handle, "
+                                 "no replay record found\n");
+                       TALLOC_FREE(frame);
+                       return NT_STATUS_FILE_NOT_AVAILABLE;
+               }
+
                DBG_DEBUG("Fresh replay-cache record\n");
 
                val = smbXsrv_open_global_id_to_key(0, &open_key_buf);