From 5c0f3f99c6a062278dd4b4ce9aa52edfb2151e59 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 May 2010 10:32:00 -0400 Subject: [PATCH] Use path tokens when locating plug-in .dlls --- lib/krb5/acache.c | 13 +++++++++++++ lib/krb5/plugin.c | 13 ++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/krb5/acache.c b/lib/krb5/acache.c index 19a599745..1be8fd93b 100644 --- a/lib/krb5/acache.c +++ b/lib/krb5/acache.c @@ -106,6 +106,8 @@ init_ccapi(krb5_context context) if (lib == NULL) { #ifdef __APPLE__ lib = "/System/Library/Frameworks/Kerberos.framework/Kerberos"; +#elif defined(KRB5_USE_PATH_TOKENS) && defined(_WIN32) + lib = "%{LIBDIR}/libkrb5_cc.dll"; #else lib = "/usr/lib/libkrb5_cc.so"; #endif @@ -120,7 +122,18 @@ init_ccapi(krb5_context context) #define RTLD_LOCAL 0 #endif +#ifdef KRB5_USE_PATH_TOKENS + { + char * explib = NULL; + if (_krb5_expand_path_tokens(context, lib, &explib) == 0) { + cc_handle = dlopen(explib, RTLD_LAZY|RTLD_LOCAL); + free(explib); + } + } +#else cc_handle = dlopen(lib, RTLD_LAZY|RTLD_LOCAL); +#endif + if (cc_handle == NULL) { HEIMDAL_MUTEX_unlock(&acc_mutex); if (context) diff --git a/lib/krb5/plugin.c b/lib/krb5/plugin.c index aa71e29b3..8db3c5a70 100644 --- a/lib/krb5/plugin.c +++ b/lib/krb5/plugin.c @@ -201,8 +201,19 @@ load_plugins(krb5_context context) dirs = rk_UNCONST(sysplugin_dirs); for (di = dirs; *di != NULL; di++) { +#ifdef KRB5_USE_PATH_TOKENS + { + char * dir = NULL; - d = opendir(*di); + if (_krb5_expand_path_tokens(context, *di, &dir)) + continue; + d = opendir(dir); + + free(dir); + } +#else + d = opendir(*id); +#endif if (d == NULL) continue; rk_cloexec_dir(d); -- 2.11.4.GIT