Add dlopen() emulation for systems without it.

For HP-UX 10, emulate using shl_load().
For others, link sudoers plugin statically and use a lookup
table to emulate dlsym().
This commit is contained in:
Todd C. Miller
2010-09-26 17:41:35 -04:00
parent b0b57fbef9
commit f538ed4e35
16 changed files with 353 additions and 41 deletions

View File

@@ -37,13 +37,21 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#else
# include "compat/dlfcn.h"
#endif
#include <errno.h>
#include <dlfcn.h>
#include "sudo.h"
#include "sudo_plugin.h"
#include "sudo_plugin_int.h"
#ifndef RTLD_LOCAL
# define RTLD_LOCAL 0
#endif
/*
* Read in /etc/sudo.conf
* Returns a list of plugins.
@@ -157,7 +165,7 @@ sudo_load_plugins(const char *conf_file,
errorx(1, "%s must be only be writable by owner", path);
/* Open plugin and map in symbol */
handle = dlopen(path, RTLD_LAZY);
handle = dlopen(path, RTLD_LAZY|RTLD_LOCAL);
if (!handle)
errorx(1, "unable to dlopen %s: %s", path, dlerror());
plugin = dlsym(handle, info->symbol_name);