add winbindd_lookup_async()
authorStefan Metzmacher <metze@sernet.de>
Mon, 28 Jan 2008 14:46:40 +0000 (15:46 +0100)
committerStefan Metzmacher <metze@sernet.de>
Fri, 2 May 2008 14:13:21 +0000 (16:13 +0200)
metze

source/winbindd/winbindd_async.c

index 888c697aeaedbd69ac0b55ff5c228f9e7b61bbbe..b086ce12a3a5260d8feaf67ce391d8f789d7d126 100644 (file)
@@ -742,6 +742,47 @@ enum winbindd_result winbindd_dual_lookuprids(struct winbindd_domain *domain,
        return WINBINDD_OK;
 }
 
+static void winbindd_lookup_recv(TALLOC_CTX *mem_ctx, bool success,
+                                struct winbindd_ndr_call *c,
+                                void *_r,
+                                void *_cont,
+                                void *cont_private)
+{
+       void (*cont)(void *priv, bool succ, struct winbind_lookup *r) =
+               (void (*)(void *, bool, struct winbind_lookup*))_cont;
+       struct winbind_lookup *r =
+               talloc_get_type_abort(_r, struct winbind_lookup);
+
+       if (!success) {
+               DEBUG(5, ("Could not lookup\n"));
+               cont(cont_private, false, r);
+               return;
+       }
+
+       if (r->out.result != WINBIND_STATUS_OK) {
+               DEBUG(5, ("lookup returned an error:0x%08X\n",
+                       r->out.result));
+               cont(cont_private, false, r);
+               return;
+       }
+
+       cont(cont_private, true, r);
+}
+
+void winbindd_lookup_async(TALLOC_CTX *mem_ctx,
+                          struct winbindd_domain *domain,
+                          struct winbind_lookup *r,
+                          void (*cont)(void *private_data,
+                                       bool success,
+                                       struct winbind_lookup *r),
+                          void *cont_private)
+{
+       do_async_ndr_domain(mem_ctx, domain,
+                           NDR_WINBIND_LOOKUP, r,
+                           winbindd_lookup_recv, r,
+                           (void *)cont, cont_private);
+}
+
 static void getsidaliases_recv(TALLOC_CTX *mem_ctx, bool success,
                               struct winbindd_response *response,
                               void *c, void *private_data)