From: Ken Raeburn Date: Wed, 14 Jul 2004 01:54:16 +0000 (+0000) Subject: * set_ccache.c (gss_krb5_ccache_name): Check thread-specific data for the saved X-Git-Tag: krb5-1.4-beta1~213 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d101263e02d4cf872678a236a2685f12b829244a;p=krb5.git * set_ccache.c (gss_krb5_ccache_name): Check thread-specific data for the saved "old" name to free. Save the new old name in thread-specific data. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16594 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index e1972de6f..b4f4ee27e 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -6,6 +6,10 @@ the mutex while manipulating krb5_gss_keytab. * gssapiP_krb5.h (gssint_krb5_keytab_lock): Declare. + * set_ccache.c (gss_krb5_ccache_name): Check thread-specific data + for the saved "old" name to free. Save the new old name in + thread-specific data. + 2004-07-08 Ken Raeburn * Makefile.in (LOCALINCLUDES): Add $(srcdir)/.. to the list. diff --git a/src/lib/gssapi/krb5/set_ccache.c b/src/lib/gssapi/krb5/set_ccache.c index 9a6cdda70..27422017b 100644 --- a/src/lib/gssapi/krb5/set_ccache.c +++ b/src/lib/gssapi/krb5/set_ccache.c @@ -36,12 +36,20 @@ gss_krb5_ccache_name(minor_status, name, out_name) const char *name; const char **out_name; { - static char *gss_out_name = NULL; - char *old_name = NULL; OM_uint32 err = 0; OM_uint32 minor = 0; + char *gss_out_name; + + err = gssint_initialize_library(); + if (err) { + *minor_status = err; + return GSS_S_FAILURE; + } + + gss_out_name = k5_getspecific(K5_KEY_GSS_KRB5_SET_CCACHE_OLD_NAME); + if (out_name) { const char *tmp_name = NULL; @@ -61,8 +69,8 @@ gss_krb5_ccache_name(minor_status, name, out_name) } if (!err) { - char *swap = NULL; - + char *swap = NULL; + swap = gss_out_name; gss_out_name = old_name; old_name = swap; @@ -74,7 +82,20 @@ gss_krb5_ccache_name(minor_status, name, out_name) err = minor; } } - + + minor = k5_setspecific(K5_KEY_GSS_KRB5_SET_CCACHE_OLD_NAME, gss_out_name); + if (minor) { + /* Um. Now what? */ + if (err == 0) { + err = minor; + if (out_name != NULL) { + *out_name = NULL; + out_name = NULL; + } + } + free(gss_out_name); + } + if (!err) { if (out_name) { *out_name = gss_out_name;