auth/spnego: simplify the error handling logic in gensec_spnego_parse_negTokenInit()
authorStefan Metzmacher <metze@samba.org>
Fri, 7 Jul 2017 05:53:29 +0000 (07:53 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 25 Jul 2017 11:51:07 +0000 (13:51 +0200)
We can just use GENSEC_UPDATE_IS_NTERROR() as NT_STATUS_INVALID_PARAMETER
is mapped to NT_STATUS_MORE_PROCESSING_REQUIRED in the lines above.

Check with git show -U10

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

index 9291332d1903bbf7fa5759511892aef7c15aadfb..cec44bc1e2bec85c038c8051c5e1623b65253720 100644 (file)
@@ -414,9 +414,7 @@ static NTSTATUS gensec_spnego_parse_negTokenInit(struct gensec_security *gensec_
                        nt_status = NT_STATUS_MORE_PROCESSING_REQUIRED;
                }
 
-               if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_INVALID_PARAMETER) 
-                   && !NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED) 
-                   && !NT_STATUS_IS_OK(nt_status)) {
+               if (GENSEC_UPDATE_IS_NTERROR(nt_status)) {
                        DEBUG(1, ("SPNEGO(%s) NEG_TOKEN_INIT failed: %s\n", 
                                  spnego_state->sub_sec_security->ops->name, nt_errstr(nt_status)));
 
@@ -428,7 +426,7 @@ static NTSTATUS gensec_spnego_parse_negTokenInit(struct gensec_security *gensec_
                        return nt_status;
                }
 
-               return nt_status; /* OK, INVALID_PARAMETER ore MORE PROCESSING */
+               return nt_status; /* OK or MORE PROCESSING */
        }
 
        DEBUG(1, ("SPNEGO: Could not find a suitable mechtype in NEG_TOKEN_INIT\n"));