From 94b8a9d6c5a339fb579077b0b3d19e541c95a5a5 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 13 Apr 2004 20:08:40 +0000 Subject: [PATCH] Treat keytab and ccache names without prefixes as type FILE: on Windows if there is a drive letter found at the beginning of the name. ticket: new tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16246 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/ChangeLog | 8 ++++++++ src/lib/krb5/ccache/ccbase.c | 25 +++++++++++++++++++------ src/lib/krb5/keytab/ChangeLog | 6 ++++++ src/lib/krb5/keytab/ktbase.c | 28 +++++++++++++++++----------- 4 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index afafc17a7..d24e8e112 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,11 @@ +2004-04-13 Jeffrey Altman + + * ccbase.c: + On Windows, if there is a ccache name provided without + a prefix but which appears to start with a drive letter, + treat it as a FILE: ccache instead of failing with a + ccache type unknown error. + 2004-04-13 Jeffrey Altman * ccbase.c: diff --git a/src/lib/krb5/ccache/ccbase.c b/src/lib/krb5/ccache/ccbase.c index 47ada5080..35032a5d1 100644 --- a/src/lib/krb5/ccache/ccbase.c +++ b/src/lib/krb5/ccache/ccbase.c @@ -119,14 +119,27 @@ krb5_cc_resolve (krb5_context context, const char *name, krb5_ccache *cache) pfxlen = cp - name; - resid = name + pfxlen + 1; +#if defined(_WIN32) + if ( pfxlen == 1 && isalpha(name[0]) ) { + /* We found a drive letter not a prefix - use FILE: */ + pfx = strdup("FILE:"); + if (!pfx) + return ENOMEM; + + resid = name; + } else { +#endif + resid = name + pfxlen + 1; - pfx = malloc (pfxlen+1); - if (!pfx) - return ENOMEM; + pfx = malloc (pfxlen+1); + if (!pfx) + return ENOMEM; - memcpy (pfx, name, pfxlen); - pfx[pfxlen] = '\0'; + memcpy (pfx, name, pfxlen); + pfx[pfxlen] = '\0'; +#if defined(_WIN32) + } +#endif *cache = (krb5_ccache) 0; diff --git a/src/lib/krb5/keytab/ChangeLog b/src/lib/krb5/keytab/ChangeLog index 6d84ccd70..dd07ca64a 100644 --- a/src/lib/krb5/keytab/ChangeLog +++ b/src/lib/krb5/keytab/ChangeLog @@ -1,3 +1,9 @@ +2004-04-13 Jeffrey Altman + + * ktbase.c: On Windows, improve the treat drive letter + prefix string as a FILE: keytab change to work if the + default keytab type was changed to not be of type FILE: + 2004-04-08 Jeffrey Altman * ktbase.c: Restore the thread safety fixes diff --git a/src/lib/krb5/keytab/ktbase.c b/src/lib/krb5/keytab/ktbase.c index 95a073965..6c5d02a3f 100644 --- a/src/lib/krb5/keytab/ktbase.c +++ b/src/lib/krb5/keytab/ktbase.c @@ -114,20 +114,26 @@ krb5_kt_resolve (krb5_context context, const char *name, krb5_keytab *ktid) pfxlen = cp - name; #if defined(_WIN32) - if ( pfxlen == 1 ) { - /* We found a drive letter not a prefix */ - return (*krb5_kt_dfl_ops.resolve)(context, name, ktid); - } + if ( pfxlen == 1 && isalpha(name[0]) ) { + /* We found a drive letter not a prefix - use FILE: */ + pfx = strdup("FILE:"); + if (!pfx) + return ENOMEM; + + resid = name; + } else { #endif - - resid = name + pfxlen + 1; + resid = name + pfxlen + 1; - pfx = malloc (pfxlen+1); - if (!pfx) - return ENOMEM; + pfx = malloc (pfxlen+1); + if (!pfx) + return ENOMEM; - memcpy (pfx, name, pfxlen); - pfx[pfxlen] = '\0'; + memcpy (pfx, name, pfxlen); + pfx[pfxlen] = '\0'; +#if defined(_WIN32) + } +#endif *ktid = (krb5_keytab) 0; -- 2.26.2