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

metze at samba.org metze at samba.org
Sun Jul 30 17:55:10 GMT 2006


Author: metze
Date: 2006-07-30 17:55:09 +0000 (Sun, 30 Jul 2006)
New Revision: 17324

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

Log:
make better usage of the composite api

metze
Modified:
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_auth.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_auth.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_auth.c	2006-07-30 17:50:37 UTC (rev 17323)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_auth.c	2006-07-30 17:55:09 UTC (rev 17324)
@@ -40,7 +40,7 @@
 
 	struct composite_context *c;
 
-	c = talloc_zero(mem_ctx, struct composite_context);
+	c = composite_create(mem_ctx, p->conn->event_ctx);
 	if (c == NULL) return NULL;
 
 	c->status = dcerpc_init_syntaxes(table,
@@ -207,22 +207,19 @@
 	struct dcerpc_syntax_id syntax, transfer_syntax;
 
 	/* 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;
 
 	state = talloc(c, struct bind_auth_state);
 	if (composite_nomem(state, c)) return c;
-
-	c->state = COMPOSITE_STATE_IN_PROGRESS;
 	c->private_data = state;
-	c->event_ctx = p->conn->event_ctx;
 
 	state->pipe = p;
 
 	c->status = dcerpc_init_syntaxes(table,
 					 &syntax,
 					 &transfer_syntax);
-	if (!NT_STATUS_IS_OK(c->status)) goto failed;
+	if (!composite_is_ok(c)) return c;
 
 	sec = &p->conn->security_state;
 
@@ -231,22 +228,25 @@
 	if (!NT_STATUS_IS_OK(c->status)) {
 		DEBUG(1, ("Failed to start GENSEC client mode: %s\n",
 			  nt_errstr(c->status)));
-		goto failed;
+		composite_error(c, c->status);
+		return c;
 	}
 
 	c->status = gensec_set_credentials(sec->generic_state, credentials);
 	if (!NT_STATUS_IS_OK(c->status)) {
 		DEBUG(1, ("Failed to set GENSEC client credentails: %s\n",
 			  nt_errstr(c->status)));
-		goto failed;
+		composite_error(c, c->status);
+		return c;
 	}
 
-	c->status = gensec_set_target_hostname(
-		sec->generic_state, p->conn->transport.target_hostname(p->conn));
+	c->status = gensec_set_target_hostname(sec->generic_state,
+					       p->conn->transport.target_hostname(p->conn));
 	if (!NT_STATUS_IS_OK(c->status)) {
 		DEBUG(1, ("Failed to set GENSEC target hostname: %s\n", 
 			  nt_errstr(c->status)));
-		goto failed;
+		composite_error(c, c->status);
+		return c;
 	}
 
 	if (service != NULL) {
@@ -255,7 +255,8 @@
 		if (!NT_STATUS_IS_OK(c->status)) {
 			DEBUG(1, ("Failed to set GENSEC target service: %s\n",
 				  nt_errstr(c->status)));
-			goto failed;
+			composite_error(c, c->status);
+			return c;
 		}
 	}
 
@@ -265,7 +266,8 @@
 		DEBUG(1, ("Failed to start GENSEC client mechanism %s: %s\n",
 			  gensec_get_name_by_authtype(auth_type),
 			  nt_errstr(c->status)));
-		goto failed;
+		composite_error(c, c->status);
+		return c;
 	}
 
 	sec->auth_info = talloc(p, struct dcerpc_auth);
@@ -293,11 +295,12 @@
 				  &state->credentials);
 	if (!NT_STATUS_IS_OK(c->status) &&
 	    !NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-		goto failed;
+		composite_error(c, c->status);
+		return c;
 	}
 
-	state->more_processing =
-		NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED);
+	state->more_processing = NT_STATUS_EQUAL(c->status,
+						 NT_STATUS_MORE_PROCESSING_REQUIRED);
 
 	if (state->credentials.length == 0) {
 		composite_done(c);
@@ -313,10 +316,6 @@
 
 	composite_continue(c, creq, bind_auth_recv_bindreply, c);
 	return c;
-	
-failed:
-	composite_error(c, c->status);
-	return c;
 }
 
 



More information about the samba-cvs mailing list