From d73bc5ac6a6b5b6f20e0f77be11f8b4b793d8eeb Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 15 Oct 2008 17:37:21 +0000 Subject: [PATCH] handle stash file names with missing keytab type spec and colon in path Currently the keytab name resolution code will pass off any name with no colon to the default keytab type handler, which is the FILE handler. It will also check for Windows file names consisting of one letter followed by a colon, and treat them as FILE specs also. If a UNIX pathname contains a colon, however, and no type was explicitly specified, the leading part of the pathname gets treated as a type name and fails to match anything. It should instead treat type-less names starting with "/" as FILE specs also. Tweak the test suite to use such a name. Report and patch from Apple. rdar://problem/6179239 ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20872 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/keytab/ktbase.c | 5 +++++ src/tests/dejagnu/config/default.exp | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/keytab/ktbase.c b/src/lib/krb5/keytab/ktbase.c index b68b351c6..9d5174540 100644 --- a/src/lib/krb5/keytab/ktbase.c +++ b/src/lib/krb5/keytab/ktbase.c @@ -181,6 +181,11 @@ krb5_kt_resolve (krb5_context context, const char *name, krb5_keytab *ktid) return ENOMEM; resid = name; + } else if (name[0] == '/') { + pfx = strdup("FILE"); + if (!pfx) + return ENOMEM; + resid = name; } else { resid = name + pfxlen + 1; diff --git a/src/tests/dejagnu/config/default.exp b/src/tests/dejagnu/config/default.exp index 8e5d28e22..0c7b9b092 100644 --- a/src/tests/dejagnu/config/default.exp +++ b/src/tests/dejagnu/config/default.exp @@ -829,7 +829,9 @@ proc setup_kerberos_files { } { # puts $conffile " database_name = $tmppwd/db" puts $conffile " admin_database_name = $tmppwd/adb" puts $conffile " admin_database_lockfile = $tmppwd/adb.lock" - puts $conffile " key_stash_file = $tmppwd/stash" + # Testing with a colon in the name exercises default handling + # for pathnames. + puts $conffile " key_stash_file = $tmppwd/stash:foo" puts $conffile " acl_file = $tmppwd/acl" puts $conffile " kadmind_port = [expr 4 + $portbase]" puts $conffile " kpasswd_port = [expr 5 + $portbase]" -- 2.26.2