krb5 commit: Trace plugin module loading errors
Greg Hudson
ghudson at mit.edu
Mon Jun 29 22:31:05 EDT 2020
https://github.com/krb5/krb5/commit/e362c356eafb49a9d90a4f20c6668682d4f50222
commit e362c356eafb49a9d90a4f20c6668682d4f50222
Author: Greg Hudson <ghudson at mit.edu>
Date: Sat Jun 27 01:40:21 2020 -0400
Trace plugin module loading errors
Add trace messages when dlopen() or dlsym() fails when loading a
plugin module.
ticket: 8922 (new)
src/include/k5-trace.h | 5 +++++
src/lib/krb5/krb/plugin.c | 14 ++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/include/k5-trace.h b/src/include/k5-trace.h
index 1da53db..853a367 100644
--- a/src/include/k5-trace.h
+++ b/src/include/k5-trace.h
@@ -299,6 +299,11 @@ void krb5int_trace(krb5_context context, const char *fmt, ...);
#define TRACE_NEGOEX_OUTGOING(c, seqnum, typestr, info) \
TRACE(c, "NegoEx sending [{int}]{str}: {str}", (int)seqnum, typestr, info)
+#define TRACE_PLUGIN_LOAD_FAIL(c, modname, err) \
+ TRACE(c, "Error loading plugin module {str}: {kerr}", modname, err)
+#define TRACE_PLUGIN_LOOKUP_FAIL(c, modname, err) \
+ TRACE(c, "Error initializing module {str}: {kerr}", modname, err)
+
#define TRACE_PREAUTH_CONFLICT(c, name1, name2, patype) \
TRACE(c, "Preauth module {str} conflicts with module {str} for pa " \
"type {patype}", name1, name2, patype)
diff --git a/src/lib/krb5/krb/plugin.c b/src/lib/krb5/krb/plugin.c
index 5761de0..3bb7a38 100644
--- a/src/lib/krb5/krb/plugin.c
+++ b/src/lib/krb5/krb/plugin.c
@@ -352,6 +352,7 @@ static void
load_if_needed(krb5_context context, struct plugin_mapping *map,
const char *iname)
{
+ krb5_error_code ret;
char *symname = NULL;
struct plugin_file_handle *handle = NULL;
void (*initvt_fn)();
@@ -360,10 +361,19 @@ load_if_needed(krb5_context context, struct plugin_mapping *map,
return;
if (asprintf(&symname, "%s_%s_initvt", iname, map->modname) < 0)
return;
- if (krb5int_open_plugin(map->dyn_path, &handle, &context->err))
+
+ ret = krb5int_open_plugin(map->dyn_path, &handle, &context->err);
+ if (ret) {
+ TRACE_PLUGIN_LOAD_FAIL(context, map->modname, ret);
goto err;
- if (krb5int_get_plugin_func(handle, symname, &initvt_fn, &context->err))
+ }
+
+ ret = krb5int_get_plugin_func(handle, symname, &initvt_fn, &context->err);
+ if (ret) {
+ TRACE_PLUGIN_LOOKUP_FAIL(context, map->modname, ret);
goto err;
+ }
+
free(symname);
map->dyn_handle = handle;
map->module = (krb5_plugin_initvt_fn)initvt_fn;
More information about the cvs-krb5
mailing list