summaryrefslogtreecommitdiff
path: root/source4/lib/messaging/messaging.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/messaging/messaging.c')
-rw-r--r--source4/lib/messaging/messaging.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index b605fa0494..be89c97e5b 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -315,7 +315,7 @@ NTSTATUS messaging_send(struct messaging_context *msg, uint32_t server,
if (msg->pending == NULL) {
EVENT_FD_WRITEABLE(msg->event.fde);
}
- DLIST_ADD(msg->pending, rec);
+ DLIST_ADD_END(msg->pending, rec, struct messaging_rec *);
return NT_STATUS_OK;
}
@@ -426,20 +426,27 @@ struct irpc_list {
*/
NTSTATUS irpc_register(struct messaging_context *msg_ctx,
const struct dcerpc_interface_table *table,
- int call, irpc_function_t fn)
+ int callnum, irpc_function_t fn)
{
struct irpc_list *irpc;
- irpc = talloc(msg_ctx, struct irpc_list);
- NT_STATUS_HAVE_NO_MEMORY(irpc);
+ /* override an existing handler, if any */
+ for (irpc=msg_ctx->irpc; irpc; irpc=irpc->next) {
+ if (irpc->table == table && irpc->callnum == callnum) {
+ break;
+ }
+ }
+ if (irpc == NULL) {
+ irpc = talloc(msg_ctx, struct irpc_list);
+ NT_STATUS_HAVE_NO_MEMORY(irpc);
+ DLIST_ADD(msg_ctx->irpc, irpc);
+ }
irpc->table = table;
- irpc->callnum = call;
+ irpc->callnum = callnum;
irpc->fn = fn;
GUID_from_string(irpc->table->uuid, &irpc->uuid);
- DLIST_ADD(msg_ctx->irpc, irpc);
-
return NT_STATUS_OK;
}