s4-messaging: add support for no_reply in irpc messages
authorAndrew Tridgell <tridge@samba.org>
Sun, 12 Sep 2010 00:02:02 +0000 (10:02 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 15 Sep 2010 05:39:34 +0000 (15:39 +1000)
It can be useful for a irpc message to be one-way, where the client
sends a messages and the server does not reply. This will be used for
things like a triger message from an auth context to the drepl server
to tell it to try a REPL_SECRET on a user in a RODC.

Previously we've used raw messaging for messages that have no reply,
but that doesn't allow us to use messages described by IDL

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/lib/messaging/irpc.h
source4/lib/messaging/messaging.c

index 4b497959ee93ac0b1201cf206a7d903836354b8d..2a76461954893f83e12743d8539cc183aa91e0b9 100644 (file)
@@ -35,6 +35,7 @@ struct irpc_message {
        struct irpc_header header;
        struct ndr_pull *ndr;
        bool defer_reply;
+       bool no_reply;
        struct messaging_context *msg_ctx;
        struct irpc_list *irpc;
        void *data;
index ae3f908060bba51138d9713dfaad56ec90ba568d..c33db825fc6425e09bf24888d9493f749ce03e0e 100644 (file)
@@ -776,6 +776,7 @@ static void irpc_handler_request(struct messaging_context *msg_ctx,
        /* make the call */
        m->private_data= i->private_data;
        m->defer_reply = false;
+       m->no_reply    = false;
        m->msg_ctx     = msg_ctx;
        m->irpc        = i;
        m->data        = r;
@@ -783,6 +784,12 @@ static void irpc_handler_request(struct messaging_context *msg_ctx,
 
        m->header.status = i->fn(m, r);
 
+       if (m->no_reply) {
+               /* the server function won't ever be replying to this request */
+               talloc_free(m);
+               return;
+       }
+
        if (m->defer_reply) {
                /* the server function has asked to defer the reply to later */
                talloc_steal(msg_ctx, m);