From 0fbfcb68d3f17e52a66b7f85fd622e6393c0b0a6 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 17 Jun 2005 23:28:01 +0000 Subject: [PATCH] Undo Novell's change to the com_err API. Bludgeon their other code into compiling with the reverted API. git-svn-id: svn://anonsvn.mit.edu/krb5/branches/novell-dal-branch@17254 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm5/clnt/err_handle.c | 16 ++++++++++++++-- src/lib/kdb/err_handle.c | 14 +++++++++++--- src/util/et/com_err.c | 1 - src/util/et/com_err.h | 6 +----- src/util/et/error_message.c | 2 +- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/lib/kadm5/clnt/err_handle.c b/src/lib/kadm5/clnt/err_handle.c index 0b44d36ef4..997544d5e6 100644 --- a/src/lib/kadm5/clnt/err_handle.c +++ b/src/lib/kadm5/clnt/err_handle.c @@ -20,7 +20,9 @@ static char *_csrc = "@(#) %filespec: err_handle.c~1 % (%full_filespec: err_han #include "err_handle.h" #include +#ifdef NOVELL krb5_errcode_2_string_func old_error_2_string = NULL; +#endif typedef struct { char krb5_err_str[KRB5_MAX_ERR_STR + 1]; @@ -40,8 +42,10 @@ static pthread_key_t krb5_err_key; static void init_err_handling( void ) { assert(!pthread_key_create(&krb5_err_key, tsd_key_destructor)); +#ifdef NOVELL old_error_2_string = error_message; error_message = krb5_get_err_string; +#endif } static pthread_once_t krb5_key_create = PTHREAD_ONCE_INIT; @@ -94,8 +98,11 @@ const char * KRB5_CALLCONV krb5_get_err_string(long err_code) } /* Error strings are not generated here. the remaining two cases are handled by the default error string convertor */ +#ifdef NOVELL return old_error_2_string(err_code); - +#else + return error_message(err_code); +#endif } void krb5_clr_error() @@ -116,8 +123,10 @@ static void init_err_handling( void ) { if( krb5_init_once ) { +#ifdef NOVELL old_error_2_string = error_message; error_message = krb5_get_err_string; +#endif krb5_init_once = FALSE; } } @@ -156,8 +165,11 @@ const char * KRB5_CALLCONV krb5_get_err_string(long err_code) } /* it is not generated here. the remaining two cases are handled by the default error string convertor */ +#ifdef NOVELL return old_error_2_string(err_code); - +#else + return error_message(err_code); +#endif } void krb5_clr_error() diff --git a/src/lib/kdb/err_handle.c b/src/lib/kdb/err_handle.c index 61f720eea2..7d54441cb5 100644 --- a/src/lib/kdb/err_handle.c +++ b/src/lib/kdb/err_handle.c @@ -11,8 +11,9 @@ static char *_csrc = "@(#) %filespec: err_handle.c~1 % (%full_filespec: err_handle.c~1:csrc:idc_sec#1 %)"; #endif -/* this file should be ideally be in util/et. But, for now thread safety requirement stops me from putting there. - if I do, then all the applications have to link to pthread */ +/* This file should be ideally be in util/et. But, for now thread + safety requirement stops me from putting there. if I do, then all + the applications have to link to pthread. */ #ifdef HAVE_PTHREAD_H #include @@ -20,7 +21,9 @@ static char *_csrc = "@(#) %filespec: err_handle.c~1 % (%full_filespec: err_han #include "err_handle.h" #include +#ifdef NOVELL krb5_errcode_2_string_func old_error_2_string = NULL; +#endif typedef struct { char krb5_err_str[KRB5_MAX_ERR_STR + 1]; @@ -40,8 +43,10 @@ static pthread_key_t krb5_err_key; static void init_err_handling( void ) { assert(!pthread_key_create(&krb5_err_key, tsd_key_destructor)); +#ifdef NOVELL old_error_2_string = error_message; error_message = krb5_get_err_string; +#endif } static pthread_once_t krb5_key_create = PTHREAD_ONCE_INIT; @@ -100,8 +105,11 @@ const char * KRB5_CALLCONV krb5_get_err_string(long err_code) } /* Error strings are not generated here. the remaining two cases are handled by the default error string convertor */ +#ifdef NOVELL return old_error_2_string(err_code); - +#else + return error_message (err_code); +#endif } void krb5_clr_error() diff --git a/src/util/et/com_err.c b/src/util/et/com_err.c index 5d7b50e8dc..94b379816d 100644 --- a/src/util/et/com_err.c +++ b/src/util/et/com_err.c @@ -32,7 +32,6 @@ static /*@null@*/ et_old_error_hook_func com_err_hook = 0; k5_mutex_t com_err_hook_lock = K5_MUTEX_PARTIAL_INITIALIZER; -krb5_errcode_2_string_func error_message = krb5_errcode_2_string; static void default_com_err_proc (const char *whoami, errcode_t code, const char *fmt, va_list ap) diff --git a/src/util/et/com_err.h b/src/util/et/com_err.h index b2a4b80d2e..042a9bd452 100644 --- a/src/util/et/com_err.h +++ b/src/util/et/com_err.h @@ -37,15 +37,13 @@ struct error_table { extern "C" { #endif - typedef const char * KRB5_CALLCONV (*krb5_errcode_2_string_func)(long code); - /* Public interfaces */ extern void KRB5_CALLCONV_C com_err (const char *, errcode_t, const char *, ...); extern void KRB5_CALLCONV com_err_va (const char *whoami, errcode_t code, const char *fmt, va_list ap); - extern /*@observer@*//*@dependent@*/ const char * KRB5_CALLCONV (*error_message) +extern /*@observer@*//*@dependent@*/ const char * KRB5_CALLCONV error_message (errcode_t) /*@modifies internalState@*/; extern errcode_t KRB5_CALLCONV add_error_table @@ -54,8 +52,6 @@ extern errcode_t KRB5_CALLCONV add_error_table extern errcode_t KRB5_CALLCONV remove_error_table (const struct error_table *) /*@modifies internalState@*/; - /*@observer@*//*@dependent@*/ const char * KRB5_CALLCONV krb5_errcode_2_string - (errcode_t); #if !defined(_WIN32) /* diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c index 518a4ee7ac..b7f8947d29 100644 --- a/src/util/et/error_message.c +++ b/src/util/et/error_message.c @@ -92,7 +92,7 @@ void com_err_terminate(void) #endif const char * KRB5_CALLCONV -krb5_errcode_2_string(long code) +error_message(long code) /*@modifies internalState@*/ { unsigned long offset; -- 2.47.2