**plugin_base_dir**
If set, determines the base directory where krb5 plugins are
located. The default value is the ``krb5/plugins`` subdirectory
- of the krb5 library directory.
+ of the krb5 library directory. This relation is subject to
+ parameter expansion (see below) in release 1.17 and later.
**preferred_preauth_types**
This allows you to set the preferred preauthentication types which
#endif
#endif /* _WINDOWS */
+#ifdef _WIN32
+#define DEFAULT_PLUGIN_BASE_DIR "%{LIBDIR}\\plugins"
+#else
#define DEFAULT_PLUGIN_BASE_DIR "@LIBDIR/krb5/plugins"
+#endif
+
+#if defined(_WIN64)
+#define PLUGIN_EXT "64.dll"
+#elif defined(_WIN32)
+#define PLUGIN_EXT "32.dll"
+#else
#define PLUGIN_EXT "@DYNOBJEXT"
+#endif
#define KDC_DIR "@LOCALSTATEDIR/krb5kdc"
#define KDC_RUN_DIR "@RUNSTATEDIR/krb5kdc"
} seed_data;
krb5_data seed;
int tmp;
+ char *plugin_dir = NULL;
/* Verify some assumptions. If the assumptions hold and the
compiler is optimizing, this should result in no code being
retval = profile_get_string(ctx->profile, KRB5_CONF_LIBDEFAULTS,
KRB5_CONF_PLUGIN_BASE_DIR, 0,
- DEFAULT_PLUGIN_BASE_DIR,
- &ctx->plugin_base_dir);
+ DEFAULT_PLUGIN_BASE_DIR, &plugin_dir);
+ if (!retval)
+ retval = k5_expand_path_tokens(ctx, plugin_dir, &ctx->plugin_base_dir);
if (retval) {
TRACE_PROFILE_ERR(ctx, KRB5_CONF_PLUGIN_BASE_DIR,
KRB5_CONF_LIBDEFAULTS, retval);
(void)profile_get_string(ctx->profile, KRB5_CONF_LIBDEFAULTS,
KRB5_CONF_ERR_FMT, NULL, NULL, &ctx->err_fmt);
*context_out = ctx;
- return 0;
+ ctx = NULL;
cleanup:
+ profile_release_string(plugin_dir);
krb5_free_context(ctx);
return retval;
}
{
krb5_error_code ret;
struct plugin_interface *interface = get_interface(context, interface_id);
- char *path;
+ char *fname, *path;
/* Disallow registering plugins after load. */
if (interface == NULL || interface->configured)
return EINVAL;
- if (asprintf(&path, "%s/%s%s", modsubdir, modname, PLUGIN_EXT) < 0)
+ if (asprintf(&fname, "%s%s", modname, PLUGIN_EXT) < 0)
return ENOMEM;
+ ret = k5_path_join(modsubdir, fname, &path);
+ free(fname);
+ if (ret)
+ return ret;
ret = register_module(context, interface, modname, path, NULL);
free(path);
return ret;