return transport;
 }
 
+/*
+  create a transport structure based on an established socket
+*/
+NTSTATUS smbcli_transport_raw_init(TALLOC_CTX *mem_ctx,
+                                  struct tevent_context *ev,
+                                  struct smbXcli_conn **_conn,
+                                  const struct smbcli_options *options,
+                                  struct smbcli_transport **_transport)
+{
+       struct smbcli_transport *transport = NULL;
+       NTSTATUS status;
+
+       if (*_conn == NULL) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       transport = talloc_zero(mem_ctx, struct smbcli_transport);
+       if (transport == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       transport->ev = ev;
+       transport->options = *options;
+
+       /*
+        * First only set the pointer without move.
+        */
+       transport->conn = *_conn;
+       status = smb_raw_negotiate_fill_transport(transport);
+       if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(transport);
+               return status;
+       }
+
+       talloc_set_destructor(transport, transport_destructor);
+
+       /*
+        * Now move it away from the caller...
+        */
+       transport->conn = talloc_move(transport, _conn);
+       *_transport = transport;
+       return NT_STATUS_OK;
+}
+
 /*
   mark the transport as dead
 */