From 32fe791c2e6756de724864cbab8561cf50a1889d Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 8 Feb 2019 15:08:12 -0500 Subject: [PATCH] lib/krb5: common plugin only fallback if load_fn() fails Only fallback to loading the plugin function table directly if if the initialization function is not exported. Failing a consistency check should not permit falling back to a potentially incompatible function table. Change-Id: Ic753ed9a090aef6073853f7309f0f8f0f29d0aa9 --- lib/krb5/plugin.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/krb5/plugin.c b/lib/krb5/plugin.c index ec04a13dd..a08d50829 100644 --- a/lib/krb5/plugin.c +++ b/lib/krb5/plugin.c @@ -597,7 +597,10 @@ add_dso_plugins_load_fn(krb5_context context, ret = load_fn(context, &get_instance, &n_ftables, &ftables); if (ret) { krb5_warn(context, ret, "plugin %s failed to load", dsopath); - return NULL; + + /* fallback to loading structure directly */ + return add_dso_plugin_struct(context, dsopath, + dsohandle, caller->name); } if (!validate_plugin_deps(context, caller, dsopath, get_instance)) @@ -651,11 +654,6 @@ search_modules(heim_object_t key, heim_object_t value, void *ctx) s->caller, path, p->dsohandle); - if (plugins == NULL) { - /* fallback to loading structure directly */ - plugins = add_dso_plugin_struct(s->context, path, - p->dsohandle, s->caller->name); - } if (plugins) { heim_dict_set_value(p->plugins_by_name, s->n, plugins); _krb5_debug(s->context, 5, "Loaded %zu %s %s plugin%s from %s",