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
676d3fc67b
Add missing depend target
2019-11-02 12:00:07 -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
ee91b7360b
Simplify expand_iolog_path()
2019-10-24 20:04:33 -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
13e3eaad5f
Simplify iolog_set_user and iolog_set_group
2019-10-24 20:04:33 -06:00
Todd C. Miller
56c21243d7
Add iolog_ prefix to exported functions in iolog_util.c
2019-10-24 20:04:33 -06:00
Todd C. Miller
aaf5d0dc6e
Read logsrvd.conf in two steps: first read, then apply if OK.
...
This fixes a problem where when logsrvd.conf was reloaded while
running (due to SIGHUP) and there was an error we could end up with
a partial config.
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
8552b283be
Avoid TOCTOU in iolog_mkdirs; Coverity CID 204356
2019-10-24 20:04:32 -06:00
Todd C. Miller
728ed2100b
Rename buffer.c -> logsrv_util.c and add iolog_seekto()
2019-10-24 20:04:32 -06:00
Todd C. Miller
b58ecb7e6d
Move read_timing_record() into libsudo_iolog
2019-10-24 20:04:32 -06:00
Todd C. Miller
3394785f6d
Add restart support for compresses I/O logs.
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
534aba7a3e
Make the logsrvd port and list address configurable.
2019-10-24 20:04:32 -06:00
Todd C. Miller
282263c113
Use openat(2) when opening files in the I/O log directory.
2019-10-24 20:04:31 -06:00
Todd C. Miller
7ba7c5835e
Enable sudo_logsrvd.conf settings.
2019-10-24 20:04:31 -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
Todd C. Miller
4229dfc566
Enable security auditing malloc options for "make check".
2019-10-17 13:41:53 -06:00
Todd C. Miller
43e44a9982
Inclue sudo_util.h to get sudo_strtonum() prototype.
2019-10-16 11:12:11 -06:00
Todd C. Miller
f5a7585a4f
strtonum -> sudo_strtonum
2019-10-16 11:04:09 -06:00
Todd C. Miller
1037b685eb
Make sure we don't go past the end of the string when out of range.
2019-10-16 10:08:33 -06:00
Todd C. Miller
e339d9950d
Fix stronum() regress test and the errno value for out of range numbers.
2019-10-16 09:37:41 -06:00
Todd C. Miller
29afe160a2
Split atofoo.c regress into multiple tests.
2019-10-16 08:45:32 -06:00
Todd C. Miller
2512f6efbf
Use sudo_strtonum() explicitly instead of via a macro.
2019-10-14 10:09:30 -06:00
Todd C. Miller
04a17095be
Always use our own strtonum and implement sudo_strtoid in terms of it.
2019-10-14 10:09:29 -06:00
Todd C. Miller
396bc57fef
Add sudo_strtoid() tests for -1 and range errors.
...
Also adjust testsudoers/test5 which relied upon gid -1 parsing.
2019-10-10 10:04:13 -06:00
Todd C. Miller
f752ae5cee
Treat an ID of -1 as invalid since that means "no change".
...
Fixes CVE-2019-14287.
Found by Joe Vennix from Apple Information Security.
2019-10-10 10:04:13 -06:00
Todd C. Miller
b7b3fb72d0
_rs_random_buf is currently unused
2019-09-27 08:55:51 -06:00
Todd C. Miller
73dd3849c6
Better error message when debug log file cannot be opened.
2019-09-21 07:47:24 -06:00
Todd C. Miller
8c96df036a
Fix sorting of the time-based event queue.
2019-09-13 16:49:13 -06:00
Todd C. Miller
751c0c4440
Support default base in got_exit, got_break, loopexit, loopbreak, loopcontinue
2019-09-13 16:26:09 -06:00
Todd C. Miller
b98b82e4a2
sys_signame on macOS contains lower-cases names
2019-08-19 14:25:05 -06:00
Todd C. Miller
0bbfdc9920
Add regress tests for str2sig() and sig2str().
2019-08-19 08:37:08 -06:00
Todd C. Miller
48066e0dbd
SIGIOT and SIGABRT are aliases on BSD systems.
2019-08-19 08:36:53 -06:00
Todd C. Miller
29534ad96a
Fix handling of real-time signals.
2019-08-19 08:36:30 -06:00
Todd C. Miller
3e56be3564
Store signal name, not number in I/O log timing file.
...
The "SIG" prefix is not used so, e.g. SIGTERM -> "TERM".
This makes the I/O log files portable from one system to another.
Older I/O log files with signal numbers can still be replayed.
2019-08-05 16:30:58 -06:00
Todd C. Miller
e91865fb22
Link util functions being tested directly with the test harness.
...
Otherwise we may get the version from the installed libsudo_util.so.
2019-07-26 15:09:13 -06:00
Todd C. Miller
9d8f374397
Add ssizeof macro that returns ssize_t.
...
We can use this instead of casting the result of size_t to int.
Also change checks for snprintf() returning <=0 to <0.
2019-06-25 09:45:10 -06:00