diff options
author | Rafal Szczesniak <mimir@samba.org> | 2007-05-08 22:04:28 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:52:16 -0500 |
commit | da7f449a07a30cb03d744f155861a7e7318809d6 (patch) | |
tree | 11678ee941213d2582d6b88fe430f359cf0b911c /source4/libnet/userman.c | |
parent | cc26fe9b749d00bc7c002f6a5a24ff67af497c49 (diff) | |
download | samba-da7f449a07a30cb03d744f155861a7e7318809d6.tar.gz |
r22763: replace talloc_zero calls with composite_create and add more
allocation checks.
rafal
(This used to be commit 621f3e567478fc8067f08f3589b54bf58ca9e1f1)
Diffstat (limited to 'source4/libnet/userman.c')
-rw-r--r-- | source4/libnet/userman.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source4/libnet/userman.c b/source4/libnet/userman.c index 13834d28423..879efe91761 100644 --- a/source4/libnet/userman.c +++ b/source4/libnet/userman.c @@ -127,16 +127,16 @@ struct composite_context *libnet_rpc_useradd_send(struct dcerpc_pipe *p, struct composite_context *c; struct useradd_state *s; + if (!p || !io) return NULL; + /* composite allocation and setup */ - c = talloc_zero(p, struct composite_context); + c = composite_create(p, dcerpc_event_context(p)); if (c == NULL) return NULL; s = talloc_zero(c, struct useradd_state); if (composite_nomem(s, c)) return c; - c->state = COMPOSITE_STATE_IN_PROGRESS; c->private_data = s; - c->event_ctx = dcerpc_event_context(p); /* put passed arguments to the state structure */ s->domain_handle = io->in.domain_handle; @@ -145,8 +145,13 @@ struct composite_context *libnet_rpc_useradd_send(struct dcerpc_pipe *p, /* preparing parameters to send rpc request */ s->createuser.in.domain_handle = &io->in.domain_handle; + s->createuser.in.account_name = talloc_zero(c, struct lsa_String); + if (composite_nomem(s->createuser.in.account_name, c)) return c; + s->createuser.in.account_name->string = talloc_strdup(c, io->in.username); + if (composite_nomem(s->createuser.in.account_name->string, c)) return c; + s->createuser.out.user_handle = &s->user_handle; s->createuser.out.rid = &s->user_rid; |