krb5 commit: Fix caching of user-to-user tickets

ghudson at mit.edu ghudson at mit.edu
Tue Nov 17 15:21:27 EST 2026


https://github.com/krb5/krb5/commit/5966c6bc23d4d6e59c6a6bf70eed99cb589d7500
commit 5966c6bc23d4d6e59c6a6bf70eed99cb589d7500
Author: William Gross <wgross1172 at gmail.com>
Date:   Sat Nov 7 20:24:07 2026 +0000

    Fix caching of user-to-user tickets
    
    In krb5int_process_tgs_reply(), set is_skey to 0 or 1, not 0 or
    KDC_OPT_ENC_TKT_IN_SKEY (8), so that the stored credential matches a
    krb5_getcredentials() request with KRB5_GC_USER_USER set.
    
    This bug was introduced in release 1.17 by commit
    6d8c598d7c226b0fb594892b261386c37b47da1e (ticket 8721), which changed
    krb5int_process_tgs_reply() and kdcrep2creds() to set the is_skey
    field based on KDC flags rather than the presence of a second ticket.
    
    [ghudson at mit.edu: rewrote commit message and test script comment]
    
    ticket: 9289 (new)
    tags: pullup
    target_version: 1.22-next

 src/lib/krb5/krb/gc_via_tkt.c | 2 +-
 src/tests/t_u2u.py            | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lib/krb5/krb/gc_via_tkt.c b/src/lib/krb5/krb/gc_via_tkt.c
index 59957273c..5e6430336 100644
--- a/src/lib/krb5/krb/gc_via_tkt.c
+++ b/src/lib/krb5/krb/gc_via_tkt.c
@@ -315,7 +315,7 @@ krb5int_process_tgs_reply(krb5_context context,
         dec_rep->enc_part2->enc_padata = NULL;
     }
 
-    is_skey = (kdcoptions & KDC_OPT_ENC_TKT_IN_SKEY);
+    is_skey = (kdcoptions & KDC_OPT_ENC_TKT_IN_SKEY) != 0;
     retval = kdcrep2creds(context, dec_rep, address, is_skey,
                           &in_cred->second_ticket, out_cred);
     if (retval != 0)
diff --git a/src/tests/t_u2u.py b/src/tests/t_u2u.py
index 4b8a82a2f..f22919df9 100644
--- a/src/tests/t_u2u.py
+++ b/src/tests/t_u2u.py
@@ -19,6 +19,9 @@ realm.run([kadminl, 'modprinc', '-allow_svr', 'alice'])
 realm.run([kvno, 'alice'], expected_code=1,
           expected_msg='Server principal valid for user2user only')
 realm.run([kvno, '--u2u', u2u_ccache, 'alice'], expected_msg='kvno = 0')
+# Make the same request again.  If it isn't answered from the ccache
+# as expected, the ticket count below will be 3 instead of 2.
+realm.run([kvno, '--u2u', u2u_ccache, 'alice'], expected_msg='kvno = 0')
 realm.run([kadminl, 'modprinc', '+allow_svr', 'alice'])
 
 # Verify that normal lookups ignore the user-to-user ticket.


More information about the cvs-krb5 mailing list