add winbindd_get_dc_info_async() function
authorStefan Metzmacher <metze@sernet.de>
Thu, 13 Sep 2007 13:58:43 +0000 (15:58 +0200)
committerStefan Metzmacher <metze@sernet.de>
Thu, 11 Oct 2007 15:21:48 +0000 (17:21 +0200)
metze

source/winbindd/winbindd_misc.c

index 4ff25c1..24a18b4 100644 (file)
@@ -289,6 +289,47 @@ enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain,
        return WINBINDD_OK;
 }
 
+static void winbindd_get_dc_info_recv(TALLOC_CTX *mem_ctx, BOOL success,
+                                     struct winbindd_ndr_call *c,
+                                     void *_r,
+                                     void *_cont,
+                                     void *private_data)
+{
+       void (*cont)(void *priv, BOOL succ, struct winbind_get_dc_info *r) =
+               (void (*)(void *, BOOL, struct winbind_get_dc_info*))_cont;
+       struct winbind_get_dc_info *r =
+               talloc_get_type_abort(_r, struct winbind_get_dc_info);
+
+       if (!success) {
+               DEBUG(5, ("Could not get dc_info\n"));
+               cont(private_data, False, r);
+               return;
+       }
+
+       if (r->out.result != WINBIND_STATUS_OK) {
+               DEBUG(5, ("get_dc_info returned an error:0x%08X\n",
+                       r->out.result));
+               cont(private_data, False, r);
+               return;
+       }
+
+       cont(private_data, True, r);
+}
+
+void winbindd_get_dc_info_async(TALLOC_CTX *mem_ctx,
+                               struct winbindd_domain *domain,
+                               struct winbind_get_dc_info *r,
+                               void (*cont)(void *private_data,
+                                            BOOL success,
+                                            struct winbind_get_dc_info *r),
+                               void *private_data)
+{
+       do_async_ndr_domain(mem_ctx, domain,
+                           NDR_WINBIND_GET_DC_INFO, r,
+                           winbindd_get_dc_info_recv, r,
+                           (void *)cont, private_data);
+}
+
 static void ndr_child_get_dc_info_comapt_nt4(struct winbindd_domain *domain,
                                             struct winbindd_cli_state *state,
                                             struct winbind_get_dc_info *r)