summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-06-09 16:48:25 +0200
committerStefan Metzmacher <metze@samba.org>2009-06-09 16:49:32 +0200
commit959503ed1ac76c4ebb8d7941a3a2462ae93869c4 (patch)
tree88d7b48434dd0dbad2d4e281d01489fd9995d2c8
parentf55091586dd2112bf94ff8d352b2ac43b6db0521 (diff)
downloadsamba-959503ed1ac76c4ebb8d7941a3a2462ae93869c4.tar.gz
samba-959503ed1ac76c4ebb8d7941a3a2462ae93869c4.tar.bz2
samba-959503ed1ac76c4ebb8d7941a3a2462ae93869c4.zip
s4:smb2srv: correctly fail remaining compounded requests after a failure
metze
-rw-r--r--source4/smb_server/smb2/receive.c20
-rw-r--r--source4/smb_server/smb2/smb2_server.h3
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;