diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-01 17:33:43 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:30:15 -0500 |
commit | fc585709402e6840a5dd16c9a3fb22792ddacf3e (patch) | |
tree | 7dab1295aaf765ea433dff959b58b016e4433cb9 | |
parent | 6f0e5b59538b99decc186e899bef65d4c02e41bb (diff) | |
download | samba-fc585709402e6840a5dd16c9a3fb22792ddacf3e.tar.gz samba-fc585709402e6840a5dd16c9a3fb22792ddacf3e.tar.bz2 samba-fc585709402e6840a5dd16c9a3fb22792ddacf3e.zip |
r8887: fixed the irpc error that caused ia64 to fail the LOCAL-IRPC test
(This used to be commit ce9a262d379b946717d0d4be4731c837e6f7373d)
-rw-r--r-- | source4/lib/messaging/irpc.h | 15 | ||||
-rw-r--r-- | source4/lib/messaging/messaging.c | 12 | ||||
-rw-r--r-- | source4/scripting/ejs/smbcalls_rpc.c | 2 | ||||
-rw-r--r-- | source4/torture/local/irpc.c | 6 |
4 files changed, 20 insertions, 15 deletions
diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h index 4fb1acfedb..7398453612 100644 --- a/source4/lib/messaging/irpc.h +++ b/source4/lib/messaging/irpc.h @@ -29,7 +29,7 @@ struct irpc_message { }; /* don't allow calls to take too long */ -#define IRPC_CALL_TIMEOUT 10 +#define IRPC_CALL_TIMEOUT 1000 /* the server function type */ @@ -42,11 +42,11 @@ typedef NTSTATUS (*irpc_function_t)(struct irpc_message *, void *r); (irpc_function_t)function, private) /* make a irpc call */ -#define IRPC_CALL(msg_ctx, server_id, pipename, funcname, ptr) \ - irpc_call(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## funcname, ptr) +#define IRPC_CALL(msg_ctx, server_id, pipename, funcname, ptr, ctx) \ + irpc_call(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## funcname, ptr, ctx) -#define IRPC_CALL_SEND(msg_ctx, server_id, pipename, funcname, ptr) \ - irpc_call_send(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## funcname, ptr) +#define IRPC_CALL_SEND(msg_ctx, server_id, pipename, funcname, ptr, ctx) \ + irpc_call_send(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## funcname, ptr, ctx) /* @@ -60,6 +60,7 @@ struct irpc_request { void *r; NTSTATUS status; BOOL done; + TALLOC_CTX *mem_ctx; struct { void (*fn)(struct irpc_request *); void *private; @@ -89,12 +90,12 @@ NTSTATUS irpc_register(struct messaging_context *msg_ctx, struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, uint32_t server_id, const struct dcerpc_interface_table *table, - int callnum, void *r); + int callnum, void *r, TALLOC_CTX *ctx); NTSTATUS irpc_call_recv(struct irpc_request *irpc); NTSTATUS irpc_call(struct messaging_context *msg_ctx, uint32_t server_id, const struct dcerpc_interface_table *table, - int callnum, void *r); + int callnum, void *r, TALLOC_CTX *ctx); NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name); uint32_t *irpc_servers_byname(struct messaging_context *msg_ctx, const char *name); diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 911d439de1..6cabb4c63b 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -500,9 +500,11 @@ static void irpc_handler_reply(struct messaging_context *msg_ctx, irpc->status = irpc->table->calls[irpc->callnum].ndr_pull(ndr, NDR_OUT, irpc->r); if (NT_STATUS_IS_OK(irpc->status)) { irpc->status = header->status; + talloc_steal(irpc->mem_ctx, ndr); + } else { + talloc_steal(irpc, ndr); } irpc->done = True; - talloc_steal(irpc, ndr); if (irpc->async.fn) { irpc->async.fn(irpc); } @@ -634,7 +636,7 @@ static void irpc_timeout(struct event_context *ev, struct timed_event *te, struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, uint32_t server_id, const struct dcerpc_interface_table *table, - int callnum, void *r) + int callnum, void *r, TALLOC_CTX *ctx) { struct irpc_header header; struct ndr_push *ndr; @@ -653,6 +655,7 @@ struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, irpc->r = r; irpc->done = False; irpc->async.fn = NULL; + irpc->mem_ctx = ctx; talloc_set_destructor(irpc, irpc_destructor); @@ -713,10 +716,11 @@ NTSTATUS irpc_call_recv(struct irpc_request *irpc) NTSTATUS irpc_call(struct messaging_context *msg_ctx, uint32_t server_id, const struct dcerpc_interface_table *table, - int callnum, void *r) + int callnum, void *r, + TALLOC_CTX *mem_ctx) { struct irpc_request *irpc = irpc_call_send(msg_ctx, server_id, - table, callnum, r); + table, callnum, r, mem_ctx); NTSTATUS status = irpc_call_recv(irpc); talloc_free(irpc); return status; diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index 223ac5c972..8a08ba0d8d 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -219,7 +219,7 @@ static int ejs_irpc_call(int eid, struct MprVar *io, /* make the actual calls */ for (i=0;i<count;i++) { reqs[i] = irpc_call_send(p->msg_ctx, p->dest_ids[i], - iface, callnum, ptr); + iface, callnum, ptr, ptr); if (reqs[i] == NULL) { status = NT_STATUS_NO_MEMORY; goto done; diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c index 500a0fe02e..3d529fcc49 100644 --- a/source4/torture/local/irpc.c +++ b/source4/torture/local/irpc.c @@ -68,7 +68,7 @@ static BOOL test_addone(TALLOC_CTX *mem_ctx, r.in.in_data = value; test_debug = True; - status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r); + status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r, mem_ctx); test_debug = False; if (!NT_STATUS_IS_OK(status)) { printf("AddOne failed - %s\n", nt_errstr(status)); @@ -101,7 +101,7 @@ static BOOL test_echodata(TALLOC_CTX *mem_ctx, r.in.in_data = talloc_strdup(mem_ctx, "0123456789"); r.in.len = strlen(r.in.in_data); - status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r); + status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r, mem_ctx); if (!NT_STATUS_IS_OK(status)) { printf("EchoData failed - %s\n", nt_errstr(status)); return False; @@ -163,7 +163,7 @@ static BOOL test_speed(TALLOC_CTX *mem_ctx, while (timeval_elapsed(&tv) < timelimit) { struct irpc_request *irpc; - irpc = IRPC_CALL_SEND(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r); + irpc = IRPC_CALL_SEND(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r, mem_ctx); if (irpc == NULL) { printf("AddOne send failed\n"); return False; |