diff options
author | Ken Raeburn <raeburn@mit.edu> | 2004-04-24 21:09:44 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2004-04-24 21:09:44 +0000 |
commit | fcf02bef88a17724aa230547459a9eaf1159d6c1 (patch) | |
tree | 7f9dd998b8e7baf61111f6bf0428da47de1291eb /src/lib/krb5/ccache/ccbase.c | |
parent | 3b4d753fc5169469da270c831654a8fae407cfdf (diff) | |
download | krb5-fcf02bef88a17724aa230547459a9eaf1159d6c1.tar.gz krb5-fcf02bef88a17724aa230547459a9eaf1159d6c1.tar.xz krb5-fcf02bef88a17724aa230547459a9eaf1159d6c1.zip |
Added support for library initialization and finalization, and verification
that the initializer completed successfully. Delay initialization on POSIX
until the first "verification" call. Currently specific to a few platforms,
but should still build on others without thread support enabled.
Use it to finish creating (if necessary) and destroy mutexes, and free some
other storage "permanently" allocated by libraries (currently, libkrb5
cache/keytab type registries only). Change initialization of static mutexes to
a two-step operation, a static "partial" initializer and a "finish_init"
routine called from a thread-safe environment like library initialization is
assumed to be. POSIX will use the former, Windows will use the latter, and the
debug support will check that *both* have been used.
Added init/fini functions to com_err, profile, krb5, and gssapi libraries.
(The profile library one may need to be removed later.) The existing ones, not
thread-safe, are still around.
Use weak symbol support if available to figure out if the pthread library has
been linked in, and avoid calling certain routines if the C library stubs are
known not to exist or work.
Stub declarations for thread-specific data.
Minor bugfixes, whitespace changes.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16268 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/ccache/ccbase.c')
-rw-r--r-- | src/lib/krb5/ccache/ccbase.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/lib/krb5/ccache/ccbase.c b/src/lib/krb5/ccache/ccbase.c index 4fb5f8360d..f635147c26 100644 --- a/src/lib/krb5/ccache/ccbase.c +++ b/src/lib/krb5/ccache/ccbase.c @@ -50,7 +50,24 @@ static struct krb5_cc_typelist cc_fcc_entry = { &krb5_cc_file_ops, &cc_mcc_entry }; static struct krb5_cc_typelist *cc_typehead = &cc_fcc_entry; -static k5_mutex_t cc_typelist_lock = K5_MUTEX_INITIALIZER; +static k5_mutex_t cc_typelist_lock = K5_MUTEX_PARTIAL_INITIALIZER; + +int +krb5int_cc_initialize(void) +{ + return k5_mutex_finish_init(&cc_typelist_lock); +} + +void +krb5int_cc_finalize(void) +{ + struct krb5_cc_typelist *t, *t_next; + k5_mutex_destroy(&cc_typelist_lock); + for (t = cc_typehead; t != &cc_fcc_entry; t = t_next) { + t_next = t->next; + free(t); + } +} /* @@ -100,6 +117,7 @@ krb5_cc_register(krb5_context context, krb5_cc_ops *ops, krb5_boolean override) * particular cache type. */ +#include <ctype.h> krb5_error_code KRB5_CALLCONV krb5_cc_resolve (krb5_context context, const char *name, krb5_ccache *cache) { |