s3-winbind: Pass ping-dc result to client
authorChristof Schmitt <christof.schmitt@us.ibm.com>
Thu, 9 Aug 2012 22:07:16 +0000 (15:07 -0700)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 15 Aug 2012 01:44:42 +0000 (11:44 +1000)
The client checks for an error code in response.data.auth.nt_status,
make sure the result is stored there.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source3/winbindd/winbindd_ping_dc.c

index 2304828030b3e6c3463dc0c084010144d08bc35a..7f52040a04ad88ecc7a6df8eef1fd1b75ba882ed 100644 (file)
@@ -22,7 +22,7 @@
 #include "librpc/gen_ndr/ndr_wbint_c.h"
 
 struct winbindd_ping_dc_state {
-       uint8_t dummy;
+       NTSTATUS result;
 };
 
 static void winbindd_ping_dc_done(struct tevent_req *subreq);
@@ -78,6 +78,7 @@ static void winbindd_ping_dc_done(struct tevent_req *subreq)
        NTSTATUS status, result;
 
        status = dcerpc_wbint_PingDc_recv(subreq, state, &result);
+       state->result = result;
        if (any_nt_status_not_ok(status, result, &status)) {
                tevent_req_nterror(req, status);
                return;
@@ -88,5 +89,12 @@ static void winbindd_ping_dc_done(struct tevent_req *subreq)
 NTSTATUS winbindd_ping_dc_recv(struct tevent_req *req,
                               struct winbindd_response *presp)
 {
+       struct winbindd_ping_dc_state *state = tevent_req_data(
+               req, struct winbindd_ping_dc_state);
+
+       if (!NT_STATUS_IS_OK(state->result)) {
+               set_auth_errors(presp, state->result);
+       }
+
        return tevent_req_simple_recv_ntstatus(req);
 }