From 9110c079f1aa504bc114d8c00a5a48f58dce5459 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Oct 2013 12:39:57 +0200 Subject: [PATCH] smbd:smb2: clarify and comment code treating dh2c blob check. This makes the code that checks for extra create blobs in the case of the dh2c blob look very similar to the corresponding (slightly mode complex) code for the dhnc blob. With this preparation it will be easier and more obvious how to add proper treatment of the lease request blobs when leases get implemented. Signed-off-by: Michael Adam Reviewed-by: Jeremy Allison Reviewed-by: Stefan Metzmacher Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Sat Oct 5 15:56:11 CEST 2013 on sn-devel-104 --- source3/smbd/smb2_create.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 99a5b38ed6..140c81b309 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -515,16 +515,32 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, } if (dh2c) { + uint32_t num_blobs_allowed; + if (dh2c->data.length != 36) { tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); return tevent_req_post(req, ev); } - if (in_context_blobs.num_blobs != 1) { - /* - * DH2C 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.12, "Handling the + * SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 Create Context", + * we should fail the request with status + * OBJECT_NAME_NOT_FOUND if any other create blob has been + * provided. + * + * (Note that the cases of an additional dhnq, dhnc or dh2q + * 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! + */ + + 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); } -- 2.34.1