749169
From fd44fa60948a58634a3757be7c5c52fc671e48c7 Mon Sep 17 00:00:00 2001
665228
From: Greg Hudson <ghudson@mit.edu>
665228
Date: Mon, 16 Jan 2017 13:42:18 -0500
665228
Subject: [PATCH] Remove sent_nontrivial_preauth field
665228
665228
In krb5_init_creds_context, the selected_preauth_type field subsumes
665228
the need for sent_nontrivial_preauth.  Use it instead.
665228
665228
(cherry picked from commit 5fef7aa7e43e45d227f2d53c661a23c932caafca)
665228
---
665228
 src/lib/krb5/krb/get_in_tkt.c     | 5 +----
665228
 src/lib/krb5/krb/init_creds_ctx.h | 1 -
665228
 2 files changed, 1 insertion(+), 5 deletions(-)
665228
665228
diff --git a/src/lib/krb5/krb/get_in_tkt.c b/src/lib/krb5/krb/get_in_tkt.c
665228
index 988fca233..48dc00ea6 100644
665228
--- a/src/lib/krb5/krb/get_in_tkt.c
665228
+++ b/src/lib/krb5/krb/get_in_tkt.c
665228
@@ -1359,8 +1359,6 @@ init_creds_step_request(krb5_context context,
665228
         krb5_free_data(context, ctx->encoded_previous_request);
665228
         ctx->encoded_previous_request = NULL;
665228
     }
665228
-    if (ctx->request->padata)
665228
-        ctx->sent_nontrivial_preauth = TRUE;
665228
     if (ctx->enc_pa_rep_permitted) {
665228
         code = add_padata(&ctx->request->padata, KRB5_ENCPADATA_REQ_ENC_PA_REP,
665228
                           NULL, 0);
665228
@@ -1485,7 +1483,7 @@ init_creds_step_reply(krb5_context context,
665228
             ctx->restarted = TRUE;
665228
             code = restart_init_creds_loop(context, ctx, TRUE);
665228
         } else if (!ctx->restarted && reply_code == KDC_ERR_PREAUTH_FAILED &&
665228
-                   !ctx->sent_nontrivial_preauth) {
665228
+                   ctx->selected_preauth_type == KRB5_PADATA_NONE) {
665228
             /* The KDC didn't like our informational padata (probably a pre-1.7
665228
              * MIT krb5 KDC).  Retry without it. */
665228
             ctx->enc_pa_rep_permitted = FALSE;
665228
@@ -1525,7 +1523,6 @@ init_creds_step_reply(krb5_context context,
665228
                 goto cleanup;
665228
             /* Reset per-realm negotiation state. */
665228
             ctx->restarted = FALSE;
665228
-            ctx->sent_nontrivial_preauth = FALSE;
665228
             ctx->enc_pa_rep_permitted = TRUE;
665228
             code = restart_init_creds_loop(context, ctx, FALSE);
665228
         } else {
665228
diff --git a/src/lib/krb5/krb/init_creds_ctx.h b/src/lib/krb5/krb/init_creds_ctx.h
665228
index a7cded942..8c8b7494b 100644
665228
--- a/src/lib/krb5/krb/init_creds_ctx.h
665228
+++ b/src/lib/krb5/krb/init_creds_ctx.h
665228
@@ -58,7 +58,6 @@ struct _krb5_init_creds_context {
665228
     krb5_enctype etype;
665228
     krb5_boolean enc_pa_rep_permitted;
665228
     krb5_boolean restarted;
665228
-    krb5_boolean sent_nontrivial_preauth;
665228
     krb5_boolean preauth_required;
665228
     struct krb5_responder_context_st rctx;
665228
     krb5_preauthtype selected_preauth_type;