From 9091874cf4f8d948ca567c65bb97a80224413376 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Wed, 23 Mar 2005 03:27:29 +0000 Subject: [PATCH] pullup from trunk ticket: 2888 version_fixed: 1.4.1 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@17143 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/ChangeLog | 4 ++++ src/lib/gssapi/gss_libinit.c | 3 +++ src/lib/krb5/ChangeLog | 4 ++++ src/lib/krb5/krb5_libinit.c | 6 ++++-- src/util/et/ChangeLog | 4 ++++ src/util/et/error_message.c | 5 ++++- src/util/support/ChangeLog | 5 +++++ src/util/support/threads.c | 7 +++++-- 8 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/lib/gssapi/ChangeLog b/src/lib/gssapi/ChangeLog index 90ac10e40..af50c5e46 100644 --- a/src/lib/gssapi/ChangeLog +++ b/src/lib/gssapi/ChangeLog @@ -1,3 +1,7 @@ +2005-01-17 Jeffrey Altman + + * gss_libinit.c: implement cleanup of mutexes, static vars, etc for Windows + 2004-07-29 Sam Hartman * libgssapi_krb5.exports: Add lucid context routines and gss_krb5_set_allowable_enctypes diff --git a/src/lib/gssapi/gss_libinit.c b/src/lib/gssapi/gss_libinit.c index a43989f0c..d45ac440c 100644 --- a/src/lib/gssapi/gss_libinit.c +++ b/src/lib/gssapi/gss_libinit.c @@ -41,7 +41,10 @@ void gssint_lib_fini(void) remove_error_table(&et_k5g_error_table); remove_error_table(&et_ggss_error_table); #endif + k5_key_delete(K5_KEY_GSS_KRB5_SET_CCACHE_OLD_NAME); + k5_key_delete(K5_KEY_GSS_KRB5_CCACHE_NAME); k5_mutex_destroy(&kg_vdb.mutex); + k5_mutex_destroy(&gssint_krb5_keytab_lock); } OM_uint32 gssint_initialize_library (void) diff --git a/src/lib/krb5/ChangeLog b/src/lib/krb5/ChangeLog index ef206a9ba..698912e50 100644 --- a/src/lib/krb5/ChangeLog +++ b/src/lib/krb5/ChangeLog @@ -1,3 +1,7 @@ +2005-01-17 Jeffrey Altman + + * krb5_libinit.c: implement library cleanup of mutexes, static vars, etc + 2005-01-04 Jeffrey Altman * libkrb5.exports: add krb5_is_thread_safe diff --git a/src/lib/krb5/krb5_libinit.c b/src/lib/krb5/krb5_libinit.c index 8290c1476..ece79cfc7 100644 --- a/src/lib/krb5/krb5_libinit.c +++ b/src/lib/krb5/krb5_libinit.c @@ -69,9 +69,11 @@ void krb5int_lib_fini(void) if (!INITIALIZER_RAN(krb5int_lib_init) || PROGRAM_EXITING()) return; - krb5int_rc_terminate(); - krb5int_kt_finalize(); + k5_mutex_destroy(&krb5int_us_time_mutex); + krb5int_cc_finalize(); + krb5int_kt_finalize(); + krb5int_rc_terminate(); #if defined(_WIN32) || defined(USE_CCAPI) krb5_stdcc_shutdown(); diff --git a/src/util/et/ChangeLog b/src/util/et/ChangeLog index eeec13ebd..bec740722 100644 --- a/src/util/et/ChangeLog +++ b/src/util/et/ChangeLog @@ -1,3 +1,7 @@ +2005-01-17 Jeffrey Altman + + * error_message.c: implement library unload cleanup of mutexes + 2005-01-13 Ken Raeburn * error_message.c (com_err_terminate): Lock the list mutex before diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c index 8bef6804d..cb76b2a37 100644 --- a/src/util/et/error_message.c +++ b/src/util/et/error_message.c @@ -37,6 +37,7 @@ extern const int sys_nerr; /*@null@*/ static struct et_list * _et_list = (struct et_list *) NULL; /*@null@*//*@only@*/static struct dynamic_et_list * et_list_dynamic; static k5_mutex_t et_list_lock = K5_MUTEX_PARTIAL_INITIALIZER; +static int terminated = 0; /* for debugging shlib fini sequence errors */ MAKE_INIT_FUNCTION(com_err_initialize); MAKE_FINI_FUNCTION(com_err_terminate); @@ -44,6 +45,7 @@ MAKE_FINI_FUNCTION(com_err_terminate); int com_err_initialize(void) { int err; + terminated = 0; err = k5_mutex_finish_init(&et_list_lock); if (err) return err; @@ -56,12 +58,13 @@ int com_err_initialize(void) return 0; } -static int terminated = 0; /* for debugging shlib fini sequence errors */ void com_err_terminate(void) { struct dynamic_et_list *e, *enext; if (! INITIALIZER_RAN(com_err_initialize) || PROGRAM_EXITING()) return; + k5_key_delete(K5_KEY_COM_ERR); + k5_mutex_destroy(&com_err_hook_lock); k5_mutex_lock(&et_list_lock); for (e = et_list_dynamic; e; e = enext) { enext = e->next; diff --git a/src/util/support/ChangeLog b/src/util/support/ChangeLog index ae56c7094..bfb973ed6 100644 --- a/src/util/support/ChangeLog +++ b/src/util/support/ChangeLog @@ -6,6 +6,11 @@ interfering with the global list of thread specific data (used for library termination). +2005-01-17 Jeffrey Altman + + * threads.c: implement cleanup of static vars on library + unload (for Windows) + 2004-12-15 Jeffrey Altman * Makefile.in: rename krb5support_32.dll to k5sprt32.dll diff --git a/src/util/support/threads.c b/src/util/support/threads.c index 4e6bbfc8d..5eb85cdaa 100644 --- a/src/util/support/threads.c +++ b/src/util/support/threads.c @@ -311,12 +311,15 @@ int k5_key_delete (k5_key_t keynum) /* XXX Memory leak here! Need to destroy the associated data for all threads. But watch for race conditions in case threads are going away too. */ + assert(destructors_set[keynum] == 1); + destructors_set[keynum] = 0; + destructors[keynum] = 0; LeaveCriticalSection(&key_lock); #else /* POSIX */ - /* Not written yet. */ - abort(); + /* Not written yet -- resource leak! */ + /* abort(); */ #endif -- 2.26.2