]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb2: Fix opening the rootdirectory, part 1
authorVolker Lendecke <vl@samba.org>
Thu, 22 Aug 2013 15:04:03 +0000 (15:04 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 23 Aug 2013 16:48:40 +0000 (09:48 -0700)
[MS-SMB2], 2.2.13 says: In the request, the Buffer field MUST be at least one
byte in length. Implement that for the 0-length filename without create blobs.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/libcli/smb2/create.c

index 1a7f02b07034cf0f7538672c13fceeb206733cce..10fe4f7ce3269ebbed3ebdde4f857d4180565130 100644 (file)
@@ -294,6 +294,21 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
                return NULL;
        }
 
+       if (((io->in.fname == NULL) || (strlen(io->in.fname) == 0)) &&
+           (blob.length == 0)) {
+               struct smb2_request_buffer *buf = &req->out;
+
+               status = smb2_grow_buffer(buf, 1);
+               if (!NT_STATUS_IS_OK(status)) {
+                       talloc_free(req);
+                       return NULL;
+               }
+               buf->dynamic[0] = 0;
+               buf->dynamic += 1;
+               buf->body_size += 1;
+               buf->size += 1;
+       }
+
        data_blob_free(&blob);
 
        smb2_transport_send(req);