Use path tokens when locating plug-in .dlls

This commit is contained in:
Asanka Herath
2010-05-26 10:32:00 -04:00
parent b9567cb158
commit 5c0f3f99c6
2 changed files with 25 additions and 1 deletions

View File

@@ -106,6 +106,8 @@ init_ccapi(krb5_context context)
if (lib == NULL) { if (lib == NULL) {
#ifdef __APPLE__ #ifdef __APPLE__
lib = "/System/Library/Frameworks/Kerberos.framework/Kerberos"; lib = "/System/Library/Frameworks/Kerberos.framework/Kerberos";
#elif defined(KRB5_USE_PATH_TOKENS) && defined(_WIN32)
lib = "%{LIBDIR}/libkrb5_cc.dll";
#else #else
lib = "/usr/lib/libkrb5_cc.so"; lib = "/usr/lib/libkrb5_cc.so";
#endif #endif
@@ -120,7 +122,18 @@ init_ccapi(krb5_context context)
#define RTLD_LOCAL 0 #define RTLD_LOCAL 0
#endif #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); cc_handle = dlopen(lib, RTLD_LAZY|RTLD_LOCAL);
#endif
if (cc_handle == NULL) { if (cc_handle == NULL) {
HEIMDAL_MUTEX_unlock(&acc_mutex); HEIMDAL_MUTEX_unlock(&acc_mutex);
if (context) if (context)

View File

@@ -201,8 +201,19 @@ load_plugins(krb5_context context)
dirs = rk_UNCONST(sysplugin_dirs); dirs = rk_UNCONST(sysplugin_dirs);
for (di = dirs; *di != NULL; di++) { 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) if (d == NULL)
continue; continue;
rk_cloexec_dir(d); rk_cloexec_dir(d);