svn commit: samba r17326 - in branches/SAMBA_4_0/source/librpc/rpc: .

metze at samba.org metze at samba.org
Sun Jul 30 18:36:18 GMT 2006


Author: metze
Date: 2006-07-30 18:36:17 +0000 (Sun, 30 Jul 2006)
New Revision: 17326

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17326

Log:
make better usage of the composite api

metze
Modified:
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_schannel.c
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_schannel.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_schannel.c	2006-07-30 18:24:07 UTC (rev 17325)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_schannel.c	2006-07-30 18:36:17 UTC (rev 17326)
@@ -232,15 +232,12 @@
 	struct composite_context *epm_map_req;
 	
 	/* composite context allocation and setup */
-	c = talloc_zero(mem_ctx, struct composite_context);
+	c = composite_create(mem_ctx, p->conn->event_ctx);
 	if (c == NULL) return NULL;
 
 	s = talloc_zero(c, struct schannel_key_state);
 	if (composite_nomem(s, c)) return c;
-
-	c->state = COMPOSITE_STATE_IN_PROGRESS;
 	c->private_data = s;
-	c->event_ctx = p->conn->event_ctx;
 
 	/* store parameters in the state structure */
 	s->pipe        = p;
@@ -357,16 +354,13 @@
 	struct composite_context *schan_key_req;
 
 	/* composite context allocation and setup */
-	c = talloc_zero(tmp_ctx, struct composite_context);
+	c = composite_create(tmp_ctx, p->conn->event_ctx);
 	if (c == NULL) return NULL;
 	
 	s = talloc_zero(c, struct auth_schannel_state);
 	if (composite_nomem(s, c)) return c;
-	
-	c->state = COMPOSITE_STATE_IN_PROGRESS;
 	c->private_data = s;
-	c->event_ctx = p->conn->event_ctx;
-	
+
 	/* store parameters in the state structure */
 	s->pipe        = p;
 	s->credentials = credentials;

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c	2006-07-30 18:24:07 UTC (rev 17325)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c	2006-07-30 18:36:17 UTC (rev 17326)
@@ -371,13 +371,12 @@
 	struct smb2_create io;
 	struct smb2_request *req;
 
-	ctx = talloc_zero(NULL, struct composite_context);
-	if (ctx == NULL) goto failed;
-	ctx->state = COMPOSITE_STATE_IN_PROGRESS;
-	ctx->event_ctx = talloc_reference(c, c->event_ctx);
+	ctx = composite_create(c, c->event_ctx);
+	if (ctx == NULL) return NULL;
 
 	state = talloc(ctx, struct pipe_open_smb2_state);
-	if (state == NULL) goto failed;
+	if (composite_nomem(state, ctx)) return ctx;
+	ctx->private_data = state;
 
 	state->c = c;
 	state->ctx = ctx;
@@ -409,16 +408,8 @@
 	io.in.fname = pipe_name;
 
 	req = smb2_create_send(tree, &io);
-	if (req == NULL) goto failed;
-
-	req->async.fn = pipe_open_recv;
-	req->async.private = state;
-
+	composite_continue_smb2(ctx, req, pipe_open_recv, state);
 	return ctx;
-
- failed:
-	talloc_free(ctx);
-	return NULL;
 }
 
 static void pipe_open_recv(struct smb2_request *req)



More information about the samba-cvs mailing list