Add/remove error tables in library initialization/termination, not per context.
authorKen Raeburn <raeburn@mit.edu>
Wed, 2 Jun 2004 22:35:33 +0000 (22:35 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 2 Jun 2004 22:35:33 +0000 (22:35 +0000)
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
src/lib/krb5/error_tables/ChangeLog
src/lib/krb5/error_tables/Makefile.in
src/lib/krb5/krb/ChangeLog
src/lib/krb5/krb/init_ctx.c
src/lib/krb5/krb5_libinit.c

index 9b4cb7ae750999b28db48e5837bddb678510a441..d8860e24e37f260a7c94c5b62816905312900022 100644 (file)
@@ -1,3 +1,10 @@
+2004-06-02  Ken Raeburn  <raeburn@mit.edu>
+
+       * 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  <epeisach@mit.edu>
 
        * Makefile.in (LOCALINCLUDES): Include ccache, keytab and rcache
index 7fea34e6caee63b36f36b57d61e7c479a639e3e2..4492699e3ea25bfb0c9edc03f2124332a8351cf4 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-02  Ken Raeburn  <raeburn@mit.edu>
+
+       * Makefile.in (STLIBOBJS, OBJS, SRCS): Drop init_ets code.
+
 2004-01-06  Jeffrey Altman <jaltman@mit.edu>
 
     * krb5_err.et (KRB5_CC_NOSUPP) new ccache error code
index 4e1c174c61439d6c0c3825d4010846e287b76331..969309bbb44c2306d79bf70209828a5b7b2423bf 100644 (file)
@@ -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)
 
index 9b360d77787a2a1178a3a53cef427872d454296d..83e4b1ddf0aa92d89e953e5511432e6d4ba4bffb 100644 (file)
@@ -1,5 +1,8 @@
 2004-06-02  Ken Raeburn  <raeburn@mit.edu>
 
+       * 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.
 
index de6b22d506cba20f03d2c5d5d47af1be2cbc127c..c3f66105b1485c8ecf00bcfd1d03fa09cc3d7c6c 100644 (file)
@@ -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) {
index ce3c08ee7d03ff694aaf2a34d6e97c1f472f671d..9137c685ede1b7e5c17d8a97aab39a1b496c8646 100644 (file)
@@ -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