]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Trace plugin module loading errors 1091/head
authorGreg Hudson <ghudson@mit.edu>
Sat, 27 Jun 2020 05:40:21 +0000 (01:40 -0400)
committerGreg Hudson <ghudson@mit.edu>
Tue, 30 Jun 2020 02:05:50 +0000 (22:05 -0400)
Add trace messages when dlopen() or dlsym() fails when loading a
plugin module.

ticket: 8922 (new)

src/include/k5-trace.h
src/lib/krb5/krb/plugin.c

index 1da53dbb10872cbc08db09cf7fdae6b0b633b1d7..853a367f28c28927461c4c72571c7a994b3fb1ec 100644 (file)
@@ -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)
index 5761de009472f6ccf4d52a8b2d88ddf0ee06597e..3bb7a38d44164cb044b7c2bcc960d52f501ef64f 100644 (file)
@@ -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;