Todd C. Miller
b2a32f95ee
getdelim_test: increase longstr to check end pointer after realloc
...
This would have caught the recent bug in our getdelim replacement
when run under address-sanitizer or valgrind.
2022-03-11 09:03:55 -07:00
Todd C. Miller
c48c511e91
Correctly update the end pointer when we expand the buffer.
...
From Robert Manner.
2022-03-11 08:00:38 -07:00
Todd C. Miller
6ff33922f4
sudo_secure_path: pass the struct stat * argument directly to stat(2)
...
Set the pointer to a struct stat on the stack if st is NULL.
Avoids a needless memcpy() at the end.
2022-03-10 20:16:51 -07:00
Todd C. Miller
31ab2e2297
Plug a few test memory leaks now that they return from main().
2022-03-08 13:34:38 -07:00
Todd C. Miller
c131b27474
For 'make check-verbose' run fuzzers with -verbose=1
...
This is the default for libFuzzer but not for the stub fuzzer lib.
2022-03-03 10:45:56 -07:00
Todd C. Miller
cdee5d48da
Add check-verbose Makefile target that runs tests in verbose mode.
2022-03-02 13:32:08 -07:00
Todd C. Miller
43cc80d795
Add -v option parsing to regress tests, currently a no-op.
...
This will be used by a "check-verbose" target in the future.
2022-03-02 11:09:51 -07:00
Todd C. Miller
75a0e51590
Add sudo_closefrom() regression test.
2022-03-01 11:31:19 -07:00
Todd C. Miller
f1a697a8ff
Use close_range(2) in closefrom() emulation if available.
...
On Linux, prefer our own closefrom() emulation since the glibc
version may fail if /proc is not present and close_range() is not
supported. On FreeBSD, closefrom(3) will either call the closefrom
or close_range system call, depending on which is available.
2022-03-01 09:54:23 -07:00
Todd C. Miller
c2bd52edf8
Allow test harness to be run from any directory.
...
Also add missing copyright notice.
2022-02-28 19:39:33 -07:00
Todd C. Miller
a4f847b1d6
Adapt test harness for lib/util and move to regress directory.
2022-02-28 19:23:41 -07:00
Todd C. Miller
a57e979962
Adapt test harness for lib/util and move to regress directory.
2022-02-28 14:15:43 -07:00
Todd C. Miller
41bc52302b
Do not disable fuzzer output if SUDO_FUZZ_VERBOSE env variable is set.
2022-02-22 12:04:10 -07:00
Todd C. Miller
33f54c853b
Limit regular expressions to 1024 characters each.
...
Avoids a problem with the fuzzer creating large regular expressions
that blow up the glibc regcomp().
2022-02-12 09:33:02 -07:00
Todd C. Miller
7c17f84a35
Add helper function to compile a regex that supports (?i).
2022-02-11 12:01:31 -07:00
Todd C. Miller
1afce22f7f
Use PATH_MAX, not NAME_MAX+1 for the directory entry length.
...
On some systems, such as Solaris, the max length of a directory
entry is filesystem-dependent. We could use fpathconf() and
dynamically allocate the name but it is simpler to just use
PATH_MAX here.
2022-01-12 15:30:39 -07:00
Todd C. Miller
1f098a2029
Use POSIX NAME_MAX, not the obsolete MAXNAMLEN define.
...
Fixes compilation with musl libc.
2022-01-12 10:25:44 -07:00
Todd C. Miller
c53192eb7e
sudo_mkdir_parents: make sure the path we created is a directory
...
For extra paranoia, verify that the directory we created is still
a directory before we fchown() it.
2021-12-11 16:27:33 -07:00
Todd C. Miller
c13b21c199
Avoid TOCTOU in sudo_mkdir_parents() using openat(2) and mkdirat(2).
...
This also allows us to make path const as it should be.
2021-12-11 08:35:18 -07:00
Todd C. Miller
aae130eb73
Add build dir to include search path for mksiglist.h and mksigname.h
...
Fixes out of tree builds on systems without sys_siglist[] or
sys_signame[]. GitHub issue #123 .
2021-12-02 07:19:43 -07:00
Todd C. Miller
dc5ac7424b
Pass correct size to free_zero().
...
Coverity CID 241233
2021-11-20 09:14:04 -07:00
Todd C. Miller
70c0d35faa
Add missing dependencies for timegm.
2021-11-18 13:28:19 -07:00
Todd C. Miller
5faf46de6f
Use $(SED), not sed, when generating mksiglist.h/mksigname.h
2021-11-10 13:35:44 -07:00
Todd C. Miller
09b82a22ca
Add configure check for sha1sum and use "openssh dgst -sha1" if missing.
...
Only needed when building the seed corpus zip files.
2021-11-10 13:31:42 -07:00
Todd C. Miller
4eebd53bce
parse_gentime: use timegm() to generate time since the epoch
...
The timegm() function is non-standard but widely available.
Provide an implementation for those systems that lack it.
Bug #1006
2021-10-31 09:27:34 -06:00
Todd C. Miller
b506497fe4
Fix pasto in gmtime_r and localtime_r macros.
...
Also add missing Makefile targets for them.
2021-10-31 09:01:18 -06:00
Todd C. Miller
cc6157d7d4
Add support for WolfSSL's OpenSSL compatibility layer.
...
Based on changes from Hayden Roche
2021-10-25 13:17:57 -06:00
Todd C. Miller
465bfbba72
regenerate dependencies
2021-10-25 12:32:02 -06:00
Todd C. Miller
ef3eb25a1b
arc4random: need to include sys/random.h on Solaris too.
...
This was removed when Linux genentropy() was disabled.
2021-10-22 10:44:34 -06:00
Todd C. Miller
88c577171e
Make sure INET_ADDRSTRLEN and INET6_ADDRSTRLEN are defined.
2021-10-21 19:53:48 -06:00
Larkin Nickle
07bdfeedb8
Define MAP_FAILED where relevant if undefined
...
On systems such as HP-UX 10.20, MAP_FAILED is not
defined.
2021-10-21 19:16:28 -04:00
Todd C. Miller
9fbbca7b7a
Always link libsudo_util.so with libcrypto.so if using OpenSSL.
...
We may need to use RAND_bytes() in the getentropy() emulation.
2021-10-20 18:59:13 -06:00
Todd C. Miller
23eef895f4
Add an explicit check for sys/sysctl.h.
...
This test needs to be done after AC_LANG_WERROR to avoid including
sys/sysctl.h on systems where it is marked as deprecated via a
#warning directive.
2021-10-20 10:31:35 -06:00
Todd C. Miller
00e53b32e5
Use our own getentropy() by default on Linux.
...
The glibc getentropy() emulation will fail on older kernels that
don't support getrandom().
Also use sudo_fatal() instead of sending SIGKILL on getentropy() failure.
GitHub issue #117 .
2021-10-20 09:53:01 -06:00
Todd C. Miller
de4fd4a31d
Use the OpenSSL RAND_bytes() function if getrandom() fails.
2021-10-20 09:51:17 -06:00
Todd C. Miller
badd6267bd
Fix compilation of standalone arc4random_buf().
...
Apparently this code was never compiled anywhere.
2021-10-20 08:52:04 -06:00
Todd C. Miller
9dd6304940
sudo_uuid_create: no longer need a union for the uuid.
2021-10-20 07:55:35 -06:00
Todd C. Miller
de5ca187b8
regenerate dependencies
2021-10-10 14:23:13 -06:00
Todd C. Miller
eefb7b0d54
Use a consistent version of fuzz_conversation() with all fuzzers.
...
Also undo a change to fuzz_sudoers.c that snuck in to the last commit.
2021-09-28 20:20:28 -06:00
Todd C. Miller
7d964875df
Fuzzers should not produce output.
...
Excessive output makes the fuzzer runs much less efficient.
2021-09-28 18:53:49 -06:00
Todd C. Miller
476f00b82f
Emulate closefrom() on macOS using proc_pidinfo().
...
This avoids relying on /dev/fd which may not exist in a chroot jail.
Adapted from a change in OpenSSH by likan_999.student AT sina.com
2021-09-27 13:44:41 -06:00
Todd C. Miller
a7367ce47d
Move cppcheck suppression annotation to where it needs to be.
2021-09-22 15:51:45 -06:00
Todd C. Miller
99655f28de
format string fix: print signal number as unsigned.
...
Quiets a cppcheck warning; mksiglist.c already has this fixed.
2021-09-22 11:23:41 -06:00
Todd C. Miller
55171df5e5
Check strftime(3) return value in all cases.
...
Old versions of strftime(3) didn't guarantee to NUL-terminate the buffer
so we explicitly clear the last byte of the buffer and check it.
2021-09-17 14:01:28 -06:00
Todd C. Miller
18f1884ddc
Use gmtime_r() and localtime_r() instead of gmtime() and localtime().
2021-09-17 10:55:06 -06:00
Todd C. Miller
fa71679b5a
Add gmtime_r and localtime_r tests and compat if missing.
2021-09-17 10:55:06 -06:00
Todd C. Miller
46d71c4360
Store milliseconds in the debug file timestamp.
...
Sometime second granularity is not enough.
2021-09-17 10:55:06 -06:00
Todd C. Miller
921bc1c697
Use the EVP digest routines instead of calling SHA2 functions directly.
...
Avoids compiler warnings with OpenSSL 3.0. EVP_MD_CTX_new() is
only available for OpenSSL 1.1 and higher--we will fall back to
sudo's SHA2 code if necessary.
2021-09-17 10:55:06 -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
4bff82cab4
Fix random uuid generation, no need to convert between byte order.
...
Also add regression test.
2021-08-31 19:53:28 -06:00