wb-ndr: 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>
Fri, 2 May 2008 14:12:29 +0000 (16:12 +0200)
The option "winbindd:ping_our_domain=yes"
is very useful for testing and benchmarks

metze

source/winbindd/winbindd.c
source/winbindd/winbindd_domain.c
source/winbindd/winbindd_misc.c

index 5489952275a19c1d2e1178d1cb396baedd48a680..a890950d884d3e43a43b1fddc46ec4c55be40cc0 100644 (file)
@@ -399,6 +399,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;
@@ -406,6 +411,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 04bbef3d205ccfd006d86e754d0df4b00ca584df..a050b36b7f1cd7a26f2193ac9c9d7a6bd2d7c646 100644 (file)
@@ -105,6 +105,12 @@ static const struct winbindd_child_dispatch_table domain_dispatch_table[] = {
                .name           = "CCACHE_NTLM_AUTH",
                .struct_cmd     = WINBINDD_CCACHE_NTLMAUTH,
                .struct_fn      = winbindd_dual_ccache_ntlm_auth,
+       },{
+               .name           = "PING",
+               .struct_cmd     = WINBINDD_PING,
+               .struct_fn      = winbindd_dual_ping,
+               .ndr_opnum      = NDR_WINBIND_PING,
+               .ndr_fn         = winbindd_ndr_child_ping,
        },{
                .name           = "NDR_WINBIND_GET_DOMAIN_INFO",
                .ndr_opnum      = NDR_WINBIND_GET_DOMAIN_INFO,
index 5732ad0dd993602b8804bc60b482d6af9be16398..1efa3682ae8534b895f97134d3ca40bd41e6bdbe 100644 (file)
@@ -713,10 +713,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)