diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 18330805d8b..d4100830097 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -626,15 +626,12 @@ struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, uint64_t volatile_id) { struct files_struct *fsp; + uint64_t fsp_persistent; if (smb2req->compat_chain_fsp != NULL) { return smb2req->compat_chain_fsp; } - if (persistent_id != volatile_id) { - return NULL; - } - if (volatile_id > UINT16_MAX) { return NULL; } @@ -643,6 +640,11 @@ struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, if (fsp == NULL) { return NULL; } + fsp_persistent = fsp_persistent_id(fsp); + + if (persistent_id != fsp_persistent) { + return NULL; + } if (smb2req->tcon == NULL) { return NULL; diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c index 75505e5ab84..9318068699e 100644 --- a/source3/smbd/smb2_break.c +++ b/source3/smbd/smb2_break.c @@ -237,6 +237,7 @@ void send_break_message_smb2(files_struct *fsp, int level) SMB2_OPLOCK_LEVEL_II : SMB2_OPLOCK_LEVEL_NONE; NTSTATUS status; + uint64_t fsp_persistent = fsp_persistent_id(fsp); DEBUG(10,("send_break_message_smb2: sending oplock break " "for file %s, fnum = %d, smb2 level %u\n", @@ -245,7 +246,7 @@ void send_break_message_smb2(files_struct *fsp, int level) (unsigned int)smb2_oplock_level )); status = smbd_smb2_send_oplock_break(fsp->conn->sconn, - (uint64_t)fsp->fnum, + fsp_persistent, (uint64_t)fsp->fnum, smb2_oplock_level); if (!NT_STATUS_IS_OK(status)) { diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 2aedfb64969..9881ed2d515 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -822,7 +822,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, if (state->out_file_attributes == 0) { state->out_file_attributes = FILE_ATTRIBUTE_NORMAL; } - state->out_file_id_persistent = result->fnum; + state->out_file_id_persistent = fsp_persistent_id(result); state->out_file_id_volatile = result->fnum; state->out_context_blobs = out_context_blobs;