io.in.called_name = strupper_talloc(tmp_ctx, dest_host);
io.in.service = service;
io.in.service_type = service_type;
+ io.in.existing_conn = NULL;
io.in.credentials = credentials;
io.in.gensec_settings = gensec_settings;
io.in.fallback_to_anonymous = false;
return NT_STATUS_OK;
}
-/*
- a negprot request has completed
-*/
-static NTSTATUS connect_negprot(struct composite_context *c,
- struct smb_composite_connect *io)
+static NTSTATUS connect_send_session(struct composite_context *c,
+ struct smb_composite_connect *io)
{
struct connect_state *state = talloc_get_type(c->private_data, struct connect_state);
- NTSTATUS status;
-
- status = smb_raw_negotiate_recv(state->subreq);
- TALLOC_FREE(state->subreq);
- NT_STATUS_NOT_OK_RETURN(status);
/* next step is a session setup */
state->session = smbcli_session_init(state->transport, state, true, io->in.session_options);
return NT_STATUS_OK;
}
+/*
+ a negprot request has completed
+*/
+static NTSTATUS connect_negprot(struct composite_context *c,
+ struct smb_composite_connect *io)
+{
+ struct connect_state *state = talloc_get_type(c->private_data, struct connect_state);
+ NTSTATUS status;
+
+ status = smb_raw_negotiate_recv(state->subreq);
+ TALLOC_FREE(state->subreq);
+ NT_STATUS_NOT_OK_RETURN(status);
+
+ return connect_send_session(c, io);
+}
+
/*
setup a negprot send
*/
nbt_choose_called_name(state, &state->called,
io->in.called_name, NBT_NAME_SERVER);
+ if (io->in.existing_conn != NULL) {
+ NTSTATUS status;
+
+ status = smbcli_transport_raw_init(state,
+ c->event_ctx,
+ &io->in.existing_conn,
+ &io->in.options,
+ &state->transport);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto failed;
+ }
+
+ status = connect_send_session(c, io);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto failed;
+ }
+
+ return c;
+ }
+
state->creq = smbcli_sock_connect_send(state,
NULL,
io->in.dest_ports,
io.in.dest_ports = lpcfg_smb_ports(ntvfs->ctx->lp_ctx);
io.in.socket_options = lpcfg_socket_options(ntvfs->ctx->lp_ctx);
io.in.called_name = host;
+ io.in.existing_conn = NULL;
io.in.credentials = credentials;
io.in.fallback_to_anonymous = false;
io.in.workgroup = lpcfg_workgroup(ntvfs->ctx->lp_ctx);