Fix support for AIX-style path(module) syntax in sudo.conf Plugin lines.

This commit is contained in:
Todd C. Miller
2022-12-22 16:45:13 -07:00
parent 27aff55ac8
commit 49f2d67070
2 changed files with 16 additions and 2 deletions

View File

@@ -240,7 +240,7 @@ sudo_dso_load_v1(const char *path, int mode)
cp = strrchr(path, '(');
if (cp != NULL) {
size_t len = strlen(cp);
if (len > 2 && cp[len - 1] == '\0')
if (len > 2 && cp[len - 1] == ')')
SET(flags, RTLD_MEMBER);
}
# endif /* RTLD_MEMBER */

View File

@@ -82,7 +82,21 @@ sudo_stat_plugin(struct plugin_info *info, char *fullpath,
}
status = stat(fullpath, sb);
}
if (status == -1) {
#ifdef _AIX
if (status == -1 && errno == ENOENT) {
/* Check for AIX path(module) syntax. */
char *cp = strrchr(fullpath, '(');
if (cp != NULL) {
/* Only for archive files (e.g. sudoers.a). */
if (cp > fullpath + 2 && cp[-2] == '.' && cp[-1] == 'a') {
*cp = '\0';
status = stat(fullpath, sb);
*cp = '(';
}
}
}
#endif /* _AIX */
if (status == -1 && errno == ENOENT) {
char *newpath = sudo_stat_multiarch(fullpath, sb);
if (newpath != NULL) {
len = strlcpy(fullpath, newpath, pathsize);