# Check whether --with-noexec was given.
if test "${with_noexec+set}" = set; then :
withval=$with_noexec; case $with_noexec in
- yes) with_noexec="$libexecdir/sudo/sudo_noexec$_shrext"
+ yes) with_noexec="$libexecdir/sudo/sudo_noexec.so"
;;
no) ;;
*) ;;
esac
else
- with_noexec="$libexecdir/sudo/sudo_noexec$_shrext"
+ with_noexec="$libexecdir/sudo/sudo_noexec.so"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_noexec" >&5
$as_echo "$with_noexec" >&6; }
-NOEXECFILE="sudo_noexec$_shrext"
+NOEXECFILE="sudo_noexec.so"
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.
EOF
cat >>confdefs.h <<EOF
-#define SUDOERS_PLUGIN "sudoers${SOEXT}"
+#define SUDOERS_PLUGIN "sudoers.so"
EOF
exec_prefix="$oexec_prefix"
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])],
[case $with_noexec in
- yes) with_noexec="$libexecdir/sudo/sudo_noexec$_shrext"
+ yes) with_noexec="$libexecdir/sudo/sudo_noexec.so"
;;
no) ;;
*) ;;
-esac], [with_noexec="$libexecdir/sudo/sudo_noexec$_shrext"])
+esac], [with_noexec="$libexecdir/sudo/sudo_noexec.so"])
AC_MSG_RESULT($with_noexec)
-NOEXECFILE="sudo_noexec$_shrext"
+NOEXECFILE="sudo_noexec.so"
NOEXECDIR="`echo $with_noexec|sed -e 's:^${\([[^}]]*\)}:$(\1):' -e 's:^\(.*\)/[[^/]]*:\1:'`"
dnl
eval PLUGINDIR="$_PLUGINDIR"
done
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"
fi
# define RTLD_GLOBAL 0
#endif
-/*
- * Load the plugin specified by "info".
- */
-static bool
-sudo_load_plugin(struct plugin_container *policy_plugin,
- struct plugin_container_list *io_plugins, struct plugin_info *info)
+static int
+sudo_stat_plugin(struct plugin_info *info, char *fullpath,
+ size_t pathsize, struct stat *sb)
{
- struct plugin_container *container;
- struct generic_plugin *plugin;
- struct stat sb;
- void *handle;
- char path[PATH_MAX];
- bool rval = false;
- int status;
- debug_decl(sudo_load_plugin, SUDO_DEBUG_PLUGIN)
+ int status = -1;
+ debug_decl(sudo_stat_plugin, SUDO_DEBUG_PLUGIN)
if (info->path[0] == '/') {
- if (strlcpy(path, info->path, sizeof(path)) >= sizeof(path)) {
+ 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(path, &sb);
+ status = stat(fullpath, sb);
} else {
- if (snprintf(path, sizeof(path), "%s%s", _PATH_SUDO_PLUGIN_DIR,
- info->path) >= sizeof(path)) {
+ 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,
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' &&
+ 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, sizeof(path) - (cp - 4 - path));
- if ((status = stat(path, &sb)) != 0)
+ 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".
+ */
+static bool
+sudo_load_plugin(struct plugin_container *policy_plugin,
+ struct plugin_container_list *io_plugins, struct plugin_info *info)
+{
+ struct plugin_container *container;
+ struct generic_plugin *plugin;
+ struct stat sb;
+ void *handle;
+ char path[PATH_MAX];
+ bool rval = false;
+ int status;
+ debug_decl(sudo_load_plugin, SUDO_DEBUG_PLUGIN)
+
+ status = sudo_stat_plugin(info, path, sizeof(path), &sb);
if (status != 0) {
warningx(_("error in %s, line %d while loading plugin `%s'"),
_PATH_SUDO_CONF, info->lineno, info->symbol_name);