Todd C. Miller
13672f28df
Make sudo pass -Wwrite-strings
2022-06-28 16:33:15 -06:00
Todd C. Miller
423fbedb65
Suspend the child process and wait for SIGUSR when using ptrace.
...
This fixes a race condition in ptrace-based intercept mode when
running the command in a pty. It was possible for the monitor to
receive SIGCHLD when the command sent itself SIGSTOP before the
main sudo process did.
2022-04-29 13:09:03 -06:00
Todd C. Miller
01733a5214
Add scaffolding for ptrace-based intercept mode.
2022-04-29 12:35:31 -06:00
Todd C. Miller
38d884a62d
Do not compile intercept code if --disable-intercept is specified.
2021-09-01 13:35:47 -06:00
Todd C. Miller
ba171724f7
Rename log_children -> log_subcmds
2021-08-26 16:36:41 -06:00
Todd C. Miller
dc30c842bb
No longer need to remap intercept fd but we do need to remap debug fd.
...
The intercept fd is closed in the ctor but the debug fd will still be open.
2021-08-26 09:57:25 -06:00
Todd C. Miller
abac069566
Fix compilation when configure option --disable-shared is specified.
2021-08-09 16:39:32 -06:00
Todd C. Miller
9c3df47da9
Move preload_dso() to its own file and rename to sudo_preload_dso().
...
It now takes an intercept fd as an optional argument instead of a
list of extra variables to add. This lets us check whether it is
already set to the expected value (and add it if not).
sudo_intercept.so now uses sudo_preload_dso() to make sure that
LD_PRELOAD and SUDO_INTERCEPT_FD are set properly before executing.
2021-08-09 15:50:25 -06:00
Todd C. Miller
4cf3d1c416
Implement sudo_intercept.so.
...
Uses protobuf to talk to main sudo process over a socketpair.
2021-08-09 15:50:25 -06:00
Todd C. Miller
a556b373c9
Allocate a socketpair to communicate with sudo_intercept.so over.
...
This is used for the intercept and log_children options.
2021-08-09 15:50:25 -06:00
Todd C. Miller
6287e8ca7d
Add support for loading the sudo_intercept.so DSO.
2021-08-09 15:50:25 -06:00
Todd C. Miller
4e11bc0e26
Suppress PVS Studio false positives.
2021-01-06 14:27:09 -07:00
Todd C. Miller
961a4afe67
Fix some warnings from pvs-studio
2020-08-12 13:45:09 -06:00
Todd C. Miller
446ae3f507
Include string.h unconditionally and only use strings.h for strn?casecmp()
...
In the pre-POSIX days BSD had strings.h, not string.h.
Now strings.h is only used for non-ANSI string functions.
2020-05-18 07:59:24 -06:00
Todd C. Miller
dd88460800
We no longer need to include headers we don't use for sudo*.h files.
...
Previously we needed to include headers required by the various
sudo*h files. Now those files are more self-sufficient and we
should only include headers needed by code in the various .c files.
2020-05-18 06:47:04 -06:00
Todd C. Miller
486ee2b71f
debug_decl and debug_decl_vars now require a semicolon at the end.
2019-12-22 08:48:16 -07:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
6c3d20cb41
Convert PVS-Studio comment to ANSI C.
2018-10-26 08:39:09 -06:00
Todd C. Miller
64e5d34c57
Add comments in .c files so PVS-Studio will check them.
2018-10-21 08:46:05 -06:00
Todd C. Miller
48fba3c2cc
update my email to Todd.Miller@sudo.ws
2017-12-03 17:53:40 -07:00
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