smbd:smb2: clarify and comment code treating dh2c blob check.
authorMichael Adam <obnox@samba.org>
Fri, 4 Oct 2013 10:39:57 +0000 (12:39 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 5 Oct 2013 13:56:11 +0000 (15:56 +0200)
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 <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Oct  5 15:56:11 CEST 2013 on sn-devel-104

source3/smbd/smb2_create.c

index 99a5b38ed64cfe83b46f9998828a81114b1e40d3..140c81b309e2979b1ebf7cb6ccacc3cd2be2bd9b 100644 (file)
@@ -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);
                }