From: Ralph Boehme Date: Mon, 25 Aug 2025 16:48:20 +0000 (+0200) Subject: smbd: fail replay operation on handle that has been used X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a177f45d1ee6fe2c5bebfee3a3c20342c3c31cfa;p=thirdparty%2Fsamba.git smbd: fail replay operation on handle that has been used 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 Reviewed-by: Anoop C S --- diff --git a/source3/smbd/smbXsrv_open.c b/source3/smbd/smbXsrv_open.c index 98c715a00c8..0c0ab48868b 100644 --- a/source3/smbd/smbXsrv_open.c +++ b/source3/smbd/smbXsrv_open.c @@ -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);