summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ccapi/lib/ccapi_context.c6
-rw-r--r--src/kim/agent/mac/ServerDemux.m2
-rw-r--r--src/kim/lib/kim_ccache.c4
-rw-r--r--src/kim/lib/kim_credential.c4
-rw-r--r--src/kim/lib/kim_identity.c2
-rw-r--r--src/kim/lib/kim_library.c32
-rw-r--r--src/kim/lib/kim_library_private.h2
-rw-r--r--src/kim/lib/kim_options.c2
-rw-r--r--src/kim/lib/kim_preferences.c8
-rw-r--r--src/kim/lib/kim_selection_hints.c2
-rw-r--r--src/kim/lib/kim_string.c18
-rw-r--r--src/kim/lib/mac/kim_os_private.h4
-rw-r--r--src/kim/lib/mac/kim_os_string.c144
-rw-r--r--src/lib/gssapi/gss_libinit.c6
-rw-r--r--src/lib/krb5/krb5_libinit.c5
-rw-r--r--src/util/mac/k5_mig_client.c4
-rw-r--r--src/util/profile/prof_file.c6
17 files changed, 95 insertions, 156 deletions
diff --git a/src/ccapi/lib/ccapi_context.c b/src/ccapi/lib/ccapi_context.c
index 640e153e8c..3e405679f9 100644
--- a/src/ccapi/lib/ccapi_context.c
+++ b/src/ccapi/lib/ccapi_context.c
@@ -33,6 +33,7 @@
#include "ccapi_string.h"
#include "ccapi_ipc.h"
#include "ccapi_context_change_time.h"
+#include "ccapi_err.h"
#include <CredentialsCache2.h>
@@ -96,6 +97,10 @@ static int cci_thread_init (void)
err = cci_ipc_thread_init ();
}
+ if (!err) {
+ add_error_table (&et_CAPI_error_table);
+ }
+
return err;
}
@@ -107,6 +112,7 @@ static void cci_thread_fini (void)
return;
}
+ remove_error_table(&et_CAPI_error_table);
cci_context_change_time_thread_fini ();
cci_ipc_thread_fini ();
}
diff --git a/src/kim/agent/mac/ServerDemux.m b/src/kim/agent/mac/ServerDemux.m
index c09d7ec852..ed4e73d1d6 100644
--- a/src/kim/agent/mac/ServerDemux.m
+++ b/src/kim/agent/mac/ServerDemux.m
@@ -303,7 +303,7 @@ static int32_t kim_handle_request_auth_prompt (mach_port_t in_client_port,
if (!err) {
NSLog (@"Got auth prompt with identity '%s', type '%d', allow_save_reply '%d', hide '%d', title '%s', message '%s', description '%s'",
- identity_string, type, hide_reply, title, message, description);
+ identity_string, type, allow_save_reply, hide_reply, title, message, description);
err = kim_handle_reply_auth_prompt (in_reply_port, "ydobon", 0, 0);
#warning Send auth prompt message to main thread with 2 ports and arguments
}
diff --git a/src/kim/lib/kim_ccache.c b/src/kim/lib/kim_ccache.c
index 152095d54c..b30351c4ac 100644
--- a/src/kim/lib/kim_ccache.c
+++ b/src/kim/lib/kim_ccache.c
@@ -38,7 +38,7 @@ struct kim_ccache_iterator_opaque kim_ccache_iterator_initializer = { NULL, NULL
kim_error kim_ccache_iterator_create (kim_ccache_iterator *out_ccache_iterator)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_ccache_iterator ccache_iterator = NULL;
if (!err && !out_ccache_iterator) { err = check_error (KIM_NULL_PARAMETER_ERR); }
@@ -181,7 +181,7 @@ static kim_error kim_ccache_create_resolve_name (kim_string *out_resolve_name,
static inline kim_error kim_ccache_allocate (kim_ccache *out_ccache)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_ccache ccache = NULL;
if (!err && !out_ccache) { err = check_error (KIM_NULL_PARAMETER_ERR); }
diff --git a/src/kim/lib/kim_credential.c b/src/kim/lib/kim_credential.c
index 64561896d5..8465aa59d1 100644
--- a/src/kim/lib/kim_credential.c
+++ b/src/kim/lib/kim_credential.c
@@ -41,7 +41,7 @@ struct kim_credential_iterator_opaque kim_credential_iterator_initializer = { NU
kim_error kim_credential_iterator_create (kim_credential_iterator *out_credential_iterator,
kim_ccache in_ccache)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_credential_iterator credential_iterator = NULL;
if (!err && !out_credential_iterator) { err = check_error (KIM_NULL_PARAMETER_ERR); }
@@ -178,7 +178,7 @@ struct kim_credential_opaque kim_credential_initializer = { NULL, NULL };
static inline kim_error kim_credential_allocate (kim_credential *out_credential)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_credential credential = NULL;
if (!err && !out_credential) { err = check_error (KIM_NULL_PARAMETER_ERR); }
diff --git a/src/kim/lib/kim_identity.c b/src/kim/lib/kim_identity.c
index 10604e6d07..33877746e2 100644
--- a/src/kim/lib/kim_identity.c
+++ b/src/kim/lib/kim_identity.c
@@ -41,7 +41,7 @@ struct kim_identity_opaque kim_identity_initializer = { NULL, NULL };
static inline kim_error kim_identity_allocate (kim_identity *out_identity)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_identity identity = NULL;
if (!err && !out_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
diff --git a/src/kim/lib/kim_library.c b/src/kim/lib/kim_library.c
index c235fbda7e..8096ec6b1f 100644
--- a/src/kim/lib/kim_library.c
+++ b/src/kim/lib/kim_library.c
@@ -34,6 +34,38 @@
#include "kim_private.h"
#include "kim_os_private.h"
+
+MAKE_INIT_FUNCTION(kim_error_init);
+MAKE_FINI_FUNCTION(kim_error_fini);
+
+/* ------------------------------------------------------------------------ */
+
+static int kim_error_init (void)
+{
+ add_error_table (&et_KIM_error_table);
+ return 0;
+}
+
+/* ------------------------------------------------------------------------ */
+
+static void kim_error_fini (void)
+{
+ if (!INITIALIZER_RAN (kim_error_init) || PROGRAM_EXITING ()) {
+ return;
+ }
+
+ remove_error_table (&et_KIM_error_table);
+}
+
+/* ------------------------------------------------------------------------ */
+
+kim_error kim_library_init (void)
+{
+ return CALL_INIT_FUNCTION (kim_error_init);
+}
+
+#pragma mark -
+
static k5_mutex_t g_allow_home_directory_access_mutex = K5_MUTEX_PARTIAL_INITIALIZER;
static k5_mutex_t g_allow_automatic_prompting_mutex = K5_MUTEX_PARTIAL_INITIALIZER;
static k5_mutex_t g_ui_environment_mutex = K5_MUTEX_PARTIAL_INITIALIZER;
diff --git a/src/kim/lib/kim_library_private.h b/src/kim/lib/kim_library_private.h
index b44cb6513b..83c06d7914 100644
--- a/src/kim/lib/kim_library_private.h
+++ b/src/kim/lib/kim_library_private.h
@@ -29,6 +29,8 @@
#include <kim/kim.h>
+kim_error kim_library_init (void);
+
kim_ui_environment kim_os_library_get_ui_environment (void);
kim_ui_environment kim_library_ui_environment (void);
diff --git a/src/kim/lib/kim_options.c b/src/kim/lib/kim_options.c
index d97b346990..91ec406bb1 100644
--- a/src/kim/lib/kim_options.c
+++ b/src/kim/lib/kim_options.c
@@ -57,7 +57,7 @@ NULL };
static inline kim_error kim_options_allocate (kim_options *out_options)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_options options = NULL;
if (!err && !out_options) { err = check_error (KIM_NULL_PARAMETER_ERR); }
diff --git a/src/kim/lib/kim_preferences.c b/src/kim/lib/kim_preferences.c
index b2e740d9e8..29f37cd9a3 100644
--- a/src/kim/lib/kim_preferences.c
+++ b/src/kim/lib/kim_preferences.c
@@ -136,7 +136,7 @@ static kim_error kim_favorites_copy (kim_favorites in_favorites,
kim_error err = KIM_NO_ERROR;
if (!err && !in_favorites) { err = check_error (KIM_NULL_PARAMETER_ERR); }
- if (!err && !io_favorites ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+ if (!err && !io_favorites) { err = check_error (KIM_NULL_PARAMETER_ERR); }
if (!err) {
err = kim_favorites_resize (io_favorites, in_favorites->count);
@@ -491,10 +491,6 @@ static kim_error kim_preferences_read (kim_preferences in_preferences)
&in_preferences->maximum_renewal_lifetime);
}
- if (!err) {
-
- }
-
return check_error (err);
}
@@ -576,7 +572,7 @@ static kim_error kim_preferences_write (kim_preferences in_preferences)
static inline kim_error kim_preferences_allocate (kim_preferences *out_preferences)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_preferences preferences = NULL;
if (!err && !out_preferences) { err = check_error (KIM_NULL_PARAMETER_ERR); }
diff --git a/src/kim/lib/kim_selection_hints.c b/src/kim/lib/kim_selection_hints.c
index 8cb98f683c..6bfa3f1820 100644
--- a/src/kim/lib/kim_selection_hints.c
+++ b/src/kim/lib/kim_selection_hints.c
@@ -58,7 +58,7 @@ struct kim_selection_hints_opaque kim_selection_hints_initializer = {
static inline kim_error kim_selection_hints_allocate (kim_selection_hints *out_selection_hints)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_selection_hints selection_hints = NULL;
if (!err && !out_selection_hints) { err = check_error (KIM_NULL_PARAMETER_ERR); }
diff --git a/src/kim/lib/kim_string.c b/src/kim/lib/kim_string.c
index 2dc284c932..b84a12c8ee 100644
--- a/src/kim/lib/kim_string.c
+++ b/src/kim/lib/kim_string.c
@@ -32,7 +32,7 @@ kim_error kim_string_create_from_format (kim_string *out_string,
kim_string in_format,
...)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
va_list args;
va_start (args, in_format);
@@ -48,7 +48,7 @@ kim_error kim_string_create_from_format_va_retcode (kim_string *out_string,
kim_string in_format,
va_list in_args)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
int count = vasprintf ((char **) out_string, in_format, in_args);
if (count < 0) { err = check_error (KIM_OUT_OF_MEMORY_ERR); }
@@ -62,7 +62,7 @@ kim_error kim_string_create_from_format_va (kim_string *out_string,
kim_string in_format,
va_list in_args)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_string string = NULL;
if (!err && !out_string) { err = check_error (KIM_NULL_PARAMETER_ERR); }
@@ -90,7 +90,7 @@ kim_error kim_string_create_from_buffer (kim_string *out_string,
const char *in_buffer,
kim_count in_length)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_string string = NULL;
if (!err && !out_string) { err = check_error (KIM_NULL_PARAMETER_ERR); }
@@ -117,7 +117,11 @@ kim_error kim_string_create_from_buffer (kim_string *out_string,
kim_error kim_string_create_for_last_error (kim_string *out_string,
kim_error in_error)
{
- return kim_string_copy (out_string, kim_error_message (in_error));
+ kim_error err = kim_library_init ();
+
+ err = kim_string_copy (out_string, kim_error_message (in_error));
+
+ return check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -125,7 +129,7 @@ kim_error kim_string_create_for_last_error (kim_string *out_string,
kim_error kim_string_copy (kim_string *out_string,
kim_string in_string)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error err = kim_library_init ();
kim_string string = NULL;
if (!err && !out_string) { err = check_error (KIM_NULL_PARAMETER_ERR); }
@@ -137,7 +141,7 @@ kim_error kim_string_copy (kim_string *out_string,
}
if (!err) {
- strcpy ((char *) string, in_string);
+ strncpy ((char *) string, in_string, strlen (in_string) + 1);
*out_string = string;
string = NULL;
}
diff --git a/src/kim/lib/mac/kim_os_private.h b/src/kim/lib/mac/kim_os_private.h
index 039502a7e9..f14440df48 100644
--- a/src/kim/lib/mac/kim_os_private.h
+++ b/src/kim/lib/mac/kim_os_private.h
@@ -41,10 +41,6 @@ kim_error kim_os_library_unlock_for_bundle_lookup (void);
kim_error kim_os_library_get_application_path (kim_string *out_path);
-
-kim_error kim_os_string_create_for_key (kim_string *out_string,
- kim_string in_key_string);
-
kim_error kim_os_string_create_from_cfstring (kim_string *out_string,
CFStringRef in_cfstring);
diff --git a/src/kim/lib/mac/kim_os_string.c b/src/kim/lib/mac/kim_os_string.c
index d51bc48b2a..0529f39207 100644
--- a/src/kim/lib/mac/kim_os_string.c
+++ b/src/kim/lib/mac/kim_os_string.c
@@ -29,142 +29,48 @@
#include "kim_os_private.h"
/* ------------------------------------------------------------------------ */
-static kim_error kim_os_string_for_key_in_bundle (CFBundleRef in_bundle,
- CFStringRef in_key,
- kim_string *out_string)
-{
- kim_error err = KIM_NO_ERROR;
- kim_string string = NULL;
-
- if (!err && !in_bundle ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
- if (!err && !in_key ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
- if (!err && !out_string) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-
- if (!err) {
- CFDictionaryRef dictionary = NULL;
- int release_dictionary = 0;
- CFStringRef cfstring = NULL;
-
-#if !KERBEROS_LITE
- if (kim_library_allow_home_directory_access ()) {
-#endif
- /* Accesses user's homedir to get localization information */
- dictionary = CFBundleGetLocalInfoDictionary (in_bundle);
-
-#if !KERBEROS_LITE
- } else {
- CFURLRef url = NULL;
- CFDataRef data = NULL;
- CFAllocatorRef allocator = CFGetAllocator (in_bundle);
- SInt32 code = 0;
-
- url = CFBundleCopyResourceURLForLocalization (in_bundle,
- CFSTR("InfoPlist"),
- CFSTR("strings"),
- NULL,
- CFSTR("English"));
-
- if (url && CFURLCreateDataAndPropertiesFromResource (allocator,
- url, &data,
- NULL, NULL,
- &code)) {
-
- dictionary = CFPropertyListCreateFromXMLData (allocator,
- data,
- kCFPropertyListImmutable,
- NULL);
- release_dictionary = 1;
- }
-
- if (data) { CFRelease (data); }
- if (url ) { CFRelease (url); }
- }
-#endif
-
- if (dictionary && (CFGetTypeID(dictionary) == CFDictionaryGetTypeID())) {
- cfstring = (CFStringRef) CFDictionaryGetValue (dictionary, in_key);
- }
-
- if (cfstring && (CFGetTypeID (cfstring) == CFStringGetTypeID ())) {
- err = kim_os_string_create_from_cfstring (&string, cfstring);
- }
-
- if (dictionary && release_dictionary) { CFRelease (dictionary); }
- }
-
- if (!err) {
- /* set to NULL if no string found */
- *out_string = string;
- string = NULL;
- }
-
- kim_string_free (&string);
-
- return check_error (err);
-}
-
-#pragma mark -
-
-/* ------------------------------------------------------------------------ */
kim_error kim_os_string_create_localized (kim_string *out_string,
kim_string in_string)
{
- kim_error err = KIM_NO_ERROR;
+ kim_error lock_err = kim_os_library_lock_for_bundle_lookup ();
+ kim_error err = lock_err;
kim_string string = NULL;
+ CFStringRef cfkey = NULL;
if (!err && !out_string) { err = check_error (KIM_NULL_PARAMETER_ERR); }
if (!err && !in_string ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
if (!err) {
- err = kim_os_string_create_for_key (&string, in_string);
- }
-
- if (!err && !string) {
- err = kim_string_copy (&string, in_string);
- }
-
- if (!err) {
- *out_string = string;
- string = NULL;
+ err = kim_os_string_get_cfstring (in_string, &cfkey);
}
- kim_string_free (&string);
-
- return check_error (err);
-}
-
-/* ------------------------------------------------------------------------ */
-
-kim_error kim_os_string_create_for_key (kim_string *out_string,
- kim_string in_key_string)
-{
- kim_error lock_err = kim_os_library_lock_for_bundle_lookup ();
- kim_error err = lock_err;
- CFStringRef key = NULL;
- kim_string string = NULL;
-
- if (!err && !out_string ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
- if (!err && !in_key_string) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-
- if (!err) {
- err = kim_os_string_get_cfstring (in_key_string, &key);
- }
-
- if (!err) {
- /* Try to find the key, first searching in the framework */
+ if (!err && kim_library_allow_home_directory_access ()) {
+ CFStringRef cfstring = NULL;
CFBundleRef framework = CFBundleGetBundleWithIdentifier (CFSTR ("edu.mit.Kerberos"));
+ CFBundleRef main_bundle = CFBundleGetMainBundle ();
+
if (framework) {
- err = kim_os_string_for_key_in_bundle (framework, key, &string);
+ cfstring = CFCopyLocalizedStringFromTableInBundle (cfkey,
+ CFSTR ("InfoPlist"),
+ framework,
+ "");
+ }
+
+ if (main_bundle && !cfstring) {
+ cfstring = CFCopyLocalizedStringFromTableInBundle (cfkey,
+ CFSTR ("InfoPlist"),
+ main_bundle,
+ "");
+ }
+
+ if (!err && cfstring) {
+ err = kim_os_string_create_from_cfstring (&string, cfstring);
}
}
if (!err && !string) {
- /* If we didn't find it in the framwork, try in the main bundle */
- CFBundleRef main_bundle = CFBundleGetMainBundle ();
- if (main_bundle) {
- err = kim_os_string_for_key_in_bundle (main_bundle, key, &string);
- }
+ err = kim_string_copy (&string, in_string);
}
if (!err) {
@@ -172,8 +78,8 @@ kim_error kim_os_string_create_for_key (kim_string *out_string,
string = NULL;
}
+ if (cfkey) { CFRelease (cfkey); }
kim_string_free (&string);
- if (key) { CFRelease (key); }
if (!lock_err) { kim_os_library_unlock_for_bundle_lookup (); }
diff --git a/src/lib/gssapi/gss_libinit.c b/src/lib/gssapi/gss_libinit.c
index 3c26c98cd6..cdffb77290 100644
--- a/src/lib/gssapi/gss_libinit.c
+++ b/src/lib/gssapi/gss_libinit.c
@@ -25,10 +25,9 @@ int gssint_lib_init(void)
printf("gssint_lib_init\n");
#endif
-#if !USE_BUNDLE_ERROR_STRINGS
add_error_table(&et_k5g_error_table);
add_error_table(&et_ggss_error_table);
-#endif
+
err = gssint_mechglue_init();
if (err)
return err;
@@ -69,10 +68,9 @@ void gssint_lib_fini(void)
#ifdef SHOW_INITFINI_FUNCS
printf("gssint_lib_fini\n");
#endif
-#if !USE_BUNDLE_ERROR_STRINGS
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);
diff --git a/src/lib/krb5/krb5_libinit.c b/src/lib/krb5/krb5_libinit.c
index 94187781c8..c154da81bc 100644
--- a/src/lib/krb5/krb5_libinit.c
+++ b/src/lib/krb5/krb5_libinit.c
@@ -33,13 +33,11 @@ int krb5int_lib_init(void)
printf("krb5int_lib_init\n");
#endif
-#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);
add_error_table(&et_k524_error_table);
-#endif
err = krb5int_rc_finish_init();
if (err)
@@ -94,13 +92,12 @@ void krb5int_lib_fini(void)
krb5_stdcc_shutdown();
#endif
-#if !USE_BUNDLE_ERROR_STRINGS
remove_error_table(&et_krb5_error_table);
remove_error_table(&et_kv5m_error_table);
remove_error_table(&et_kdb5_error_table);
remove_error_table(&et_asn1_error_table);
remove_error_table(&et_k524_error_table);
-#endif
+
krb5int_set_error_info_callout_fn (0);
}
diff --git a/src/util/mac/k5_mig_client.c b/src/util/mac/k5_mig_client.c
index 166704204f..6bb3b3dd99 100644
--- a/src/util/mac/k5_mig_client.c
+++ b/src/util/mac/k5_mig_client.c
@@ -24,6 +24,8 @@
* or implied warranty.
*/
+#ifndef LEAN_CLIENT
+
#include "k5_mig_client.h"
#include <Kerberos/kipc_client.h>
@@ -328,3 +330,5 @@ int32_t k5_ipc_send_request (const char *in_service_id,
return err;
}
+
+#endif /* LEAN CLIENT */
diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c
index cee34ef2c8..13d8860e8b 100644
--- a/src/util/profile/prof_file.c
+++ b/src/util/profile/prof_file.c
@@ -52,9 +52,8 @@ int profile_library_initializer(void)
#ifdef SHOW_INITFINI_FUNCS
printf("profile_library_initializer\n");
#endif
-#if !USE_BUNDLE_ERROR_STRINGS
add_error_table(&et_prof_error_table);
-#endif
+
return k5_mutex_finish_init(&g_shared_trees_mutex);
}
void profile_library_finalizer(void)
@@ -69,9 +68,8 @@ void profile_library_finalizer(void)
printf("profile_library_finalizer\n");
#endif
k5_mutex_destroy(&g_shared_trees_mutex);
-#if !USE_BUNDLE_ERROR_STRINGS
+
remove_error_table(&et_prof_error_table);
-#endif
}
static void profile_free_file_data(prf_data_t);