From 87d2537b485470ca0f0be882084d46deb682d5b8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 28 Apr 2011 16:04:19 +0200 Subject: s4:libcli/smb2: move smb2_connect_resolve_done() It should be after smb2_connect_send(). metze --- source4/libcli/smb2/connect.c | 71 +++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 36 deletions(-) (limited to 'source4/libcli/smb2') diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index 2c7da5f582..0d29577a32 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -226,39 +226,7 @@ static void smb2_connect_socket_done(struct composite_context *creq) smb2req->async.private_data = req; } -static void smb2_connect_resolve_done(struct composite_context *creq) -{ - struct tevent_req *req = - talloc_get_type_abort(creq->async.private_data, - struct tevent_req); - struct smb2_connect_state *state = - tevent_req_data(req, - struct smb2_connect_state); - NTSTATUS status; - const char *addr; - const char **ports; - const char *default_ports[] = { "445", NULL }; - - status = resolve_name_recv(creq, state, &addr); - if (tevent_req_nterror(req, status)) { - return; - } - - if (state->ports == NULL) { - ports = default_ports; - } else { - ports = state->ports; - } - - creq = smbcli_sock_connect_send(state, addr, ports, - state->host, state->resolve_ctx, - state->ev, state->socket_options); - if (tevent_req_nomem(creq, req)) { - return; - } - creq->async.fn = smb2_connect_socket_done; - creq->async.private_data = req; -} +static void smb2_connect_resolve_done(struct composite_context *creq); /* a composite function that does a full negprot/sesssetup/tcon, returning @@ -308,9 +276,40 @@ struct tevent_req *smb2_connect_send(TALLOC_CTX *mem_ctx, return req; } -/* - receive a connect reply -*/ +static void smb2_connect_resolve_done(struct composite_context *creq) +{ + struct tevent_req *req = + talloc_get_type_abort(creq->async.private_data, + struct tevent_req); + struct smb2_connect_state *state = + tevent_req_data(req, + struct smb2_connect_state); + NTSTATUS status; + const char *addr; + const char **ports; + const char *default_ports[] = { "445", NULL }; + + status = resolve_name_recv(creq, state, &addr); + if (tevent_req_nterror(req, status)) { + return; + } + + if (state->ports == NULL) { + ports = default_ports; + } else { + ports = state->ports; + } + + creq = smbcli_sock_connect_send(state, addr, ports, + state->host, state->resolve_ctx, + state->ev, state->socket_options); + if (tevent_req_nomem(creq, req)) { + return; + } + creq->async.fn = smb2_connect_socket_done; + creq->async.private_data = req; +} + NTSTATUS smb2_connect_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, struct smb2_tree **tree) -- cgit