diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-11-18 23:34:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:46:28 -0500 |
commit | 27bab09cdb76364b0e0562304078c79c6612c6e1 (patch) | |
tree | 16aa3cd119323c2ce0de403e288b5d9d4102f643 | |
parent | f8391489bfbeea20e450b9ec7640c3e04c713ced (diff) | |
download | samba-27bab09cdb76364b0e0562304078c79c6612c6e1.tar.gz samba-27bab09cdb76364b0e0562304078c79c6612c6e1.tar.bz2 samba-27bab09cdb76364b0e0562304078c79c6612c6e1.zip |
r11795: used a couple more of volkers composite helper functions. They
certainly make the code more compact.
(This used to be commit 872e2a49d8a1ad1f9a6e2f2d323b3471aeb9cba6)
-rw-r--r-- | source4/libcli/smb2/connect.c | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index 38b6e1924e..cdfc162aae 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -75,24 +75,15 @@ static void continue_session(struct composite_context *creq) } state->tree = smb2_tree_init(state->session, state, True); - if (state->tree == NULL) { - composite_error(c, NT_STATUS_NO_MEMORY); - return; - } + if (composite_nomem(state->tree, c)) return; state->tcon.in.unknown1 = 0x09; state->tcon.in.path = talloc_asprintf(state, "\\\\%s\\%s", state->host, state->share); - if (state->tcon.in.path == NULL) { - composite_error(c, NT_STATUS_NO_MEMORY); - return; - } + if (composite_nomem(state->tcon.in.path, c)) return; req = smb2_tree_connect_send(state->tree, &state->tcon); - if (req == NULL) { - composite_error(c, NT_STATUS_NO_MEMORY); - return; - } + if (composite_nomem(req, c)) return; req->async.fn = continue_tcon; req->async.private = c; @@ -117,19 +108,11 @@ static void continue_negprot(struct smb2_request *req) } state->session = smb2_session_init(transport, state, True); - if (state->session == NULL) { - composite_error(c, NT_STATUS_NO_MEMORY); - return; - } + if (composite_nomem(state->session, c)) return; creq = smb2_session_setup_spnego_send(state->session, state->credentials); - if (creq == NULL) { - composite_error(c, NT_STATUS_NO_MEMORY); - return; - } - creq->async.fn = continue_session; - creq->async.private_data = c; + composite_continue(c, creq, continue_session, c); } /* @@ -152,19 +135,13 @@ static void continue_socket(struct composite_context *creq) } transport = smb2_transport_init(sock, state); - if (transport == NULL) { - composite_error(c, NT_STATUS_NO_MEMORY); - return; - } + if (composite_nomem(transport, c)) return; ZERO_STRUCT(state->negprot); state->negprot.in.unknown1 = 0x0001; req = smb2_negprot_send(transport, &state->negprot); - if (req == NULL) { - composite_error(c, NT_STATUS_NO_MEMORY); - return; - } + if (composite_nomem(req, c)) return; req->async.fn = continue_negprot; req->async.private = c; @@ -189,13 +166,8 @@ static void continue_resolve(struct composite_context *creq) } creq = smbcli_sock_connect_send(state, addr, 445, state->host, c->event_ctx); - if (creq == NULL) { - composite_error(c, NT_STATUS_NO_MEMORY); - return; - } - creq->async.private_data = c; - creq->async.fn = continue_socket; + composite_continue(c, creq, continue_socket, c); } /* @@ -238,10 +210,8 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx, name.name = host; creq = resolve_name_send(&name, c->event_ctx, lp_name_resolve_order()); - if (creq == NULL) goto failed; - creq->async.private_data = c; - creq->async.fn = continue_resolve; + composite_continue(c, creq, continue_resolve, c); return c; |