wb-ndr: use WINBIND_TRUST_LEVEL_COMPAT_CHECK_MACHCC instead of winbindd_dual_check_ma...
authorStefan Metzmacher <metze@sernet.de>
Wed, 5 Mar 2008 10:21:18 +0000 (11:21 +0100)
committerStefan Metzmacher <metze@sernet.de>
Fri, 2 May 2008 14:13:27 +0000 (16:13 +0200)
metze

source/winbindd/winbindd_misc.c

index d4a93f0bb1054bf166a95fe91827cdcb6edb3e76..3ef015fb39fb564c955e8e50697a22149ff3bab6 100644 (file)
 
 /* Check the machine account password is valid */
 
+static void winbindd_check_machine_acct_recv(TALLOC_CTX *mem_ctx, bool success,
+                                            struct winbindd_ndr_call *c,
+                                            void *private_data,
+                                            void *_cont,
+                                            void *_cont_private)
+{
+       struct winbindd_cli_state *state =
+               talloc_get_type_abort(private_data, struct winbindd_cli_state);
+       struct winbind_trust *r =
+               talloc_get_type_abort(c->ndr.r, struct winbind_trust);
+
+       if (!success) {
+               DEBUG(5, ("Could not check machine acct\n"));
+               request_error(state);
+               return;
+       }
+
+       if (r->out.result != WINBIND_STATUS_OK) {
+               DEBUG(5, ("check machine acct returned an error:0x%08X\n",
+                       r->out.result));
+               request_error(state);
+               return;
+       }
+
+       request_ok(state);
+}
+
 void winbindd_check_machine_acct(struct winbindd_cli_state *state)
 {
+       struct winbind_trust *r;
+
        DEBUG(3, ("[%5lu]: check machine account\n",
                  (unsigned long)state->pid));
 
-       sendto_domain(state, find_our_domain());
+       r = TALLOC_P(state->mem_ctx, struct winbind_trust);
+       if (!r) goto nomem;
+       r->in.level = TALLOC_P(r, enum winbind_trust_level);
+       if (!r->in.level) goto nomem;
+
+       *r->in.level    = WINBIND_TRUST_LEVEL_COMPAT_CHECK_MACHCC;
+
+       do_async_ndr_domain(state->mem_ctx, find_our_domain(),
+                           NDR_WINBIND_TRUST, r,
+                           winbindd_check_machine_acct_recv, state,
+                           NULL, NULL);
+       return;
+nomem:
+       DEBUG(0, ("talloc failed\n"));
+       request_error(state);
 }
 
 enum winbindd_result winbindd_dual_check_machine_acct(struct winbindd_domain *domain,