summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/krb/gc_via_tkt.c
diff options
context:
space:
mode:
authorSam Hartman <hartmans@mit.edu>2009-05-07 20:35:28 +0000
committerSam Hartman <hartmans@mit.edu>2009-05-07 20:35:28 +0000
commit56e9c98f2871f78130baf3f7c63ce2abe76e02f6 (patch)
tree790497f574323c9b0ea86cd297f50abb65ef4c44 /src/lib/krb5/krb/gc_via_tkt.c
parente464cdfe7e7d969033126bb33febc98ccd75aee9 (diff)
downloadkrb5-56e9c98f2871f78130baf3f7c63ce2abe76e02f6.tar.gz
krb5-56e9c98f2871f78130baf3f7c63ce2abe76e02f6.tar.xz
krb5-56e9c98f2871f78130baf3f7c63ce2abe76e02f6.zip
Try decrypting using session key if subkey fails in tgs rep handling
Heimdal at least up through 1.2 incorrectly encrypts the TGS response in the session key not the subkey when a subkey is supplied. See RFC 4120 page 35. Work around this by trying decryption using the session key after the subkey fails. * decode_kdc_rep.c: rename to krb5int_decode_tgs_rep; only used for TGS and now needs to take keyusage * gc_via_tkt: pass in session key and appropriate usage if subkey fails. Note that the dead code to process AS responses in decode_kdc_rep is not removed by this commit. That will be removed as FAST TGS client support is integrated post 1.7. ticket: 6484 Tags: pullup Target_Version: 1.7 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22325 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/krb/gc_via_tkt.c')
-rw-r--r--src/lib/krb5/krb/gc_via_tkt.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/krb5/krb/gc_via_tkt.c b/src/lib/krb5/krb/gc_via_tkt.c
index e8dbd97fec..83c8026fcd 100644
--- a/src/lib/krb5/krb/gc_via_tkt.c
+++ b/src/lib/krb5/krb/gc_via_tkt.c
@@ -290,9 +290,17 @@ krb5_get_cred_via_tkt (krb5_context context, krb5_creds *tkt,
goto error_4;
}
- if ((retval = krb5_decode_kdc_rep(context, &tgsrep.response,
- subkey, &dec_rep)))
- goto error_4;
+ /* Unfortunately, Heimdal at least up through 1.2 encrypts using
+ the session key not the subsession key. So we try both. */
+ if ((retval = krb5int_decode_tgs_rep(context, &tgsrep.response,
+ subkey,
+ KRB5_KEYUSAGE_TGS_REP_ENCPART_SUBKEY, &dec_rep))) {
+ if ((krb5int_decode_tgs_rep(context, &tgsrep.response,
+ &tkt->keyblock,
+ KRB5_KEYUSAGE_TGS_REP_ENCPART_SESSKEY, &dec_rep)) == 0)
+ retval = 0;
+ else goto error_4;
+ }
if (dec_rep->msg_type != KRB5_TGS_REP) {
retval = KRB5KRB_AP_ERR_MSG_TYPE;