diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-05-13 17:47:07 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-05-14 15:12:33 +0200 |
commit | b19a9dbb5b9429c71992bb66af8951a1263e1eb5 (patch) | |
tree | dd8c8dad3a56359dce27752f1f237ced9f4134d9 /source3 | |
parent | 46a41d0fbdd7b4524313c9299851ad7a63244763 (diff) | |
download | samba-b19a9dbb5b9429c71992bb66af8951a1263e1eb5.tar.gz samba-b19a9dbb5b9429c71992bb66af8951a1263e1eb5.tar.bz2 samba-b19a9dbb5b9429c71992bb66af8951a1263e1eb5.zip |
s3:smb2_tcon: add smbd_smb2_tree_connect_send/recv as wrapper
metze
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/smb2_tcon.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c index 5f75e5ebe1..0799dd1afb 100644 --- a/source3/smbd/smb2_tcon.c +++ b/source3/smbd/smb2_tcon.c @@ -25,6 +25,7 @@ #include "../libcli/security/security.h" #include "auth.h" #include "lib/param/loadparm.h" +#include "../lib/util/tevent_ntstatus.h" static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req, const char *in_path, @@ -34,6 +35,17 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req, uint32_t *out_maximal_access, uint32_t *out_tree_id); +static struct tevent_req *smbd_smb2_tree_connect_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct smbd_smb2_request *smb2req, + const char *in_path); +static NTSTATUS smbd_smb2_tree_connect_recv(struct tevent_req *req, + uint8_t *out_share_type, + uint32_t *out_share_flags, + uint32_t *out_capabilities, + uint32_t *out_maximal_access, + uint32_t *out_tree_id); + NTSTATUS smbd_smb2_request_process_tcon(struct smbd_smb2_request *req) { const uint8_t *inbody; @@ -281,6 +293,73 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req, return NT_STATUS_OK; } +struct smbd_smb2_tree_connect_state { + const char *in_path; + uint8_t out_share_type; + uint32_t out_share_flags; + uint32_t out_capabilities; + uint32_t out_maximal_access; + uint32_t out_tree_id; +}; + +static struct tevent_req *smbd_smb2_tree_connect_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct smbd_smb2_request *smb2req, + const char *in_path) +{ + struct tevent_req *req; + struct smbd_smb2_tree_connect_state *state; + NTSTATUS status; + + req = tevent_req_create(mem_ctx, &state, + struct smbd_smb2_tree_connect_state); + if (req == NULL) { + return NULL; + } + state->in_path = in_path; + + status = smbd_smb2_tree_connect(smb2req, + state->in_path, + &state->out_share_type, + &state->out_share_flags, + &state->out_capabilities, + &state->out_maximal_access, + &state->out_tree_id); + 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_tree_connect_recv(struct tevent_req *req, + uint8_t *out_share_type, + uint32_t *out_share_flags, + uint32_t *out_capabilities, + uint32_t *out_maximal_access, + uint32_t *out_tree_id) +{ + struct smbd_smb2_tree_connect_state *state = + tevent_req_data(req, + struct smbd_smb2_tree_connect_state); + NTSTATUS status; + + if (tevent_req_is_nterror(req, &status)) { + tevent_req_received(req); + return status; + } + + *out_share_type = state->out_share_type; + *out_share_flags = state->out_share_flags; + *out_capabilities = state->out_capabilities; + *out_maximal_access = state->out_maximal_access; + *out_tree_id = state->out_tree_id; + + tevent_req_received(req); + return NT_STATUS_OK; +} + NTSTATUS smbd_smb2_request_process_tdis(struct smbd_smb2_request *req) { NTSTATUS status; |