diff options
-rw-r--r-- | source4/smb_server/smb2/receive.c | 20 | ||||
-rw-r--r-- | source4/smb_server/smb2/smb2_server.h | 3 |
2 files changed, 18 insertions, 5 deletions
diff --git a/source4/smb_server/smb2/receive.c b/source4/smb_server/smb2/receive.c index 4b48151d3f..16f888b0a6 100644 --- a/source4/smb_server/smb2/receive.c +++ b/source4/smb_server/smb2/receive.c @@ -218,11 +218,14 @@ static void smb2srv_chain_reply(struct smb2srv_request *p_req) smb2srv_setup_bufinfo(req); flags = IVAL(req->in.hdr, SMB2_HDR_FLAGS); - if ((flags & SMB2_HDR_FLAG_CHAINED) && p_req->chained_file_handle) { - memcpy(req->_chained_file_handle, - p_req->_chained_file_handle, - sizeof(req->_chained_file_handle)); - req->chained_file_handle = req->_chained_file_handle; + if (flags & SMB2_HDR_FLAG_CHAINED) { + if (p_req->chained_file_handle) { + memcpy(req->_chained_file_handle, + p_req->_chained_file_handle, + sizeof(req->_chained_file_handle)); + req->chained_file_handle = req->_chained_file_handle; + } + req->chain_status = p_req->chain_status; } /* @@ -298,6 +301,8 @@ void smb2srv_send_error(struct smb2srv_request *req, NTSTATUS error) SSVAL(req->out.body, 0x02, 0); SIVAL(req->out.body, 0x04, 0); + req->chain_status = NT_STATUS_INVALID_PARAMETER; + smb2srv_send_reply(req); } @@ -352,6 +357,11 @@ static NTSTATUS smb2srv_reply(struct smb2srv_request *req) return NT_STATUS_OK; } + if (!NT_STATUS_IS_OK(req->chain_status)) { + smb2srv_send_error(req, req->chain_status); + return NT_STATUS_OK; + } + switch (opcode) { case SMB2_OP_NEGPROT: smb2srv_negprot_recv(req); diff --git a/source4/smb_server/smb2/smb2_server.h b/source4/smb_server/smb2/smb2_server.h index ba3021a3a9..7fb09f6873 100644 --- a/source4/smb_server/smb2/smb2_server.h +++ b/source4/smb_server/smb2/smb2_server.h @@ -58,6 +58,9 @@ struct smb2srv_request { /* the offset to the next SMB2 Header for chained requests */ uint32_t chain_offset; + /* the status we return for following chained requests */ + NTSTATUS chain_status; + /* chained file handle */ uint8_t _chained_file_handle[16]; uint8_t *chained_file_handle; |