Always install plugins with a .so extension regardless of what
extension the system uses for shared libraries. That way the group_plugin sudoers setting can be shared between heterogenous systems.
This commit is contained in:
8
configure
vendored
8
configure
vendored
@@ -13675,18 +13675,18 @@ $as_echo_n "checking path to sudo_noexec.so... " >&6; }
|
|||||||
# Check whether --with-noexec was given.
|
# Check whether --with-noexec was given.
|
||||||
if test "${with_noexec+set}" = set; then :
|
if test "${with_noexec+set}" = set; then :
|
||||||
withval=$with_noexec; case $with_noexec in
|
withval=$with_noexec; case $with_noexec in
|
||||||
yes) with_noexec="$libexecdir/sudo/sudo_noexec$_shrext"
|
yes) with_noexec="$libexecdir/sudo/sudo_noexec.so"
|
||||||
;;
|
;;
|
||||||
no) ;;
|
no) ;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
with_noexec="$libexecdir/sudo/sudo_noexec$_shrext"
|
with_noexec="$libexecdir/sudo/sudo_noexec.so"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_noexec" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_noexec" >&5
|
||||||
$as_echo "$with_noexec" >&6; }
|
$as_echo "$with_noexec" >&6; }
|
||||||
NOEXECFILE="sudo_noexec$_shrext"
|
NOEXECFILE="sudo_noexec.so"
|
||||||
NOEXECDIR="`echo $with_noexec|sed -e 's:^${\([^}]*\)}:$(\1):' -e 's:^\(.*\)/[^/]*:\1:'`"
|
NOEXECDIR="`echo $with_noexec|sed -e 's:^${\([^}]*\)}:$(\1):' -e 's:^\(.*\)/[^/]*:\1:'`"
|
||||||
|
|
||||||
# Extract the first word of "uname", so it can be a program name with args.
|
# Extract the first word of "uname", so it can be a program name with args.
|
||||||
@@ -21200,7 +21200,7 @@ EOF
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat >>confdefs.h <<EOF
|
cat >>confdefs.h <<EOF
|
||||||
#define SUDOERS_PLUGIN "sudoers${SOEXT}"
|
#define SUDOERS_PLUGIN "sudoers.so"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
exec_prefix="$oexec_prefix"
|
exec_prefix="$oexec_prefix"
|
||||||
|
@@ -1491,13 +1491,13 @@ fi
|
|||||||
AC_MSG_CHECKING(path to sudo_noexec.so)
|
AC_MSG_CHECKING(path to sudo_noexec.so)
|
||||||
AC_ARG_WITH(noexec, [AS_HELP_STRING([--with-noexec[=PATH]], [fully qualified pathname of sudo_noexec.so])],
|
AC_ARG_WITH(noexec, [AS_HELP_STRING([--with-noexec[=PATH]], [fully qualified pathname of sudo_noexec.so])],
|
||||||
[case $with_noexec in
|
[case $with_noexec in
|
||||||
yes) with_noexec="$libexecdir/sudo/sudo_noexec$_shrext"
|
yes) with_noexec="$libexecdir/sudo/sudo_noexec.so"
|
||||||
;;
|
;;
|
||||||
no) ;;
|
no) ;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac], [with_noexec="$libexecdir/sudo/sudo_noexec$_shrext"])
|
esac], [with_noexec="$libexecdir/sudo/sudo_noexec.so"])
|
||||||
AC_MSG_RESULT($with_noexec)
|
AC_MSG_RESULT($with_noexec)
|
||||||
NOEXECFILE="sudo_noexec$_shrext"
|
NOEXECFILE="sudo_noexec.so"
|
||||||
NOEXECDIR="`echo $with_noexec|sed -e 's:^${\([[^}]]*\)}:$(\1):' -e 's:^\(.*\)/[[^/]]*:\1:'`"
|
NOEXECDIR="`echo $with_noexec|sed -e 's:^${\([[^}]]*\)}:$(\1):' -e 's:^\(.*\)/[[^/]]*:\1:'`"
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
@@ -3597,7 +3597,7 @@ if test X"$with_noexec" != X"no" -o X"$with_selinux" != X"no"; then
|
|||||||
eval PLUGINDIR="$_PLUGINDIR"
|
eval PLUGINDIR="$_PLUGINDIR"
|
||||||
done
|
done
|
||||||
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_PLUGIN_DIR, "$PLUGINDIR/")
|
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_PLUGIN_DIR, "$PLUGINDIR/")
|
||||||
SUDO_DEFINE_UNQUOTED(SUDOERS_PLUGIN, "sudoers${SOEXT}")
|
SUDO_DEFINE_UNQUOTED(SUDOERS_PLUGIN, "sudoers.so")
|
||||||
exec_prefix="$oexec_prefix"
|
exec_prefix="$oexec_prefix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -119,10 +119,10 @@ install-includes:
|
|||||||
install-doc:
|
install-doc:
|
||||||
|
|
||||||
install-plugin: install-dirs group_file.la
|
install-plugin: install-dirs group_file.la
|
||||||
$(INSTALL) -b~ -m $(shlib_mode) .libs/group_file$(soext) $(DESTDIR)$(plugindir)
|
$(INSTALL) -b~ -m $(shlib_mode) .libs/group_file$(soext) $(DESTDIR)$(plugindir)/group_file.so
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm -f $(DESTDIR)$(plugindir)/group_file$(soext)
|
-rm -f $(DESTDIR)$(plugindir)/group_file.so
|
||||||
|
|
||||||
check:
|
check:
|
||||||
|
|
||||||
|
@@ -118,10 +118,10 @@ install-includes:
|
|||||||
install-doc:
|
install-doc:
|
||||||
|
|
||||||
install-plugin: install-dirs sample_plugin.la
|
install-plugin: install-dirs sample_plugin.la
|
||||||
$(INSTALL) -b~ -m $(shlib_mode) .libs/sample_plugin$(soext) $(DESTDIR)$(plugindir)
|
$(INSTALL) -b~ -m $(shlib_mode) .libs/sample_plugin$(soext) $(DESTDIR)$(plugindir)/sample_plugin.so
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm -f $(DESTDIR)$(plugindir)/sample_plugin$(soext)
|
-rm -f $(DESTDIR)$(plugindir)/sample_plugin.so
|
||||||
|
|
||||||
check:
|
check:
|
||||||
|
|
||||||
|
@@ -287,7 +287,7 @@ install-plugin: sudoers.la install-dirs
|
|||||||
if [ X"$(soext)" != X"" ]; then \
|
if [ X"$(soext)" != X"" ]; then \
|
||||||
test X"$$SUDO_PREINSTALL_CMD" != X"" && \
|
test X"$$SUDO_PREINSTALL_CMD" != X"" && \
|
||||||
$$SUDO_PREINSTALL_CMD .libs/sudoers$(soext); \
|
$$SUDO_PREINSTALL_CMD .libs/sudoers$(soext); \
|
||||||
$(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -m $(shlib_mode) .libs/sudoers$(soext) $(DESTDIR)$(plugindir); \
|
$(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -m $(shlib_mode) .libs/sudoers$(soext) $(DESTDIR)$(plugindir)/sudoers.so; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install-sudoers: install-dirs
|
install-sudoers: install-dirs
|
||||||
@@ -298,7 +298,7 @@ install-sudoers: install-dirs
|
|||||||
sudoers $(DESTDIR)$(sudoersdir)/sudoers
|
sudoers $(DESTDIR)$(sudoersdir)/sudoers
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm -f $(DESTDIR)$(plugindir)/sudoers$(soext)
|
-rm -f $(DESTDIR)$(plugindir)/sudoers.so
|
||||||
-rm -f $(DESTDIR)$(replaydir)/sudoreplay
|
-rm -f $(DESTDIR)$(replaydir)/sudoreplay
|
||||||
-rm -f $(DESTDIR)$(visudodir)/visudo
|
-rm -f $(DESTDIR)$(visudodir)/visudo
|
||||||
-cmp $(DESTDIR)$(sudoersdir)/sudoers $(srcdir)/sudoers >/dev/null && \
|
-cmp $(DESTDIR)$(sudoersdir)/sudoers $(srcdir)/sudoers >/dev/null && \
|
||||||
|
@@ -119,10 +119,10 @@ install-includes:
|
|||||||
install-doc:
|
install-doc:
|
||||||
|
|
||||||
install-plugin: install-dirs system_group.la
|
install-plugin: install-dirs system_group.la
|
||||||
$(INSTALL) -b~ -m $(shlib_mode) .libs/system_group$(soext) $(DESTDIR)$(plugindir)
|
$(INSTALL) -b~ -m $(shlib_mode) .libs/system_group$(soext) $(DESTDIR)$(plugindir)/system_group.so
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm -f $(DESTDIR)$(plugindir)/system_group$(soext)
|
-rm -f $(DESTDIR)$(plugindir)/system_group.so
|
||||||
|
|
||||||
check:
|
check:
|
||||||
|
|
||||||
|
@@ -53,6 +53,69 @@
|
|||||||
# define RTLD_GLOBAL 0
|
# define RTLD_GLOBAL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int
|
||||||
|
sudo_stat_plugin(struct plugin_info *info, char *fullpath,
|
||||||
|
size_t pathsize, struct stat *sb)
|
||||||
|
{
|
||||||
|
int status = -1;
|
||||||
|
debug_decl(sudo_stat_plugin, SUDO_DEBUG_PLUGIN)
|
||||||
|
|
||||||
|
if (info->path[0] == '/') {
|
||||||
|
if (strlcpy(fullpath, info->path, pathsize) >= pathsize) {
|
||||||
|
warningx(_("error in %s, line %d while loading plugin `%s'"),
|
||||||
|
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||||
|
warningx(_("%s: %s"), info->path, strerror(ENAMETOOLONG));
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
status = stat(fullpath, sb);
|
||||||
|
} else {
|
||||||
|
if (snprintf(fullpath, pathsize, "%s%s", _PATH_SUDO_PLUGIN_DIR,
|
||||||
|
info->path) >= pathsize) {
|
||||||
|
warningx(_("error in %s, line %d while loading plugin `%s'"),
|
||||||
|
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||||
|
warningx(_("%s%s: %s"), _PATH_SUDO_PLUGIN_DIR, info->path,
|
||||||
|
strerror(ENAMETOOLONG));
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
/* Try parent dir for compatibility with old plugindir default. */
|
||||||
|
if ((status = stat(fullpath, sb)) != 0) {
|
||||||
|
char *cp = strrchr(fullpath, '/');
|
||||||
|
if (cp > fullpath + 4 && cp[-5] == '/' && cp[-4] == 's' &&
|
||||||
|
cp[-3] == 'u' && cp[-2] == 'd' && cp[-1] == 'o') {
|
||||||
|
int serrno = errno;
|
||||||
|
strlcpy(cp - 4, info->path, pathsize - (cp - 4 - fullpath));
|
||||||
|
if ((status = stat(fullpath, sb)) != 0)
|
||||||
|
errno = serrno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef __hpux__
|
||||||
|
/* Try .sl instead of .so on HP-UX for backwards compatibility. */
|
||||||
|
if (status != 0) {
|
||||||
|
size_t len = strlen(info->path);
|
||||||
|
if (len >= 3 && info->path[len - 3] == '.' &&
|
||||||
|
info->path[len - 2] == 's' && info->path[len - 1] == 'o') {
|
||||||
|
const char *sopath = info->path;
|
||||||
|
char *slpath = estrdup(info->path);
|
||||||
|
int serrno = errno;
|
||||||
|
|
||||||
|
slpath[len - 1] = 'l';
|
||||||
|
info->path = slpath;
|
||||||
|
status = sudo_stat_plugin(info, fullpath, pathsize, sb);
|
||||||
|
if (status == 0) {
|
||||||
|
efree((void *)sopath);
|
||||||
|
} else {
|
||||||
|
efree(slpath);
|
||||||
|
info->path = sopath;
|
||||||
|
errno = serrno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
done:
|
||||||
|
debug_return_int(status);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load the plugin specified by "info".
|
* Load the plugin specified by "info".
|
||||||
*/
|
*/
|
||||||
@@ -69,35 +132,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
|
|||||||
int status;
|
int status;
|
||||||
debug_decl(sudo_load_plugin, SUDO_DEBUG_PLUGIN)
|
debug_decl(sudo_load_plugin, SUDO_DEBUG_PLUGIN)
|
||||||
|
|
||||||
if (info->path[0] == '/') {
|
status = sudo_stat_plugin(info, path, sizeof(path), &sb);
|
||||||
if (strlcpy(path, info->path, sizeof(path)) >= sizeof(path)) {
|
|
||||||
warningx(_("error in %s, line %d while loading plugin `%s'"),
|
|
||||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
|
||||||
warningx(_("%s: %s"), info->path, strerror(ENAMETOOLONG));
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
status = stat(path, &sb);
|
|
||||||
} else {
|
|
||||||
if (snprintf(path, sizeof(path), "%s%s", _PATH_SUDO_PLUGIN_DIR,
|
|
||||||
info->path) >= sizeof(path)) {
|
|
||||||
warningx(_("error in %s, line %d while loading plugin `%s'"),
|
|
||||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
|
||||||
warningx(_("%s%s: %s"), _PATH_SUDO_PLUGIN_DIR, info->path,
|
|
||||||
strerror(ENAMETOOLONG));
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
/* Try parent dir for compatibility with old plugindir default. */
|
|
||||||
if ((status = stat(path, &sb)) != 0) {
|
|
||||||
char *cp = strrchr(path, '/');
|
|
||||||
if (cp > path + 4 && cp[-5] == '/' && cp[-4] == 's' &&
|
|
||||||
cp[-3] == 'u' && cp[-2] == 'd' && cp[-1] == 'o') {
|
|
||||||
int serrno = errno;
|
|
||||||
strlcpy(cp - 4, info->path, sizeof(path) - (cp - 4 - path));
|
|
||||||
if ((status = stat(path, &sb)) != 0)
|
|
||||||
errno = serrno;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
warningx(_("error in %s, line %d while loading plugin `%s'"),
|
warningx(_("error in %s, line %d while loading plugin `%s'"),
|
||||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||||
|
Reference in New Issue
Block a user