s3:idmap_ldap: rename idmap_ldap_allocate_id to idmap_ldap_allocate_id_internal
[samba.git] / source3 / winbindd / winbindd_check_machine_acct.c
index 610e9edfaaca30f72c2bdfc343f267892ee26070..279370146a611e27554122b535415ad6bf873ca4 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "includes.h"
 #include "winbindd.h"
-#include "librpc/gen_ndr/cli_wbint.h"
+#include "librpc/gen_ndr/ndr_wbint_c.h"
 
 struct winbindd_check_machine_acct_state {
        uint8_t dummy;
@@ -42,7 +42,7 @@ struct tevent_req *winbindd_check_machine_acct_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       if (request->domain_name[0] == '0') {
+       if (request->domain_name[0] == '\0') {
                /* preserve old behavior, when no domain name is given */
                domain = find_our_domain();
        } else {
@@ -61,8 +61,8 @@ struct tevent_req *winbindd_check_machine_acct_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       subreq = rpccli_wbint_CheckMachineAccount_send(state, ev,
-                                                      domain->child.rpccli);
+       subreq = dcerpc_wbint_CheckMachineAccount_send(state, ev,
+                                                      dom_child_handle(domain));
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -78,20 +78,19 @@ static void winbindd_check_machine_acct_done(struct tevent_req *subreq)
                req, struct winbindd_check_machine_acct_state);
        NTSTATUS status, result;
 
-       status = rpccli_wbint_CheckMachineAccount_recv(subreq, state, &result);
-       if (!NT_STATUS_IS_OK(status)) {
+       status = dcerpc_wbint_CheckMachineAccount_recv(subreq, state, &result);
+       if (any_nt_status_not_ok(status, result, &status)) {
                tevent_req_nterror(req, status);
                return;
        }
-       if (!NT_STATUS_IS_OK(result)) {
-               tevent_req_nterror(req, result);
-               return;
-       }
        tevent_req_done(req);
 }
 
 NTSTATUS winbindd_check_machine_acct_recv(struct tevent_req *req,
                                          struct winbindd_response *presp)
 {
-       return tevent_req_simple_recv_ntstatus(req);
+       NTSTATUS status = tevent_req_simple_recv_ntstatus(req);
+
+       set_auth_errors(presp, status);
+       return status;
 }