From 4b55062de5a8ccd31d71cd63a4bf99eb99c64b17 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Tue, 19 Dec 2006 05:05:37 +0000 Subject: [PATCH] pull up r18975 from trunk r18975@cathode-dark-space: raeburn | 2006-12-18 20:31:11 -0500 ticket: 5121 tags: pullup ktfns.c (krb5_kt_get_entry): If the supplied server principal has an empty realm name, replace it with the default realm, in a private copy. ticket: 5121 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@18979 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/keytab/ktfns.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/keytab/ktfns.c b/src/lib/krb5/keytab/ktfns.c index 70da40695..63fa6399b 100644 --- a/src/lib/krb5/keytab/ktfns.c +++ b/src/lib/krb5/keytab/ktfns.c @@ -54,7 +54,24 @@ krb5_kt_get_entry(krb5_context context, krb5_keytab keytab, krb5_const_principal principal, krb5_kvno vno, krb5_enctype enctype, krb5_keytab_entry *entry) { - return krb5_x((keytab)->ops->get,(context, keytab, principal, vno, enctype, entry)); + krb5_error_code err; + krb5_principal_data princ_data; + + if (krb5_is_referral_realm(&principal->realm)) { + char *realm; + princ_data = *principal; + principal = &princ_data; + err = krb5_get_default_realm(context, &realm); + if (err) + return err; + princ_data.realm.data = realm; + princ_data.realm.length = strlen(realm); + } + err = krb5_x((keytab)->ops->get,(context, keytab, principal, vno, enctype, + entry)); + if (principal == &princ_data) + krb5_free_default_realm(context, princ_data.realm.data); + return err; } krb5_error_code KRB5_CALLCONV -- 2.26.2