[30296] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Don't rely on default realm in S4U2Self client

daemon@ATHENA.MIT.EDU (Greg Hudson)
Wed Sep 26 21:35:46 2018

Date: Wed, 26 Sep 2018 21:35:35 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201809270135.w8R1ZZHL022198@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/13967567ca65a306c2d5fcb4a4aff71fb422cd80
commit 13967567ca65a306c2d5fcb4a4aff71fb422cd80
Author: Isaac Boukris <iboukris@gmail.com>
Date:   Sat Sep 15 10:28:48 2018 +0300

    Don't rely on default realm in S4U2Self client
    
    When converting server principal to enterprise name (to be possibly
    used for cross-realm), ignore the realm when reparsing, to avoid a
    spurious error if a default realm isn't configured.
    
    [ghudson@mit.edu: added rewritten test case; edited commit message]
    
    ticket: 8741
    tags: pullup
    target_version: 1.16-next
    target_version: 1.15-next

 src/lib/krb5/krb/s4u_creds.c |    4 +++-
 src/tests/gssapi/t_s4u.py    |    5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/lib/krb5/krb/s4u_creds.c b/src/lib/krb5/krb/s4u_creds.c
index ed05b67..91c02aa 100644
--- a/src/lib/krb5/krb/s4u_creds.c
+++ b/src/lib/krb5/krb/s4u_creds.c
@@ -452,7 +452,9 @@ convert_to_enterprise(krb5_context context, krb5_principal princ,
     code = krb5_unparse_name(context, princ, &str);
     if (code != 0)
         return code;
-    code = krb5_parse_name_flags(context, str, KRB5_PRINCIPAL_PARSE_ENTERPRISE,
+    code = krb5_parse_name_flags(context, str,
+                                 KRB5_PRINCIPAL_PARSE_ENTERPRISE |
+                                 KRB5_PRINCIPAL_PARSE_IGNORE_REALM,
                                  eprinc_out);
     krb5_free_unparsed_name(context, str);
     return code;
diff --git a/src/tests/gssapi/t_s4u.py b/src/tests/gssapi/t_s4u.py
index fc9d9e8..35bc9e4 100755
--- a/src/tests/gssapi/t_s4u.py
+++ b/src/tests/gssapi/t_s4u.py
@@ -141,9 +141,12 @@ realm.stop()
 
 # Exercise cross-realm S4U2Self.  The query in the foreign realm will
 # fail, but we can check that the right server principal was used.
+# Include a regression test for #8741 by unsetting the default realm.
 r1, r2 = cross_realms(2, create_user=False)
 r1.run([kinit, '-k', r1.host_princ])
-r1.run(['./t_s4u', 'p:' + r2.host_princ], expected_code=1,
+remove_default = {'libdefaults': {'default_realm': None}}
+no_default = r1.special_env('no_default', False, krb5_conf=remove_default)
+r1.run(['./t_s4u', 'p:' + r2.host_princ], env=no_default, expected_code=1,
        expected_msg='Server not found in Kerberos database')
 r1.stop()
 r2.stop()
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post