diff options
author | no author <devnull@mit.edu> | 2003-04-09 00:10:14 +0000 |
---|---|---|
committer | no author <devnull@mit.edu> | 2003-04-09 00:10:14 +0000 |
commit | 9dc0f646d42648fbbde44799c00b25d97d9cbc98 (patch) | |
tree | d7e1bad8215f92673f94df55881b676002da7e8b /src/lib/krb5/os/ccdefname.c | |
parent | 38037332d7af42124646c268874e0833bd8ec30e (diff) | |
download | krb5-9dc0f646d42648fbbde44799c00b25d97d9cbc98.zip krb5-9dc0f646d42648fbbde44799c00b25d97d9cbc98.tar.gz krb5-9dc0f646d42648fbbde44799c00b25d97d9cbc98.tar.bz2 |
This commit was manufactured by cvs2svn to create tagkrb5-1.2.8-final
'krb5-1-2-8-final'.
git-svn-id: svn://anonsvn.mit.edu/krb5/tags/krb5-1-2-8-final@15331 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/os/ccdefname.c')
-rw-r--r-- | src/lib/krb5/os/ccdefname.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lib/krb5/os/ccdefname.c b/src/lib/krb5/os/ccdefname.c index 53e7888..76c7528 100644 --- a/src/lib/krb5/os/ccdefname.c +++ b/src/lib/krb5/os/ccdefname.c @@ -31,8 +31,8 @@ #include "k5-int.h" #include <stdio.h> -#ifdef macintosh -#include "CCache.h" +#if TARGET_OS_MAC +#include <Kerberos/CredentialsCache.h> #endif #if defined(_WIN32) @@ -160,7 +160,7 @@ static krb5_error_code get_from_os(char *name_buf, int name_size) if (get_from_registry_indirect(name_buf, name_size) != 0) return 0; - strncpy(name_buf, prefix, name_size); + strncpy(name_buf, prefix, name_size - 1); name_buf[name_size - 1] = 0; size = name_size - strlen(prefix); if (size > 0) @@ -186,7 +186,7 @@ static krb5_error_code get_from_os(char *name_buf, int name_size) } #endif -#if defined (macintosh) +#if TARGET_OS_MAC static krb5_error_code get_from_os(char *name_buf, int name_size) { @@ -261,6 +261,13 @@ krb5_cc_set_default_name(context, name) return ENOMEM; strcpy(new_name, name_buf); + if (!os_ctx->default_ccname || (strcmp(os_ctx->default_ccname, new_name) != 0)) { + /* the ccache changed... forget the old principal */ + if (os_ctx->default_ccprincipal) + krb5_free_principal (context, os_ctx->default_ccprincipal); + os_ctx->default_ccprincipal = 0; /* we don't care until we use it */ + } + if (os_ctx->default_ccname) free(os_ctx->default_ccname); |