auth/spnego: use a helper variable for spnego.negTokenInit.targetPrincipal
authorStefan Metzmacher <metze@samba.org>
Wed, 14 Jun 2017 01:33:21 +0000 (03:33 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 5 Jul 2017 00:17:12 +0000 (02:17 +0200)
This makes the lines a bit shorter and the future diff easier to review.

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

index 3256f7645fe9e19b2b0d0159cbd0bbbba75171ec..831dafdd81747e25c992786ff1b744e9a9bc0839 100644 (file)
@@ -641,6 +641,7 @@ static NTSTATUS gensec_spnego_update_client(struct gensec_security *gensec_secur
                const char *my_mechs[] = {NULL, NULL};
                NTSTATUS nt_status = NT_STATUS_INVALID_PARAMETER;
                bool ok;
+               const char *tp = NULL;
 
                if (!in.length) {
                        /* client to produce negTokenInit */
@@ -668,11 +669,11 @@ static NTSTATUS gensec_spnego_update_client(struct gensec_security *gensec_secur
                        return NT_STATUS_INVALID_PARAMETER;
                }
 
-               if (spnego.negTokenInit.targetPrincipal
-                   && strcmp(spnego.negTokenInit.targetPrincipal, ADS_IGNORE_PRINCIPAL) != 0) {
-                       DEBUG(5, ("Server claims it's principal name is %s\n", spnego.negTokenInit.targetPrincipal));
+               tp = spnego.negTokenInit.targetPrincipal;
+               if (tp != NULL && strcmp(tp, ADS_IGNORE_PRINCIPAL) != 0) {
+                       DEBUG(5, ("Server claims it's principal name is %s\n", tp));
                        if (lpcfg_client_use_spnego_principal(gensec_security->settings->lp_ctx)) {
-                               gensec_set_target_principal(gensec_security, spnego.negTokenInit.targetPrincipal);
+                               gensec_set_target_principal(gensec_security, tp);
                        }
                }