Skip to content

Commit 097bec0

Browse files
committed
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.
1 parent 24351bd commit 097bec0

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

lib/util/sudo_conf.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#include <errno.h>
4141
#include <fcntl.h>
4242
#include <limits.h>
43+
#ifdef HAVE_DLOPEN
44+
# include <dlfcn.h>
45+
#endif
4346

4447
#define SUDO_ERROR_WRAP 0
4548

@@ -542,6 +545,28 @@ sudo_conf_debug_files_v1(const char *progname)
542545
}
543546
if (strcmp(debug_spec->progname, prog) == 0)
544547
debug_return_ptr(&debug_spec->debug_files);
548+
549+
#ifdef RTLD_MEMBER
550+
/* Handle names like sudoers.a(sudoers.so) for AIX. */
551+
const char *cp = strchr(prog, '(');
552+
const char *ep = strchr(prog, ')');
553+
if (cp != NULL && ep != NULL) {
554+
/* Match on the program name without the member. */
555+
size_t len = (size_t)(cp - prog);
556+
if (strncmp(debug_spec->progname, prog, len) == 0 &&
557+
debug_spec->progname[len] == '\0') {
558+
debug_return_ptr(&debug_spec->debug_files);
559+
}
560+
561+
/* Match on the member itself. */
562+
cp++;
563+
len = (size_t)(ep - cp);
564+
if (strncmp(debug_spec->progname, cp, len) == 0 &&
565+
debug_spec->progname[len] == '\0') {
566+
debug_return_ptr(&debug_spec->debug_files);
567+
}
568+
}
569+
#endif
545570
}
546571
debug_return_ptr(NULL);
547572
}

0 commit comments

Comments
 (0)