Always define _PATH_SUDO_NOEXEC, _PATH_SUDO_SESH, _PATH_SUDO_PLUGIN_DIR,

even if only defined to NULL.  This means the accessors can always be
present.

Use RTLD_PRELOAD_VAR instead of _PATH_SUDO_NOEXEC to tell when
noexec is available.

Add ENABLE_SUDO_PLUGIN_API and use it instead of _PATH_SUDO_PLUGIN_DIR
to tell when the plugin API is available.

Add sudo_conf_clear_paths() to clear the path values so the
regress tests are not affected by compile-time settings.
This commit is contained in:
Todd C. Miller
2016-11-16 10:13:26 -07:00
parent 8820ff3efb
commit 6dff4ac7fd
12 changed files with 55 additions and 18 deletions

View File

@@ -36,7 +36,7 @@
#include "sudo.h"
#include "sudo_exec.h"
#ifdef _PATH_SUDO_NOEXEC
#ifdef RTLD_PRELOAD_VAR
/*
* Add a DSO file to LD_PRELOAD or the system equivalent.
*/
@@ -144,7 +144,7 @@ preload_dso(char *envp[], const char *dso_file)
debug_return_ptr(envp);
}
#endif /* _PATH_SUDO_NOEXEC */
#endif /* RTLD_PRELOAD_VAR */
/*
* Disable execution of child processes in the command we are about
@@ -166,10 +166,10 @@ disable_execute(char *envp[], const char *dso)
sudo_warn(U_("unable to remove PRIV_PROC_EXEC from PRIV_LIMIT"));
#endif /* HAVE_PRIV_SET */
#ifdef _PATH_SUDO_NOEXEC
#ifdef RTLD_PRELOAD_VAR
if (dso != NULL)
envp = preload_dso(envp, dso);
#endif /* _PATH_SUDO_NOEXEC */
#endif /* RTLD_PRELOAD_VAR */
debug_return_ptr(envp);
}