diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-09-24 08:59:58 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-10-07 22:47:04 +0200 |
commit | a00fe90c3ce874defd876652196738be90a9b76e (patch) | |
tree | c254e4e516a061f315f37da930f4b0be45dfb9fd /libcli/smb | |
parent | 5c5a33cfcbab90430782169dcef259ca43620b5c (diff) | |
download | samba-a00fe90c3ce874defd876652196738be90a9b76e.tar.gz |
libcli/smb: add smb2cli_req_get_send_iov()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli/smb')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 28 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.h | 10 |
2 files changed, 38 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index b0a8e071240..952e030c8a1 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -3720,6 +3720,34 @@ NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, return status; } +NTSTATUS smb2cli_req_get_sent_iov(struct tevent_req *req, + struct iovec *sent_iov) +{ + struct smbXcli_req_state *state = + tevent_req_data(req, + struct smbXcli_req_state); + + if (tevent_req_is_in_progress(req)) { + return STATUS_PENDING; + } + + sent_iov[0].iov_base = state->smb2.hdr; + sent_iov[0].iov_len = sizeof(state->smb2.hdr); + + sent_iov[1].iov_base = discard_const(state->smb2.fixed); + sent_iov[1].iov_len = state->smb2.fixed_len; + + if (state->smb2.dyn != NULL) { + sent_iov[2].iov_base = discard_const(state->smb2.dyn); + sent_iov[2].iov_len = state->smb2.dyn_len; + } else { + sent_iov[2].iov_base = NULL; + sent_iov[2].iov_len = 0; + } + + return NT_STATUS_OK; +} + static const struct { enum protocol_types proto; const char *smb1_name; diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index 9a970d451b0..4d00e269691 100644 --- a/libcli/smb/smbXcli_base.h +++ b/libcli/smb/smbXcli_base.h @@ -347,6 +347,16 @@ NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, const struct smb2cli_req_expected_response *expected, size_t num_expected); +/* + * This expects an iov[3] array, that is filled with references to + * the buffers used for the sending the requests into the socket. + * + * This can only be called after smb2cli_req_recv(subreq) before + * the TALLOC_FREE(subreq). + */ +NTSTATUS smb2cli_req_get_sent_iov(struct tevent_req *req, + struct iovec *sent_iov); + struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct smbXcli_conn *conn, |