From: Greg Hudson Date: Mon, 11 Oct 2010 16:43:42 +0000 (+0000) Subject: When returning KRB5_KT_NOTFOUND from krb5_ktfile_get_entry, set an X-Git-Tag: krb5-1.9-beta1~19 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9742a17307c9c9937826a576daf70db137cdf78c;p=krb5.git When returning KRB5_KT_NOTFOUND from krb5_ktfile_get_entry, set an extended error message indicating which principal was not found. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24448 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/keytab/kt_file.c b/src/lib/krb5/keytab/kt_file.c index 80070bcf5..5246009ca 100644 --- a/src/lib/krb5/keytab/kt_file.c +++ b/src/lib/krb5/keytab/kt_file.c @@ -253,6 +253,7 @@ krb5_ktfile_get_entry(krb5_context context, krb5_keytab id, krb5_boolean similar; int kvno_offset = 0; int was_open; + char *princname; kerror = KTLOCK(id); if (kerror) @@ -375,8 +376,14 @@ krb5_ktfile_get_entry(krb5_context context, krb5_keytab id, kerror = 0; else if (found_wrong_kvno) kerror = KRB5_KT_KVNONOTFOUND; - else + else { kerror = KRB5_KT_NOTFOUND; + if (krb5_unparse_name(context, principal, &princname) == 0) { + krb5_set_error_message(context, kerror, "No key table entry " + "found for %s", princname); + free(princname); + } + } } if (kerror) { if (was_open == 0)