summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2018-07-18 16:43:04 +0200
committerKarolin Seeger <kseeger@samba.org>2018-08-13 12:56:33 +0200
commitdbf268e6e62d758f0ee9aec0ca758303fe10a240 (patch)
treec5bdae768ed6bfcdc64afd54175834e664744120 /source4/libcli
parent1136ff225fb021c39d9752bb06cbf397a1a0439a (diff)
downloadsamba-dbf268e6e62d758f0ee9aec0ca758303fe10a240.tar.gz
s4:libcli: add smb2_transport_raw_init()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> (cherry picked from commit ce2248c4b5aad2d00155a2e77b3e6340ce824979)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/smb2/transport.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c
index 166f34b8256..1d08289341b 100644
--- a/source4/libcli/smb2/transport.c
+++ b/source4/libcli/smb2/transport.c
@@ -86,6 +86,41 @@ struct smb2_transport *smb2_transport_init(struct smbcli_socket *sock,
}
/*
+ create a transport structure based on an established socket
+*/
+NTSTATUS smb2_transport_raw_init(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct smbXcli_conn **_conn,
+ const struct smbcli_options *options,
+ struct smb2_transport **_transport)
+{
+ struct smb2_transport *transport = NULL;
+ enum protocol_types protocol;
+
+ if (*_conn == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ protocol = smbXcli_conn_protocol(*_conn);
+ if (protocol < PROTOCOL_SMB2_02) {
+ return NT_STATUS_REVISION_MISMATCH;
+ }
+
+ transport = talloc_zero(mem_ctx, struct smb2_transport);
+ if (transport == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ transport->ev = ev;
+ transport->options = *options;
+ transport->conn = talloc_move(transport, _conn);
+
+ talloc_set_destructor(transport, transport_destructor);
+ *_transport = transport;
+ return NT_STATUS_OK;
+}
+
+/*
mark the transport as dead
*/
void smb2_transport_dead(struct smb2_transport *transport, NTSTATUS status)