summaryrefslogtreecommitdiff
path: root/source4/libcli/smb_composite
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-11-30 08:50:11 +0100
committerStefan Metzmacher <metze@samba.org>2011-11-30 13:41:09 +0100
commit99ef6a4bec1058b3649e5e72f8ea85f6df93a154 (patch)
tree0577bfd74c49d603f623ef85573f418f562eded2 /source4/libcli/smb_composite
parent52dd549eb64ea9b79bd4cbeba0fa4183aad7bb4c (diff)
downloadsamba-99ef6a4bec1058b3649e5e72f8ea85f6df93a154.tar.gz
samba-99ef6a4bec1058b3649e5e72f8ea85f6df93a154.tar.bz2
samba-99ef6a4bec1058b3649e5e72f8ea85f6df93a154.zip
s4:libcli: do the nbss session request within smbcli_sock_connect_*()
metze
Diffstat (limited to 'source4/libcli/smb_composite')
-rw-r--r--source4/libcli/smb_composite/connect.c54
1 files changed, 13 insertions, 41 deletions
diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c
index 306b96c167..0f66f2873d 100644
--- a/source4/libcli/smb_composite/connect.c
+++ b/source4/libcli/smb_composite/connect.c
@@ -34,7 +34,6 @@
/* the stages of this call */
enum connect_stage {CONNECT_SOCKET,
- CONNECT_SESSION_REQUEST,
CONNECT_NEGPROT,
CONNECT_SESSION_SETUP,
CONNECT_SESSION_SETUP_ANON,
@@ -53,6 +52,7 @@ struct connect_state {
struct smbcli_request *req;
struct composite_context *creq;
struct tevent_req *subreq;
+ struct nbt_name calling, called;
};
@@ -293,24 +293,6 @@ static NTSTATUS connect_send_negprot(struct composite_context *c,
return NT_STATUS_OK;
}
-
-/*
- a session request operation has completed
-*/
-static NTSTATUS connect_session_request(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 = smbcli_transport_connect_recv(state->subreq);
- TALLOC_FREE(state->subreq);
- NT_STATUS_NOT_OK_RETURN(status);
-
- /* next step is a negprot */
- return connect_send_negprot(c, io);
-}
-
/*
a socket connection operation has completed
*/
@@ -319,8 +301,6 @@ static NTSTATUS connect_socket(struct composite_context *c,
{
struct connect_state *state = talloc_get_type(c->private_data, struct connect_state);
NTSTATUS status;
- struct nbt_name calling, called;
- uint32_t timeout_msec = io->in.options.request_timeout * 1000;
status = smbcli_sock_connect_recv(state->creq, state, &state->sock);
NT_STATUS_NOT_OK_RETURN(status);
@@ -340,25 +320,12 @@ static NTSTATUS connect_socket(struct composite_context *c,
NT_STATUS_HAVE_NO_MEMORY(state->sock->hostname);
}
- make_nbt_name_client(&calling, cli_credentials_get_workstation(io->in.credentials));
-
- nbt_choose_called_name(state, &called, io->in.called_name, NBT_NAME_SERVER);
-
- status = nbt_name_dup(state->transport, &called,
+ status = nbt_name_dup(state->transport, &state->called,
&state->transport->called);
NT_STATUS_NOT_OK_RETURN(status);
- state->subreq = smbcli_transport_connect_send(state,
- state->transport->ev,
- state->transport->socket,
- timeout_msec,
- &calling, &called);
- NT_STATUS_HAVE_NO_MEMORY(state->subreq);
-
- tevent_req_set_callback(state->subreq, subreq_handler, c);
- state->stage = CONNECT_SESSION_REQUEST;
-
- return NT_STATUS_OK;
+ /* next step is a negprot */
+ return connect_send_negprot(c, io);
}
@@ -373,9 +340,6 @@ static void state_handler(struct composite_context *c)
case CONNECT_SOCKET:
c->status = connect_socket(c, state->io);
break;
- case CONNECT_SESSION_REQUEST:
- c->status = connect_session_request(c, state->io);
- break;
case CONNECT_NEGPROT:
c->status = connect_negprot(c, state->io);
break;
@@ -458,12 +422,20 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec
c->state = COMPOSITE_STATE_IN_PROGRESS;
c->private_data = state;
+ make_nbt_name_client(&state->calling,
+ cli_credentials_get_workstation(io->in.credentials));
+
+ nbt_choose_called_name(state, &state->called,
+ io->in.called_name, NBT_NAME_SERVER);
+
state->creq = smbcli_sock_connect_send(state,
NULL,
io->in.dest_ports,
io->in.dest_host,
resolve_ctx, c->event_ctx,
- io->in.socket_options);
+ io->in.socket_options,
+ &state->calling,
+ &state->called);
if (state->creq == NULL) goto failed;
state->stage = CONNECT_SOCKET;