483b06
From 542c31e057cbd4bd6261abcc883ace14f69719d6 Mon Sep 17 00:00:00 2001
483b06
From: Simo Sorce <simo@redhat.com>
483b06
Date: Mon, 10 Apr 2017 15:32:54 -0400
483b06
Subject: [PATCH] Fix s4u2self with adtrust
483b06
483b06
When ADtrust is installed we add a PAC to all tickets, during protocol
483b06
transition we need to generate a new PAC for the requested user ticket,
483b06
not check the existing PAC on the requestor ticket.
483b06
483b06
https://pagure.io/freeipa/issue/6862
483b06
483b06
Signed-off-by: Simo Sorce <simo@redhat.com>
483b06
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
483b06
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
483b06
---
483b06
 daemons/ipa-kdb/ipa_kdb_mspac.c | 14 ++++++++++----
483b06
 1 file changed, 10 insertions(+), 4 deletions(-)
483b06
483b06
diff --git a/daemons/ipa-kdb/ipa_kdb_mspac.c b/daemons/ipa-kdb/ipa_kdb_mspac.c
483b06
index cf1bd5b4eaf6ac8eba92639cc48cb7c333a6e836..00cc19ca1e757e28530eafcd38ebf73003e251e3 100644
483b06
--- a/daemons/ipa-kdb/ipa_kdb_mspac.c
483b06
+++ b/daemons/ipa-kdb/ipa_kdb_mspac.c
483b06
@@ -2117,6 +2117,7 @@ krb5_error_code ipadb_sign_authdata(krb5_context context,
483b06
     struct ipadb_context *ipactx;
483b06
     bool with_pac;
483b06
     bool with_pad;
483b06
+    bool make_ad = false;
483b06
     int result;
483b06
     krb5_db_entry *client_entry = NULL;
483b06
     krb5_boolean is_equal;
483b06
@@ -2165,7 +2166,14 @@ krb5_error_code ipadb_sign_authdata(krb5_context context,
483b06
                                   "currently not supported.");
483b06
     }
483b06
 
483b06
-    if (is_as_req && with_pac && (flags & KRB5_KDB_FLAG_INCLUDE_PAC)) {
483b06
+    /* we need to create a PAC if we are requested one and this is an AS REQ,
483b06
+     * or we are doing protocol transition (s4u2self) */
483b06
+    if ((is_as_req && (flags & KRB5_KDB_FLAG_INCLUDE_PAC)) ||
483b06
+        (flags & KRB5_KDB_FLAG_PROTOCOL_TRANSITION)) {
483b06
+        make_ad = true;
483b06
+    }
483b06
+
483b06
+    if (with_pac && make_ad) {
483b06
         /* Be aggressive here: special case for discovering range type
483b06
          * immediately after establishing the trust by IPA framework */
483b06
         if ((krb5_princ_size(context, ks_client_princ) == 2) &&
483b06
@@ -2188,9 +2196,7 @@ krb5_error_code ipadb_sign_authdata(krb5_context context,
483b06
         if (kerr != 0 && kerr != ENOENT) {
483b06
             goto done;
483b06
         }
483b06
-    }
483b06
-
483b06
-    if (!is_as_req && with_pac) {
483b06
+    } else if (with_pac && !is_as_req) {
483b06
         /* find the existing PAC, if present */
483b06
         kerr = krb5_find_authdata(context, tgt_auth_data, NULL,
483b06
                                   KRB5_AUTHDATA_WIN2K_PAC, &pac_auth_data);
483b06
-- 
483b06
2.9.3
483b06