diff options
Diffstat (limited to 'source4/lib/messaging')
-rw-r--r-- | source4/lib/messaging/irpc.h | 15 | ||||
-rw-r--r-- | source4/lib/messaging/messaging.c | 12 |
2 files changed, 16 insertions, 11 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; |