From 1927676412a5b329b9f6e5e3ec3971bc18e21b31 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 22 Aug 2013 15:04:03 +0000 Subject: libsmb2: Fix opening the rootdirectory, part 1 [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 Reviewed-by: Jeremy Allison --- source4/libcli/smb2/create.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source4/libcli') diff --git a/source4/libcli/smb2/create.c b/source4/libcli/smb2/create.c index 1a7f02b070..10fe4f7ce3 100644 --- a/source4/libcli/smb2/create.c +++ b/source4/libcli/smb2/create.c @@ -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); -- cgit