svn commit: samba r22763 - in branches/SAMBA_4_0/source/libnet: .
mimir at samba.org
mimir at samba.org
Tue May 8 22:04:28 GMT 2007
Author: mimir
Date: 2007-05-08 22:04:28 +0000 (Tue, 08 May 2007)
New Revision: 22763
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22763
Log:
replace talloc_zero calls with composite_create and add more
allocation checks.
rafal
Modified:
branches/SAMBA_4_0/source/libnet/userinfo.c
branches/SAMBA_4_0/source/libnet/userman.c
Changeset:
Modified: branches/SAMBA_4_0/source/libnet/userinfo.c
===================================================================
--- branches/SAMBA_4_0/source/libnet/userinfo.c 2007-05-08 21:17:58 UTC (rev 22762)
+++ branches/SAMBA_4_0/source/libnet/userinfo.c 2007-05-08 22:04:28 UTC (rev 22763)
@@ -262,24 +262,22 @@
if (!p || !io) return NULL;
- c = talloc_zero(p, struct composite_context);
- if (c == NULL) goto failure;
+ c = composite_create(p, dcerpc_event_context(p));
+ if (c == NULL) return c;
s = talloc_zero(c, struct userinfo_state);
- if (s == NULL) goto failure;
+ if (composite_nomem(s, c)) return c;
+ c->private_data = s;
+
s->level = io->in.level;
s->pipe = p;
s->domain_handle = io->in.domain_handle;
s->monitor_fn = monitor;
- c->state = COMPOSITE_STATE_IN_PROGRESS;
- c->private_data = s;
- c->event_ctx = dcerpc_event_context(p);
-
if (io->in.sid) {
sid = dom_sid_parse_talloc(s, io->in.sid);
- if (sid == NULL) goto failure;
+ if (composite_nomem(sid, c)) return c;
s->openuser.in.domain_handle = &s->domain_handle;
s->openuser.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
@@ -288,7 +286,7 @@
/* send request */
s->req = dcerpc_samr_OpenUser_send(p, c, &s->openuser);
- if (s->req == NULL) goto failure;
+ if (composite_nomem(s->req, c)) return c;
s->stage = USERINFO_OPENUSER;
@@ -303,7 +301,7 @@
/* send request */
s->req = dcerpc_samr_LookupNames_send(p, c, &s->lookup);
- if (s->req == NULL) goto failure;
+ if (composite_nomem(s->req, c)) return c;
s->stage = USERINFO_LOOKUP;
}
@@ -313,10 +311,6 @@
s->req->async.private = c;
return c;
-
-failure:
- talloc_free(c);
- return NULL;
}
Modified: branches/SAMBA_4_0/source/libnet/userman.c
===================================================================
--- branches/SAMBA_4_0/source/libnet/userman.c 2007-05-08 21:17:58 UTC (rev 22762)
+++ branches/SAMBA_4_0/source/libnet/userman.c 2007-05-08 22:04:28 UTC (rev 22763)
@@ -127,16 +127,16 @@
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 @@
/* 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;
More information about the samba-cvs
mailing list