summaryrefslogtreecommitdiffstats
path: root/source4/libcli/smb2/connect.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-07-30 17:29:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:11 -0500
commit7c50eec25edd2e70d9127f8cc35588c4bfbb53f9 (patch)
tree46467d8674008d99b64307166f5481065342a623 /source4/libcli/smb2/connect.c
parent7e949c9fb12483df11c7e926e2c5ed8e4b9b9d20 (diff)
downloadsamba-7c50eec25edd2e70d9127f8cc35588c4bfbb53f9.tar.gz
samba-7c50eec25edd2e70d9127f8cc35588c4bfbb53f9.tar.xz
samba-7c50eec25edd2e70d9127f8cc35588c4bfbb53f9.zip
r17318: make better usage of the composite api
metze (This used to be commit 683fc25f6524a3821ba70529251aabe97bad9370)
Diffstat (limited to 'source4/libcli/smb2/connect.c')
-rw-r--r--source4/libcli/smb2/connect.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index b185ff7a883..0d772bccd84 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;
}