Some applications such as Eudora on Windows load and unload the Kerberos
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 17 Jan 2005 23:57:51 +0000 (23:57 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 17 Jan 2005 23:57:51 +0000 (23:57 +0000)
libraries as part of a plug-in.  Plugins are often loaded for a specific
purpose and then unregistered.  In order to support this model, the libraries
must restore the library state to the uninitialized state when the library
is unloaded.

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17050 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/ChangeLog
src/lib/gssapi/gss_libinit.c
src/lib/krb5/ChangeLog
src/lib/krb5/krb5_libinit.c
src/util/et/ChangeLog
src/util/et/error_message.c
src/util/support/ChangeLog
src/util/support/threads.c

index 90ac10e4062b6dcd518221682a687c452c38b9f2..af50c5e46dea5d08d9cd2619925807c46390bb8a 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-17  Jeffrey Altman <jaltman@mit.edu>
+
+        * gss_libinit.c: implement cleanup of mutexes, static vars, etc for Windows
+
 2004-07-29  Sam Hartman  <hartmans@mit.edu>
 
        * libgssapi_krb5.exports: Add lucid context routines and gss_krb5_set_allowable_enctypes
index a43989f0cba0822eb9be5666888eff909a5f44ef..d45ac440cd8ef7ff5376177435afa5c207d2d718 100644 (file)
@@ -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)
index 97a7fe32c5e0bd7d1aa7a7a304ac3ed0e697e927..882c9e0f4f0aae1485b97fb07e04b5a5d947b9f3 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-17  Jeffrey Altman <jaltman@mit.edu>
+
+        * krb5_libinit.c: implement library cleanup of mutexes, static vars, etc
+
 2005-01-04  Jeffrey Altman <jaltman@mit.edu>
       
         * libkrb5.exports: add krb5_is_thread_safe
index 8290c14761f5bb3a7ee2ef7b4bb51f94393888a3..ece79cfc72900bee3458eb4adb4de41dd09399ce 100644 (file)
@@ -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();
index eeec13ebd7510e0723629fb070ec68d60b0212fb..bec74072234bc37634cc85fe73510326fda9af31 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-17  Jeffrey Altman <jaltman@mit.edu>
+
+        * error_message.c: implement library unload cleanup of mutexes
+
 2005-01-13  Ken Raeburn  <raeburn@mit.edu>
 
        * error_message.c (com_err_terminate): Lock the list mutex before
index 8bef6804d9507dd65c8f98bdfd204a12a2e70168..e60029b5c64b068c6f86fc2846c57235d3d76904 100644 (file)
@@ -62,6 +62,8 @@ 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;
index 4e0aaa679a05578ff46ff2907e08df9a2a35e58f..010995392a105f0a93a0371588220d358412ca61 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-17  Jeffrey Altman <jaltman@mit.edu>
+
+        * threads.c: implement cleanup of static vars on library
+                unload (for Windows)
+
 2005-01-14  Ken Raeburn  <raeburn@mit.edu>
 
        * threads.c (k5_mutex_lock_update_stats,
index 44b64201f4720f2dd7e566dc6196b74f058a36e5..c8d4199d1bc03f76bbc64ba8ad2d9518fa462b05 100644 (file)
@@ -305,6 +305,9 @@ 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 */