auth/spnego: make use of GENSEC_UPDATE_IS_NTERROR() in gensec_spnego_update_send()
authorStefan Metzmacher <metze@samba.org>
Wed, 28 Jun 2017 12:53:49 +0000 (14:53 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 25 Jul 2017 11:51:07 +0000 (13:51 +0200)
Check with git show -U15

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
auth/gensec/spnego.c

index cec44bc1e2bec85c038c8051c5e1623b65253720..fe819ad749f616bb4425ab24c2841af246fca9d5 100644 (file)
@@ -1245,15 +1245,12 @@ static struct tevent_req *gensec_spnego_update_send(TALLOC_CTX *mem_ctx,
 
                status = gensec_spnego_update_out(gensec_security,
                                                  state, &state->out);
-               state->status = status;
-               if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-                       tevent_req_done(req);
-                       return tevent_req_post(req, ev);
-               }
-               if (tevent_req_nterror(req, status)) {
+               if (GENSEC_UPDATE_IS_NTERROR(status)) {
+                       tevent_req_nterror(req, status);
                        return tevent_req_post(req, ev);
                }
 
+               state->status = status;
                tevent_req_done(req);
                return tevent_req_post(req, ev);
        }
@@ -1390,6 +1387,11 @@ static struct tevent_req *gensec_spnego_update_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
+       if (GENSEC_UPDATE_IS_NTERROR(status)) {
+               tevent_req_nterror(req, status);
+               return tevent_req_post(req, ev);
+       }
+
        if (NT_STATUS_IS_OK(status)) {
                bool reset_full = true;
 
@@ -1397,26 +1399,21 @@ static struct tevent_req *gensec_spnego_update_send(TALLOC_CTX *mem_ctx,
 
                status = gensec_may_reset_crypto(spnego_state->sub_sec_security,
                                                 reset_full);
-       }
-       if (!NT_STATUS_IS_OK(status) &&
-           !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-               tevent_req_nterror(req, status);
-               return tevent_req_post(req, ev);
+               if (tevent_req_nterror(req, status)) {
+                       return tevent_req_post(req, ev);
+               }
        }
 
        spnego_state->out_status = status;
 
        status = gensec_spnego_update_out(gensec_security,
                                          state, &state->out);
-       state->status = status;
-       if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-               tevent_req_done(req);
-               return tevent_req_post(req, ev);
-       }
-       if (tevent_req_nterror(req, status)) {
+       if (GENSEC_UPDATE_IS_NTERROR(status)) {
+               tevent_req_nterror(req, status);
                return tevent_req_post(req, ev);
        }
 
+       state->status = status;
        tevent_req_done(req);
        return tevent_req_post(req, ev);
 }