summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-05-14 12:57:15 +0200
committerStefan Metzmacher <metze@samba.org>2012-05-14 15:12:33 +0200
commitb8d999ce84f15a69c469716e88c0c414f7fcc636 (patch)
tree3e35742ff308603748223948d3cb01e95a62c892 /source3
parent643e648ed0696ff26cbbc0d07bbadaee450bcb51 (diff)
downloadsamba-b8d999ce84f15a69c469716e88c0c414f7fcc636.tar.gz
samba-b8d999ce84f15a69c469716e88c0c414f7fcc636.tar.bz2
samba-b8d999ce84f15a69c469716e88c0c414f7fcc636.zip
s3:smb2_close: add add smbd_smb2_close_send/recv as wrapper
metze
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/smb2_close.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c
index 04c80dee17..c55475e747 100644
--- a/source3/smbd/smb2_close.c
+++ b/source3/smbd/smb2_close.c
@@ -22,6 +22,7 @@
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "../libcli/smb/smb_common.h"
+#include "../lib/util/tevent_ntstatus.h"
static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req,
uint16_t in_flags,
@@ -35,6 +36,21 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req,
uint64_t *out_end_of_file,
uint32_t *out_file_attributes);
+static struct tevent_req *smbd_smb2_close_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct smbd_smb2_request *smb2req,
+ uint16_t in_flags,
+ uint64_t in_file_id_volatile);
+static NTSTATUS smbd_smb2_close_recv(struct tevent_req *req,
+ uint16_t *out_flags,
+ NTTIME *out_creation_time,
+ NTTIME *out_last_access_time,
+ NTTIME *out_last_write_time,
+ NTTIME *out_change_time,
+ uint64_t *out_allocation_size,
+ uint64_t *out_end_of_file,
+ uint32_t *out_file_attributes);
+
NTSTATUS smbd_smb2_request_process_close(struct smbd_smb2_request *req)
{
const uint8_t *inbody;
@@ -224,3 +240,86 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req,
return NT_STATUS_OK;
}
+
+struct smbd_smb2_close_state {
+ uint16_t in_flags;
+ uint64_t in_file_id_volatile;
+ uint16_t out_flags;
+ NTTIME out_creation_time;
+ NTTIME out_last_access_time;
+ NTTIME out_last_write_time;
+ NTTIME out_change_time;
+ uint64_t out_allocation_size;
+ uint64_t out_end_of_file;
+ uint32_t out_file_attributes;
+};
+
+static struct tevent_req *smbd_smb2_close_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct smbd_smb2_request *smb2req,
+ uint16_t in_flags,
+ uint64_t in_file_id_volatile)
+{
+ struct tevent_req *req;
+ struct smbd_smb2_close_state *state;
+ NTSTATUS status;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct smbd_smb2_close_state);
+ if (req == NULL) {
+ return NULL;
+ }
+ state->in_flags = in_flags;
+ state->in_file_id_volatile = in_file_id_volatile;
+
+ status = smbd_smb2_close(smb2req,
+ state->in_flags,
+ state->in_file_id_volatile,
+ &state->out_flags,
+ &state->out_creation_time,
+ &state->out_last_access_time,
+ &state->out_last_write_time,
+ &state->out_change_time,
+ &state->out_allocation_size,
+ &state->out_end_of_file,
+ &state->out_file_attributes);
+ if (tevent_req_nterror(req, status)) {
+ return tevent_req_post(req, ev);
+ }
+
+ tevent_req_done(req);
+ return tevent_req_post(req, ev);
+}
+
+static NTSTATUS smbd_smb2_close_recv(struct tevent_req *req,
+ uint16_t *out_flags,
+ NTTIME *out_creation_time,
+ NTTIME *out_last_access_time,
+ NTTIME *out_last_write_time,
+ NTTIME *out_change_time,
+ uint64_t *out_allocation_size,
+ uint64_t *out_end_of_file,
+ uint32_t *out_file_attributes)
+{
+ struct smbd_smb2_close_state *state =
+ tevent_req_data(req,
+ struct smbd_smb2_close_state);
+ NTSTATUS status;
+
+ if (tevent_req_is_nterror(req, &status)) {
+ tevent_req_received(req);
+ return status;
+ }
+
+ *out_flags = state->out_flags;
+ *out_creation_time = state->out_creation_time;
+ *out_last_access_time = state->out_last_access_time;
+ *out_last_write_time = state->out_last_write_time;
+ *out_change_time = state->out_change_time;
+ *out_allocation_size = state->out_allocation_size;
+ *out_end_of_file = state->out_end_of_file;
+ *out_file_attributes = state->out_file_attributes;
+
+ tevent_req_received(req);
+ return NT_STATUS_OK;
+}