summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-09-26 07:48:42 +0200
committerStefan Metzmacher <metze@samba.org>2013-10-05 14:04:08 +0200
commitdd256792568d96c4a8dba5ea28cd3274ed1c040b (patch)
tree7c1308db0a53d5e01c13030a98112e0a3ac2d826
parentea51681cc21f6e84af2f71309875c6692efcbc6e (diff)
downloadsamba-dd256792568d96c4a8dba5ea28cd3274ed1c040b.tar.gz
samba-dd256792568d96c4a8dba5ea28cd3274ed1c040b.tar.bz2
samba-dd256792568d96c4a8dba5ea28cd3274ed1c040b.zip
smbd:smb2: ignore an dhnq blob along with a dhnc in create
This is according to MS-SMB2, 3.3.5.9.7 "Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create Context" Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--source3/smbd/smb2_create.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 79ba14674b..99a5b38ed6 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -479,16 +479,36 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
}
if (dhnc) {
+ uint32_t num_blobs_allowed;
+
if (dhnc->data.length != 16) {
tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
return tevent_req_post(req, ev);
}
- if (in_context_blobs.num_blobs != 1) {
- /*
- * DHNC should be the only one.
- * TODO: This is only true for the oplock case!
- * For leases, lease request is required additionally!
- */
+
+ /*
+ * According to MS-SMB2: 3.3.5.9.7, "Handling the
+ * SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create Context",
+ * we should ignore an additional dhnq blob, but fail
+ * the request (with status OBJECT_NAME_NOT_FOUND) if
+ * any other extra create blob has been provided.
+ *
+ * (Note that the cases of an additional dh2q or dh2c blob
+ * which require a different error code, have been treated
+ * above.)
+ *
+ * TODO:
+ * This is only true for the oplock case:
+ * For leases, lease request is required additionally.
+ */
+
+ if (dhnq) {
+ num_blobs_allowed = 2;
+ } else {
+ num_blobs_allowed = 1;
+ }
+
+ if (in_context_blobs.num_blobs != num_blobs_allowed) {
tevent_req_nterror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND);
return tevent_req_post(req, ev);
}