svn commit: samba r17337 - in branches/SAMBA_4_0/source/librpc/rpc:
.
metze at samba.org
metze at samba.org
Mon Jul 31 08:14:27 GMT 2006
Author: metze
Date: 2006-07-31 08:14:27 +0000 (Mon, 31 Jul 2006)
New Revision: 17337
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17337
Log:
make better usage of the composite api
and create an event context explicit
metze
Modified:
branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c
Changeset:
Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c 2006-07-31 07:29:44 UTC (rev 17336)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c 2006-07-31 08:14:27 UTC (rev 17337)
@@ -852,6 +852,8 @@
/* get received endpoint */
s->binding->endpoint = talloc_reference(s->binding,
dcerpc_floor_get_rhs_data(c, &s->twr_r->tower.floors[3]));
+ if (composite_nomem(s->binding->endpoint, c)) return;
+
composite_done(c);
}
@@ -869,30 +871,37 @@
struct epm_map_binding_state *s;
struct composite_context *pipe_connect_req;
struct cli_credentials *anon_creds;
+ struct event_context *new_ev = NULL;
NTSTATUS status;
struct dcerpc_binding *epmapper_binding;
int i;
+ /* Try to find event context in memory context in case passed
+ * event_context (argument) was NULL. If there's none, just
+ * create a new one.
+ */
+ if (ev == NULL) {
+ ev = event_context_find(mem_ctx);
+ if (ev == NULL) {
+ new_ev = event_context_init(mem_ctx);
+ if (new_ev == NULL) return NULL;
+ ev = new_ev;
+ }
+ }
+
/* composite context allocation and setup */
- c = talloc_zero(mem_ctx, struct composite_context);
- if (c == NULL) return NULL;
+ c = composite_create(mem_ctx, ev);
+ if (c == NULL) {
+ talloc_free(new_ev);
+ return NULL;
+ }
+ talloc_steal(c, new_ev);
s = talloc_zero(c, struct epm_map_binding_state);
if (composite_nomem(s, c)) return c;
-
- c->state = COMPOSITE_STATE_IN_PROGRESS;
c->private_data = s;
- c->event_ctx = ev;
- /* Try to find event context in memory context in case passed
- * event_context (argument) was NULL. If there's none, just
- * create a new one.
- */
- if (c->event_ctx == NULL) {
- c->event_ctx = event_context_find(mem_ctx);
- }
-
s->binding = binding;
s->table = table;
@@ -1049,7 +1058,7 @@
}
if (!composite_is_ok(c)) return;
-
+
composite_done(c);
}
@@ -1070,19 +1079,17 @@
/* receive secondary rpc connection */
c->status = dcerpc_secondary_connection_recv(ctx, &p2);
+ if (!composite_is_ok(c)) return;
+
talloc_steal(s, p2);
talloc_steal(p2, s->pipe);
s->pipe = p2;
- if (!composite_is_ok(c)) return;
-
/* initiate a authenticated bind */
auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
s->credentials, DCERPC_AUTH_TYPE_NTLMSSP,
dcerpc_auth_level(s->pipe->conn),
s->table->authservices->names[0]);
- if (composite_nomem(auth_req, c)) return;
-
composite_continue(c, auth_req, continue_auth, c);
}
@@ -1103,19 +1110,17 @@
/* receive secondary rpc connection */
c->status = dcerpc_secondary_connection_recv(ctx, &p2);
+ if (!composite_is_ok(c)) return;
+
talloc_steal(s, p2);
talloc_steal(p2, s->pipe);
s->pipe = p2;
- if (!composite_is_ok(c)) return;
-
/* initiate a authenticated bind */
auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
s->credentials, DCERPC_AUTH_TYPE_SPNEGO,
dcerpc_auth_level(s->pipe->conn),
s->table->authservices->names[0]);
- if (composite_nomem(auth_req, c)) return;
-
composite_continue(c, auth_req, continue_auth, c);
}
@@ -1153,15 +1158,12 @@
uint8_t auth_type;
/* composite context allocation and setup */
- c = talloc_zero(NULL, struct composite_context);
+ c = composite_create(p, p->conn->event_ctx);
if (c == NULL) return NULL;
s = talloc_zero(c, struct pipe_auth_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 state structure */
s->binding = binding;
More information about the samba-cvs
mailing list