Todd C. Miller
ac61b5655d
Use EXIT_SUCCESS and EXIT_FAILURE more consistently.
2020-02-08 12:43:00 -07:00
Todd C. Miller
c92f39ed3d
Use json functions from libsudo_util in cvtsudoers.
2020-02-08 09:11:02 -07:00
Todd C. Miller
2fe127d108
Move some scripts from the top level src dir to a scripts dir.
2020-02-06 14:30:26 -07:00
Todd C. Miller
88f9f2ba9a
Add a simple API for writing JSON records.
...
To be used by the upcoming JSON audit module.
2020-01-30 13:12:25 -07:00
Todd C. Miller
ed294b8283
Add code to generate universally unique identifiers.
...
We create type 4, variant 1 uuids (random).
2020-01-30 13:12:25 -07:00
Todd C. Miller
dc45c4d4ea
Add tests for arc4random_buf() and an implementation for those without.
2020-01-30 13:12:25 -07:00
Todd C. Miller
9d69c4a022
Allow getentropy.c to compile when MAP_ANON is unavailable.
2020-01-28 06:59:16 -07:00
Todd C. Miller
13cc65038f
Remove multi-thread support from arc4random.
...
Sudo is not multi-threaded so we don't need the added complexity.
2020-01-28 06:41:42 -07:00
Todd C. Miller
aa7ea419f0
Backed out changeset 9dce3ebb2c37
...
MAP_SGI_ANYADDR cannot be used in place of MAP_ANON
2020-01-28 05:49:41 -07:00
Todd C. Miller
1fd82e1499
Fix compilation on IRIX; Bug #915
...
IRIX lacks MAP_ANON (and MAP_ANONYMOUS) but we can use the IRIX-specific
flag MAP_SGI_ANYADDR instead. From Kazuo Kuroi
2020-01-27 16:14:57 -07:00
Todd C. Miller
36fbdc48ff
Add siglist.c and signame.c as dependencies for depend target.
...
Fixes running "make depend" in lib/util dir when siglist.c or
signame.c are not already present.
2020-01-20 10:45:20 -07:00
Todd C. Miller
5913c63642
Add abs_top_srcdir and abs_top_builddir and use them.
...
Configure provides absolution versions of srcdir, builddir, top_srcdir
and top_builddir. We can use these instead of calling pwd.
2020-01-20 06:37:42 -07:00
Todd C. Miller
d2b7148b6c
Using "libtool --clean" to remove regular files is slow.
...
We only need to use libtool's clean mode to remove files created by libtool.
2020-01-18 05:53:55 -07:00
Todd C. Miller
161750fc56
Really fix flushing of data in client_close().
...
Now that we call fmt_exit_message() from client_close() we do not
need to try to determine whether the read or write events were
pending in the old base.
We can't tell anyway because the active flag in the event was cleared
when the old sudo event base was destroyed. It is correct to enable
both the read and write events after formatting the ExitMessage.
2020-01-15 14:47:42 -07:00
Todd C. Miller
41242e121f
FreeBSD is missing SIGLWP (aka SIGTHR) in sys_signame[].
...
Don't test SIGLWP on FreeBSD where it is reserved for the thread
library and is not listed in sys_signame[].
2020-01-15 10:27:54 -07:00
Todd C. Miller
8aa815643f
Remove POD-style C<> markup (typewriter font) from sudo.conf
2020-01-02 13:12:27 -07:00
Todd C. Miller
4347ed90d4
Fix compilation on systems with SIGRTMIN/SIGRTMAX but not _SC_RTSIG_MAX.
2019-12-25 11:19:58 -07:00
Todd C. Miller
4690d3ecf6
Add cfmakeraw() for systems without it.
2019-12-23 13:15:34 -07: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
Robert Manner
c0d53d75eb
src/load_plugins, plugins/sudoers: added developer_mode sudo.conf option
...
It can be used to disable the enforcement that a plugin (shared object or
an imported python module) must be owned by root and not modifiable by
others.
This can make plugin development easier.
2019-12-14 12:55:42 -07:00
Robert Manner
6710048c8d
lib/util/sudo_debug.c: add a function for querying if debugging is needed
...
for a level.
Rationale: this way we can avoid computing details for the log which will
not happen at all if the computation is slow.
2019-12-14 12:55:42 -07:00
Todd C. Miller
3ec23ad5e1
Minor style cleanups.
...
Remove extraneous break after return statement.
Convert two old K&R function declarations.
2019-12-13 19:27:38 -07:00
Todd C. Miller
b14d633ec6
Add runas_check_shell flag to require a runas user to have a valid shell.
...
Not enabled by default.
2019-12-09 19:29:45 -07:00
Todd C. Miller
d7b4f88658
Use cfmakeraw() in sudo_term_raw() instead of doing it manually.
2019-12-07 12:25:51 -07:00
Todd C. Miller
22ffffe12b
Add sudo_ev_pending(), used to check whether an event is pending.
2019-12-07 08:42:08 -07:00
Todd C. Miller
3ab29e29bb
Add reference counting to debug register/deregister.
...
Fixes a potential problem when an instance is re-registered.
2019-12-03 20:03:19 -07:00
Todd C. Miller
20bc94635d
Add sudo_ev_set_v1 to the exports file.
2019-11-15 16:30:46 -07:00
Todd C. Miller
5793023ffd
Add a plugin interface to sudo main event loop.
2019-11-15 13:36:01 -07:00
Todd C. Miller
f6acc134f4
When freeing an event base, reset ev->base to NULL for associated events.
2019-11-15 13:35:19 -07:00
Todd C. Miller
f6a3dc6d27
Only write a carriage return if output is to a tty.
2019-11-08 19:40:49 -07:00
Todd C. Miller
b4878c95e7
Include a carriage return when printing warning messages.
...
Otherwise, if the command is running in a pty the output is stair-stepped.
2019-11-08 16:21:00 -07:00
Todd C. Miller
9f3bbdbd6f
Add sudo_parse_host_port_v1 and sudo_pow2_roundup_v1 to exports file.
2019-11-07 18:09:44 -07:00
Todd C. Miller
09f1c26490
Fix typo in closefrom emulation.
2019-11-06 13:41:52 -07:00
Todd C. Miller
98ce89ee80
Add unit test for parse_host_port and make an empty port an error.
2019-11-05 06:04:13 -07:00
Todd C. Miller
2949d2c47b
Fill in host and port pointers on success.
2019-11-04 13:28:09 -07:00
Todd C. Miller
b270b0c887
Split out code to parse host:port into a utility function.
2019-11-02 12:04:26 -06:00
Todd C. Miller
f1d0c99e03
Move bufsize_roundup() -> sudo_pow2_roundup() in libsudo_util.
2019-11-02 12:03:44 -06:00
Todd C. Miller
655fdde22b
We haven't needed -I$(top_srcdir) for a long time.
2019-11-02 12:00:04 -06:00
Todd C. Miller
ac36cf2d4b
In closefrom_fallback() use the interval [OPEN_MAX, INT_MAX].
...
We want to try closing at least OPEN_MAX fds but no more than INT_MAX.
On 64-bit systems it is possible for sysconf(_SC_OPEN_MAX) to return
a value larger than INT_MAX when the number of open files is unlimited.
2019-11-02 10:56:02 -06:00
Todd C. Miller
43df086186
Add dup3() emulation.
2019-11-02 10:52:55 -06:00
Todd C. Miller
dbf78d0716
Add fchmodat() and fstatat() emulation.
...
Note that fchmodat() emulation does not support AT_SYMLINK_NOFOLLOW
2019-10-24 20:04:33 -06:00
Todd C. Miller
6c6f0567ba
Avoid TOCTOU in sudo_mkdir_parents; Coverity CID 204357
2019-10-24 20:04:32 -06:00
Todd C. Miller
76eec78a33
Add basic support for event logging using a sudo-style log format.
2019-10-24 20:04:32 -06:00
Todd C. Miller
059b55ce72
Refactor code in sudoers that creates I/O log files to share with logsrvd.
2019-10-24 20:04:31 -06:00
Todd C. Miller
e0c9a9dfa3
Move mkdir_parents to libsudo_util.
2019-10-24 20:04:31 -06:00
Todd C. Miller
0d69de5b25
Move openat() emulation to lib/util and at unlinkat() emulation.
2019-10-24 20:04:30 -06:00
Todd C. Miller
aa99594575
Avoid invalid read when minval > maxval
2019-10-24 18:35:45 -06:00
Todd C. Miller
b157b96893
Add depend target to all Makefile.in files.
2019-10-21 15:20:21 -06:00
Todd C. Miller
e80079eaa8
Set resource limits in the sudo process to unlimited.
...
We don't want sudo to be limited by the caller's resource limits.
The original resource limits are restore before session setup.
2019-10-21 11:41:48 -06:00
Todd C. Miller
40bf4081be
Rename sudo_strtoid() to sudo_strtoidx() and add simplified sudo_strtoid()
2019-10-20 10:21:29 -06:00