Commit Graph

40 Commits

Author SHA1 Message Date
Todd C. Miller
6dff4ac7fd 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.
2016-11-16 10:13:26 -07:00
Todd C. Miller
66af45eb24 Add regress for noexec functionality 2016-11-14 14:21:08 -07:00
Todd C. Miller
1ec4d9918d Move sudo_debug_execve() call into sudo_execve(). 2016-06-09 10:48:59 -06:00
Todd C. Miller
b20977d445 Add support for using fexecve() if supported on commands that are
checksummed.
2016-01-04 10:35:18 -07:00
Todd C. Miller
88a634b7fb Check for existing dso in LD_PRELOAD and only add it if it is not
already present.
2015-12-20 14:08:47 -07:00
Todd C. Miller
55531958de Allow sudo.conf Path settings to disable path names (by setting the
value of NULL).
2015-12-18 12:31:28 -07:00
Todd C. Miller
4536480800 Refactor code to set LD_PRELOAD (or the equivalent) in the environment
into a preload_dso() function.  Also avoid allocating a new copy
of the environment array if the size of the array does not change.
2015-12-16 15:08:01 -07:00
Todd C. Miller
0b241088b3 There's no need to conditionalize the #include <unistd.h>, we require
a POSIX system.
2015-07-02 09:08:28 -06:00
Todd C. Miller
4a07b472f0 Only include stddef.h where it is needed. 2015-06-20 05:34:35 -06:00
Todd C. Miller
c36415417f Add function name to "unable to allocate memory" warnings. 2015-06-19 14:51:17 -06:00
Todd C. Miller
dc883f2454 We require ANSI C so stop using the obsolete STDC_HEADERS. 2015-06-19 14:29:27 -06:00
Todd C. Miller
cb63ca701c Avoid using exiting allocators in the front end. 2015-06-17 17:00:54 -06:00
Todd C. Miller
4131449ffb Add a few missing sudo_new_key_val() return value checks.
Also use non-exiting allocators for consistency.
2015-05-27 09:42:51 -06:00
Todd C. Miller
59ab26dbcc Go back to a 2 args debug_decl and just use the "default" instance,
now renamed "active".
2015-02-01 08:24:49 -07:00
Todd C. Miller
866cfc4fc3 Add support for multiple Debug lines per program. Callers may
register arbitrary debug facilities or use built-in defaults.  We
now use separate Debug statements for plugins and programs.
2014-10-22 13:23:05 -06:00
Todd C. Miller
7ab40be5c0 On AIX, _PATH_BSHELL is /usr/bin/bsh but we want to use /usr/bin/sh
(which is usually ksh).  This makes sudo's behavior when executing
a shell without the #! magic number match execvp() on AIX.
2014-09-20 09:21:51 -06:00
Todd C. Miller
36a5767e3e efree -> sudo_efree for consistency 2014-07-10 15:35:04 -06:00
Todd C. Miller
2d61d38c23 Add sudo_ prefix to alloc.c functions and rename alloc.h -> sudo_alloc.h 2014-06-27 10:48:31 -06:00
Todd C. Miller
aecef4aa1d Rename warning/fatal -> sudo_warn/sudo_fatal to avoid namespace
pollution in libsudo_util.so.
2014-06-27 09:30:52 -06:00
Todd C. Miller
9ba5d82926 Rename fmt_string -> sudo_new_key_val to better describe its function. 2014-06-26 15:51:15 -06:00
Todd C. Miller
134b2a4228 Rename emalloc2() -> emallocarray() and erealloc3() -> ereallocarray(). 2014-04-22 16:02:28 -06:00
Todd C. Miller
bb9775879b Make noexec parameter to sudo_execve() bool. 2014-01-08 17:02:22 -07:00
Todd C. Miller
7dabe334b3 Fix a warning on Solaris, we need to use debug_return_const_ptr. 2013-12-09 14:06:46 -07:00
Todd C. Miller
b082a614f5 On Solaris, disabling the proc_exec privilege appears to interfere
with DAC file permissions.  Adding DAC override permissions to the
inheritable set works around this for commands run as root without
giving extra permissions to other users.  Bug #626
2013-12-02 11:14:25 -07:00
Todd C. Miller
96eb2c4f8f Add warning_gettext() wrapper function that changes to the user locale,
then calls gettext().
Add U_ macro that calls warning_gettext() instead of gettext().
Rename warning2()/error2() back to warning_nodebug()/error_nodebug().
2013-11-18 08:59:57 -07:00
Todd C. Miller
6c71ad5c15 Add debug_return_const_str and debug_return_const_ptr for returning
a const string or pointer.  Using const for the normal versions
produces warnings with the Tru64 compiler.
2013-11-17 16:11:39 -07:00
Todd C. Miller
85fc5792d4 Change some fatalx(NULL) that should be fatal(NULL). 2013-08-15 13:06:49 -06:00
Todd C. Miller
d6282d154a Update copyright years. 2013-04-24 09:35:02 -04:00
Todd C. Miller
39acd2fcba Rename error/errorx -> fatal/fatalx and remove the exit value as
it was always 1.
2013-04-18 14:07:59 -04:00
Todd C. Miller
eb2259bc12 Move exec_cmnd to exec.c to fix a compilation issue with sesh.c 2013-03-14 19:59:07 -04:00
Todd C. Miller
5cb928c512 If the policy plugin does not provide a close function, there is
no command timeout and no pty is required, skip the event loop and
just exec the command directly.
2013-02-23 14:19:07 -05:00
Todd C. Miller
1d7072fe09 Don't include <sys/param.h>. We only needed it for MAXPATHLEN,
MAXHOSTNAMELEN and the MIN/MAX macros.  We now use PATH_MAX and
HOST_NAME_MAX throughout without falling back on MAXPATHLEN or
MAXHOSTNAMELEN and define our own MIN/MAX macros as needed.
2012-12-04 10:40:47 -05:00
Todd C. Miller
7b3d268687 Call gettext() on parameters for warning()/warningx() instead of
having warning() do it for us.
2012-11-25 09:34:04 -05:00
Todd C. Miller
595d3b2651 Display warning/error messages in the user's locale. 2012-11-08 15:37:44 -05:00
Todd C. Miller
1d90c0ad71 No need to translate "unable to allocate memory" when we can just
use the system translation via strerror().
2012-09-17 16:59:26 -04:00
Todd C. Miller
e4e815dd82 Include signal.h before sudo_exec.h since it uses sigset_t * in the
fork_pty prototype.
2012-08-10 15:29:07 -04:00
Todd C. Miller
22f4f10a3a Check for LD_PRELOAD variants in configure instead of checkign cpp
symbols.  In disable_execute(), compute the length of the new envp
and allocate it once instead of reallocating on demand.  Also append
old value of LD_PRELOAD (if any) to the new value.
2012-02-21 13:26:02 -05:00
Todd C. Miller
cd0e10e1b7 Fix noexec for Mac OS X. 2012-02-07 00:18:08 -05:00
Todd C. Miller
ca4a338c45 Fix potential off-by-one when making a copy of the environment for
LD_PRELOAD insertion.  Fixes bug #534
2012-01-30 13:49:24 -05:00
Todd C. Miller
d11e7febbc Refactor disable_execute() and my_execve() into exec_common.c for
use by sesh.c.  This fixes NOEXEC when SELinux is used.  Instead
of disabling exec in exec_setup(), disable it immediately before
executing the command.  Adapted from a diff by Arno Schuring.
2012-01-25 14:58:02 -05:00