forked from pool/openvpn
31 lines
939 B
Plaintext
31 lines
939 B
Plaintext
--- plugin.c
|
|
+++ plugin.c 2007/11/28 08:58:20
|
|
@@ -182,7 +182,26 @@ plugin_init_item (struct plugin *p, cons
|
|
p->plugin_type_mask = plugin_supported_types ();
|
|
|
|
#if defined(USE_LIBDL)
|
|
- p->handle = dlopen (p->so_pathname, RTLD_NOW);
|
|
+ p->handle = NULL;
|
|
+#if defined(PLUGIN_LIBDIR)
|
|
+ if (!strchr(p->so_pathname, '/'))
|
|
+ {
|
|
+ char full[PATH_MAX], *name;
|
|
+
|
|
+ snprintf(full, sizeof(full), "%s/%s", PLUGIN_LIBDIR, p->so_pathname);
|
|
+ p->handle = dlopen (full, RTLD_NOW);
|
|
+#if defined(ENABLE_PLUGIN_SEARCH)
|
|
+ if (!p->handle)
|
|
+ {
|
|
+ p->handle = dlopen (p->so_pathname, RTLD_NOW);
|
|
+ }
|
|
+#endif
|
|
+ }
|
|
+ else
|
|
+#endif
|
|
+ {
|
|
+ p->handle = dlopen (p->so_pathname, RTLD_NOW);
|
|
+ }
|
|
if (!p->handle)
|
|
msg (M_ERR, "PLUGIN_INIT: could not load plugin shared object %s: %s", p->so_pathname, dlerror());
|
|
libdl_resolve_symbol (p->handle, (void*)&p->open, "openvpn_plugin_open_v1", p->so_pathname, PLUGIN_SYMBOL_REQUIRED);
|