summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-05-19 11:39:16 +1000
committerAndrew Tridgell <tridge@samba.org>2008-05-19 11:39:16 +1000
commit66cbf7eb59ab4a29dca1d30850c9aeb35a598b3d (patch)
treeeba9b89dd92dd582e7c423a527a907eabe6c1cde /source4/libcli
parentc7d7577fb978dfa822b4aab238440816188099c6 (diff)
downloadsamba-66cbf7eb59ab4a29dca1d30850c9aeb35a598b3d.tar.gz
samba-66cbf7eb59ab4a29dca1d30850c9aeb35a598b3d.tar.bz2
samba-66cbf7eb59ab4a29dca1d30850c9aeb35a598b3d.zip
added mkdir to SMB2 proxy
(This used to be commit 1323aab11fbf346e19c4cef227d727ddfcaa7d60)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/smb_composite/smb2.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/source4/libcli/smb_composite/smb2.c b/source4/libcli/smb_composite/smb2.c
index 7bce65fb27..7fccbe3a3c 100644
--- a/source4/libcli/smb_composite/smb2.c
+++ b/source4/libcli/smb_composite/smb2.c
@@ -120,3 +120,75 @@ NTSTATUS smb2_composite_unlink(struct smb2_tree *tree, union smb_unlink *io)
return composite_wait_free(c);
}
+
+
+
+/*
+ continue after the create in a composite mkdir
+ */
+static void continue_mkdir(struct smb2_request *req)
+{
+ struct composite_context *ctx = talloc_get_type(req->async.private_data,
+ struct composite_context);
+ struct smb2_tree *tree = req->tree;
+ struct smb2_create create_parm;
+ struct smb2_close close_parm;
+ NTSTATUS status;
+
+ status = smb2_create_recv(req, ctx, &create_parm);
+ if (!NT_STATUS_IS_OK(status)) {
+ composite_error(ctx, status);
+ return;
+ }
+
+ ZERO_STRUCT(close_parm);
+ close_parm.in.file.handle = create_parm.out.file.handle;
+
+ req = smb2_close_send(tree, &close_parm);
+ composite_continue_smb2(ctx, req, continue_close, ctx);
+}
+
+/*
+ composite SMB2 mkdir call
+*/
+struct composite_context *smb2_composite_mkdir_send(struct smb2_tree *tree,
+ union smb_mkdir *io)
+{
+ struct composite_context *ctx;
+ struct smb2_create create_parm;
+ struct smb2_request *req;
+
+ ctx = composite_create(tree, tree->session->transport->socket->event.ctx);
+ if (ctx == NULL) return NULL;
+
+ ZERO_STRUCT(create_parm);
+
+ create_parm.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
+ create_parm.in.share_access =
+ NTCREATEX_SHARE_ACCESS_READ|
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ create_parm.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ create_parm.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
+ create_parm.in.create_disposition = NTCREATEX_DISP_CREATE;
+ create_parm.in.fname = io->mkdir.in.path;
+ if (create_parm.in.fname[0] == '\\') {
+ create_parm.in.fname++;
+ }
+
+ req = smb2_create_send(tree, &create_parm);
+
+ composite_continue_smb2(ctx, req, continue_mkdir, ctx);
+
+ return ctx;
+}
+
+
+/*
+ composite mkdir call - sync interface
+*/
+NTSTATUS smb2_composite_mkdir(struct smb2_tree *tree, union smb_mkdir *io)
+{
+ struct composite_context *c = smb2_composite_mkdir_send(tree, io);
+ return composite_wait_free(c);
+}
+