From 7c50eec25edd2e70d9127f8cc35588c4bfbb53f9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 30 Jul 2006 17:29:02 +0000 Subject: r17318: make better usage of the composite api metze (This used to be commit 683fc25f6524a3821ba70529251aabe97bad9370) --- source4/libcli/smb2/connect.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'source4/libcli/smb2/connect.c') diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index b185ff7a88..0d772bccd8 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -171,38 +171,24 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx, struct nbt_name name; struct composite_context *creq; - c = talloc_zero(mem_ctx, struct composite_context); + c = composite_create(mem_ctx, ev); if (c == NULL) return NULL; state = talloc(c, struct smb2_connect_state); - if (state == NULL) { - c->status = NT_STATUS_NO_MEMORY; - goto failed; - } - - c->state = COMPOSITE_STATE_IN_PROGRESS; + if (composite_nomem(state, c)) return c; c->private_data = state; - c->event_ctx = ev; state->credentials = credentials; state->host = talloc_strdup(c, host); + if (composite_nomem(state->host, c)) return c; state->share = talloc_strdup(c, share); - if (state->host == NULL || state->share == NULL) { - c->status = NT_STATUS_NO_MEMORY; - goto failed; - } + if (composite_nomem(state->share, c)) return c; ZERO_STRUCT(name); name.name = host; creq = resolve_name_send(&name, c->event_ctx, lp_name_resolve_order()); - composite_continue(c, creq, continue_resolve, c); - - return c; - -failed: - composite_error(c, c->status); return c; } -- cgit