From bd4f6556f5120202c73fb87643f3112fca043991 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 2 Jun 2004 22:35:33 +0000 Subject: [PATCH] Add/remove error tables in library initialization/termination, not per context. Use only one library initialization scheme, and install the error tables in only one place. * krb5_libinit.c (initialized): Variable deleted, all references removed. (krb5int_lib_init): Initialize error tables here. (krb5int_initialize_library): Don't do it here. * error_tables/Makefile.in (STLIBOBJS, OBJS, SRCS): Drop init_ets code. * krb/init_ctx.c (init_common): Don't call krb5_init_ets. (krb5_free_context): Don't call krb5_free_ets. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16388 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ChangeLog | 7 +++++++ src/lib/krb5/error_tables/ChangeLog | 4 ++++ src/lib/krb5/error_tables/Makefile.in | 8 +++----- src/lib/krb5/krb/ChangeLog | 3 +++ src/lib/krb5/krb/init_ctx.c | 6 +++--- src/lib/krb5/krb5_libinit.c | 23 ++++++++--------------- 6 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/lib/krb5/ChangeLog b/src/lib/krb5/ChangeLog index 9b4cb7ae7..d8860e24e 100644 --- a/src/lib/krb5/ChangeLog +++ b/src/lib/krb5/ChangeLog @@ -1,3 +1,10 @@ +2004-06-02 Ken Raeburn + + * krb5_libinit.c (initialized): Variable deleted, all references + removed. + (krb5int_lib_init): Initialize error tables here. + (krb5int_initialize_library): Don't do it here. + 2004-05-27 Ezra Peisach * Makefile.in (LOCALINCLUDES): Include ccache, keytab and rcache diff --git a/src/lib/krb5/error_tables/ChangeLog b/src/lib/krb5/error_tables/ChangeLog index 7fea34e6c..4492699e3 100644 --- a/src/lib/krb5/error_tables/ChangeLog +++ b/src/lib/krb5/error_tables/ChangeLog @@ -1,3 +1,7 @@ +2004-06-02 Ken Raeburn + + * Makefile.in (STLIBOBJS, OBJS, SRCS): Drop init_ets code. + 2004-01-06 Jeffrey Altman * krb5_err.et (KRB5_CC_NOSUPP) new ccache error code diff --git a/src/lib/krb5/error_tables/Makefile.in b/src/lib/krb5/error_tables/Makefile.in index 4e1c174c6..969309bbb 100644 --- a/src/lib/krb5/error_tables/Makefile.in +++ b/src/lib/krb5/error_tables/Makefile.in @@ -11,15 +11,13 @@ THDRDIR=$(BUILDTOP)$(S)include EHDRDIR=$(BUILDTOP)$(S)include$(S)krb5 STLIBOBJS= asn1_err.o kdb5_err.o krb5_err.o \ - kv5m_err.o krb524_err.o init_ets.o + kv5m_err.o krb524_err.o HDRS= asn1_err.h kdb5_err.h krb5_err.h kv5m_err.h krb524_err.h OBJS= $(OUTPRE)asn1_err.$(OBJEXT) $(OUTPRE)kdb5_err.$(OBJEXT) $(OUTPRE)krb5_err.$(OBJEXT) \ - $(OUTPRE)kv5m_err.$(OBJEXT) $(OUTPRE)krb524_err.$(OBJEXT) \ - $(OUTPRE)init_ets.$(OBJEXT) + $(OUTPRE)kv5m_err.$(OBJEXT) $(OUTPRE)krb524_err.$(OBJEXT) ETSRCS= asn1_err.c kdb5_err.c krb5_err.c kv5m_err.c krb524_err.c -SRCS= asn1_err.c kdb5_err.c krb5_err.c kv5m_err.c krb524_err.c \ - $(srcdir)/init_ets.c +SRCS= asn1_err.c kdb5_err.c krb5_err.c kv5m_err.c krb524_err.c ##DOS##LIBOBJS = $(OBJS) diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index 9b360d777..83e4b1ddf 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,5 +1,8 @@ 2004-06-02 Ken Raeburn + * init_ctx.c (init_common): Don't call krb5_init_ets. + (krb5_free_context): Don't call krb5_free_ets. + * srv_rcache.c (krb5_get_server_rcache): Use krb5_rc_resolve_full instead of constructing an rcache object locally. diff --git a/src/lib/krb5/krb/init_ctx.c b/src/lib/krb5/krb/init_ctx.c index de6b22d50..c3f66105b 100644 --- a/src/lib/krb5/krb/init_ctx.c +++ b/src/lib/krb5/krb/init_ctx.c @@ -109,8 +109,9 @@ init_common (krb5_context *context, krb5_boolean secure) krb5_data seed; int tmp; - /* Initialize error tables */ - krb5_init_ets(ctx); + retval = krb5int_initialize_library(); + if (retval) + return retval; #if (defined(_WIN32)) /* @@ -238,7 +239,6 @@ cleanup: void KRB5_CALLCONV krb5_free_context(krb5_context ctx) { - krb5_free_ets(ctx); krb5_os_free_context(ctx); if (ctx->in_tkt_ktypes) { diff --git a/src/lib/krb5/krb5_libinit.c b/src/lib/krb5/krb5_libinit.c index ce3c08ee7..9137c685e 100644 --- a/src/lib/krb5/krb5_libinit.c +++ b/src/lib/krb5/krb5_libinit.c @@ -18,8 +18,6 @@ #include "kt-int.h" #include "rc-int.h" -static int initialized = 0; - /* * Initialize the Kerberos v5 library. */ @@ -31,6 +29,14 @@ MAKE_FINI_FUNCTION(krb5int_lib_fini); int krb5int_lib_init(void) { int err; + +#if !USE_BUNDLE_ERROR_STRINGS + add_error_table(&et_krb5_error_table); + add_error_table(&et_kv5m_error_table); + add_error_table(&et_kdb5_error_table); + add_error_table(&et_asn1_error_table); +#endif + err = krb5int_rc_finish_init(); if (err) return err; @@ -46,16 +52,6 @@ int krb5int_lib_init(void) /* Always-delayed initialization -- error table linkage, etc. */ krb5_error_code krb5int_initialize_library (void) { - if (!initialized) { -#if !USE_BUNDLE_ERROR_STRINGS - add_error_table(&et_krb5_error_table); - add_error_table(&et_kv5m_error_table); - add_error_table(&et_kdb5_error_table); - add_error_table(&et_asn1_error_table); -#endif - initialized = 1; - } - return CALL_INIT_FUNCTION(krb5int_lib_init); } @@ -72,9 +68,6 @@ void krb5int_lib_fini(void) krb5int_kt_finalize(); krb5int_cc_finalize(); - if (!initialized) - return; - #if defined(_WIN32) || defined(USE_CCAPI) krb5_stdcc_shutdown(); #endif -- 2.26.2