sudo_conf_debug_files: special handling of DSO members for AIX
When matching debug files for AIX-style DSOs like sudoers.a(sudoers.so) we want to match on the full name, the name without the member and on the member itself. This makes it possible to use the existing examples in the sudo.conf fiile on AIX.
This commit is contained in:
@@ -40,6 +40,9 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_DLOPEN
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#define SUDO_ERROR_WRAP 0
|
||||
|
||||
@@ -542,6 +545,28 @@ sudo_conf_debug_files_v1(const char *progname)
|
||||
}
|
||||
if (strcmp(debug_spec->progname, prog) == 0)
|
||||
debug_return_ptr(&debug_spec->debug_files);
|
||||
|
||||
#ifdef RTLD_MEMBER
|
||||
/* Handle names like sudoers.a(sudoers.so) for AIX. */
|
||||
const char *cp = strchr(prog, '(');
|
||||
const char *ep = strchr(prog, ')');
|
||||
if (cp != NULL && ep != NULL) {
|
||||
/* Match on the program name without the member. */
|
||||
size_t len = (size_t)(cp - prog);
|
||||
if (strncmp(debug_spec->progname, prog, len) == 0 &&
|
||||
debug_spec->progname[len] == '\0') {
|
||||
debug_return_ptr(&debug_spec->debug_files);
|
||||
}
|
||||
|
||||
/* Match on the member itself. */
|
||||
cp++;
|
||||
len = (size_t)(ep - cp);
|
||||
if (strncmp(debug_spec->progname, cp, len) == 0 &&
|
||||
debug_spec->progname[len] == '\0') {
|
||||
debug_return_ptr(&debug_spec->debug_files);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
debug_return_ptr(NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user