From ab6e3fce040f9ad27cbce44e9038a24f15b601c8 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Sun, 15 Aug 2010 18:31:28 +0400 Subject: s4:heimdal: import lorikeet-heimdal-201009250123 (commit 42cabfb5b683dbcb97d583c397b897507689e382) I based this on Matthieu's import of lorikeet-heimdal, and then updated it to this commit. Andrew Bartlett --- source4/heimdal/lib/krb5/plugin.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source4/heimdal/lib/krb5/plugin.c') diff --git a/source4/heimdal/lib/krb5/plugin.c b/source4/heimdal/lib/krb5/plugin.c index aa71e29b39..e19ba4a27c 100644 --- a/source4/heimdal/lib/krb5/plugin.c +++ b/source4/heimdal/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; + if (_krb5_expand_path_tokens(context, *di, &dir)) + continue; + d = opendir(dir); + + free(dir); + } +#else d = opendir(*di); +#endif if (d == NULL) continue; rk_cloexec_dir(d); @@ -215,17 +226,18 @@ load_plugins(krb5_context context) continue; path = NULL; + ret = 0; #ifdef __APPLE__ { /* support loading bundles on MacOS */ size_t len = strlen(n); if (len > 7 && strcmp(&n[len - 7], ".bundle") == 0) - asprintf(&path, "%s/%s/Contents/MacOS/%.*s", *di, n, (int)(len - 7), n); + ret = asprintf(&path, "%s/%s/Contents/MacOS/%.*s", *di, n, (int)(len - 7), n); } #endif - if (path == NULL) - asprintf(&path, "%s/%s", *di, n); + if (ret < 0 || path == NULL) + ret = asprintf(&path, "%s/%s", *di, n); - if (path == NULL) { + if (ret < 0 || path == NULL) { ret = ENOMEM; krb5_set_error_message(context, ret, "malloc: out of memory"); return ret; -- cgit