]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Allow KDC to canonicalize realm in TGS client 1108/head
authorGreg Hudson <ghudson@mit.edu>
Wed, 26 Aug 2020 20:49:37 +0000 (16:49 -0400)
committerGreg Hudson <ghudson@mit.edu>
Tue, 3 Nov 2020 15:26:00 +0000 (10:26 -0500)
Active Directory canonicalizes the srealm field of TGS replies,
whether or not the client requests canonicalization.  Allow this for
regular TGS and S4U2Self referrals queries by comparing only the name
part of the service principal.  The S4U2Proxy code is already correct.

ticket: 8943 (new)

src/lib/krb5/krb/get_creds.c
src/lib/krb5/krb/s4u_creds.c

index c35b8d6287400e66f44c28877d47aed931f8d1ff..b693f5888831e12e131e5b5475f26ca3878e3a56 100644 (file)
@@ -571,10 +571,12 @@ step_referrals(krb5_context context, krb5_tkt_creds_context ctx)
     if (ctx->reply_code != 0)
         return try_fallback(context, ctx);
 
-    if (krb5_principal_compare(context, ctx->reply_creds->server,
-                               ctx->server)) {
-        /* We got the ticket we asked for... but we didn't necessarily ask for
-         * it with the right enctypes.  Try a non-referral request if so. */
+    /* Check if we got the ticket we asked for.  Allow the KDC to canonicalize
+     * the realm. */
+    if (krb5_principal_compare_any_realm(context, ctx->reply_creds->server,
+                                         ctx->server)) {
+        /* We didn't necessarily ask for it with the right enctypes.  Try a
+         * non-referral request if so. */
         if (wrong_enctype(context, ctx->reply_creds->keyblock.enctype)) {
             TRACE_TKT_CREDS_WRONG_ENCTYPE(context);
             return begin_non_referral(context, ctx);
index b4481101bc708bb82365c76d96ffcfe3de780393..44d113e7c5260b007e7ad0246021e3577e4da51e 100644 (file)
@@ -592,9 +592,8 @@ krb5_get_self_cred_from_kdc(krb5_context context,
         /* Only include a cert in the initial request to the client realm. */
         s4u_user.user_id.subject_cert = empty_data();
 
-        if (krb5_principal_compare(context,
-                                   in_creds->server,
-                                   (*out_creds)->server)) {
+        if (krb5_principal_compare_any_realm(context, in_creds->server,
+                                             (*out_creds)->server)) {
             /* Verify that the unprotected client name in the reply matches the
              * checksum-protected one from the client realm's KDC padata. */
             if (!krb5_principal_compare(context, (*out_creds)->client,