]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
plugin-loader: Don't prevent dynamic linking in addition to static constructors
authorTobias Brunner <tobias@strongswan.org>
Mon, 11 Aug 2025 13:55:03 +0000 (15:55 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 22 Aug 2025 13:32:39 +0000 (15:32 +0200)
When built with static plugins and constructors, we might still want to
be able to load external plugins.

Fixes: d860c26e9533 ("plugin-loader: Properly support compilation without dlopen()/dlsym() etc.")
src/libstrongswan/plugins/plugin_loader.c

index 786b18332888117432fc0b53559c1f4217107e0c..0d4659f127c99192f74f859cd0f73e394d4715ad 100644 (file)
@@ -46,6 +46,9 @@ typedef struct plugin_entry_t plugin_entry_t;
  * Statically registered constructors
  */
 static hashtable_t *plugin_constructors = NULL;
+
+#elif !defined(HAVE_DLADDR)
+#error Neither dynamic linking nor static plugin constructors are supported!
 #endif
 
 /**
@@ -373,13 +376,12 @@ static status_t create_plugin(private_plugin_loader_t *this, void *handle,
        {
                constructor = plugin_constructors->get(plugin_constructors, name);
        }
-#elif defined(HAVE_DLADDR)
+#endif
+#ifdef HAVE_DLADDR
        if (!constructor)
        {
                constructor = dlsym(handle, create);
        }
-#else
-       #error Neither dynamic linking nor static plugin constructors are supported!
 #endif
        if (!constructor)
        {