add option to forward ping requests to our domain child
authorStefan Metzmacher <metze@sernet.de>
Wed, 12 Sep 2007 10:22:56 +0000 (12:22 +0200)
committerStefan Metzmacher <metze@sernet.de>
Thu, 11 Oct 2007 15:21:48 +0000 (17:21 +0200)
winbindd:ping_our_domain=yes

is very useful for testing and benchmarks

metze

source/winbindd/winbindd.c
source/winbindd/winbindd_dual.c
source/winbindd/winbindd_misc.c

index d8cb554..e241e18 100644 (file)
@@ -393,6 +393,11 @@ static void winbindd_ndr_ping(struct winbindd_cli_state *state)
        struct winbind_ping *r;
        r = talloc_get_type_abort(state->c.ndr.r, struct winbind_ping);
 
+       if (lp_parm_bool(-1, "winbindd", "ping_our_domain", False)) {
+               sendto_domain(state, find_our_domain());
+               return;
+       }
+
        DEBUG(3, ("winbindd_ndr_ping()\n"));
 
        r->out.result = WINBIND_STATUS_OK;
@@ -400,6 +405,17 @@ static void winbindd_ndr_ping(struct winbindd_cli_state *state)
        winbindd_reply_ndr_ok(state);
 }
 
+void winbindd_ndr_child_ping(struct winbindd_domain *domain,
+                            struct winbindd_cli_state *state)
+{
+       struct winbind_ping *r;
+       r = talloc_get_type_abort(state->c.ndr.r, struct winbind_ping);
+
+       DEBUG(3, ("winbindd_ndr_child_ping()\n"));
+
+       r->out.result = WINBIND_STATUS_OK;
+}
+
 static const struct winbind_ndr_cmd {
        uint32 opnum;
        void (*fn)(struct winbindd_cli_state *state);
index 80b4f30..0fb81ee 100644 (file)
@@ -708,6 +708,7 @@ const struct winbindd_child_dispatch_table domain_dispatch_table[] = {
        { WINBINDD_GETUSERDOMGROUPS,     winbindd_dual_getuserdomgroups,      "GETUSERDOMGROUPS" },
        { WINBINDD_DUAL_GETSIDALIASES,   winbindd_dual_getsidaliases,         "GETSIDALIASES" },
        { WINBINDD_CCACHE_NTLMAUTH,      winbindd_dual_ccache_ntlm_auth,      "CCACHE_NTLM_AUTH" },
+       { WINBINDD_PING,                 winbindd_dual_ping,                  "PING" },
        /* End of list */
 
        { WINBINDD_NUM_CMDS, NULL, "NONE" }
@@ -1185,6 +1186,10 @@ static const struct winbind_ndr_cmd {
        void (*fn)(struct winbindd_domain *domain,
                   struct winbindd_cli_state *state);
 } ndr_child_cmd_table[] = {
+       {
+               .opnum  = NDR_WINBIND_PING,
+               .fn     = winbindd_ndr_child_ping
+       },
        {
                .opnum  = NDR_WINBIND_GET_DOMAIN_INFO,
                .fn     = winbindd_ndr_child_get_domain_info
index 0b52c6c..4ff25c1 100644 (file)
@@ -613,10 +613,22 @@ static void domain_info_init_recv(void *private_data, BOOL success)
 
 void winbindd_ping(struct winbindd_cli_state *state)
 {
+       if (lp_parm_bool(-1, "winbindd", "ping_our_domain", False)) {
+               sendto_domain(state, find_our_domain());
+               return;
+       }
+
        DEBUG(3, ("[%5lu]: ping\n", (unsigned long)state->pid));
        request_ok(state);
 }
 
+enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain,
+                                       struct winbindd_cli_state *state)
+{
+       DEBUG(3, ("[%5lu]: (dual) ping\n", (unsigned long)state->pid));
+       return WINBINDD_OK;
+}
+
 /* List various tidbits of information */
 
 void winbindd_info(struct winbindd_cli_state *state)