git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@2637 e7ae566f-a301-0410-adde-c780ea21d3b5
| ... | ... |
@@ -191,7 +191,26 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o) |
| 191 | 191 |
|
| 192 | 192 |
#if defined(USE_LIBDL) |
| 193 | 193 |
|
| 194 |
- p->handle = dlopen (p->so_pathname, RTLD_NOW); |
|
| 194 |
+ p->handle = NULL; |
|
| 195 |
+#if defined(PLUGIN_LIBDIR) |
|
| 196 |
+ if (!strrchr(p->so_pathname, '/')) |
|
| 197 |
+ {
|
|
| 198 |
+ char full[PATH_MAX]; |
|
| 199 |
+ |
|
| 200 |
+ openvpn_snprintf (full, sizeof(full), "%s/%s", PLUGIN_LIBDIR, p->so_pathname); |
|
| 201 |
+ p->handle = dlopen (full, RTLD_NOW); |
|
| 202 |
+#if defined(ENABLE_PLUGIN_SEARCH) |
|
| 203 |
+ if (!p->handle) |
|
| 204 |
+ {
|
|
| 205 |
+ p->handle = dlopen (p->so_pathname, RTLD_NOW); |
|
| 206 |
+ } |
|
| 207 |
+#endif |
|
| 208 |
+ } |
|
| 209 |
+ else |
|
| 210 |
+#endif |
|
| 211 |
+ {
|
|
| 212 |
+ p->handle = dlopen (p->so_pathname, RTLD_NOW); |
|
| 213 |
+ } |
|
| 195 | 214 |
if (!p->handle) |
| 196 | 215 |
msg (M_ERR, "PLUGIN_INIT: could not load plugin shared object %s: %s", p->so_pathname, dlerror()); |
| 197 | 216 |
|