Todd C. Miller
b54a16e174
Add support for logging exit status events.
...
For sudo-formatted logs, this is a record with "EXIT=number" and
potentially "SIGNAL=name" after the command. For JSON-format logs,
a new "exit" record is logged which contains an "exit_value" and
potentially "signal" and "core_dumped". JSON-format logs now incude
a UUID to associate the "exit" record with the "accept" record.
2021-07-09 11:08:44 -06:00
Todd C. Miller
90b4f4c4fe
Change ms from size_t to long.
...
Avoids a spurious test failure on Solaris 9
2021-06-21 10:19:10 -06:00
Todd C. Miller
cc3b4ffb04
Remove vsyslog(3) emulation, it is no longer used.
2021-06-14 13:11:39 -06:00
Todd C. Miller
c5247845ac
Add NSS_TRYAGAIN and correct buflen in struct nss_XbyY_buf_t.
...
Add some function argument names. Also use struct nss_db_state *
instead of void * in nss_db_root_t. We don't define struct
nss_db_state but since it is a pointer all we need is a forward
declaration.
2021-06-08 14:25:02 -06:00
Todd C. Miller
b913a832e8
Make sure we link with libsudo_util *after* libfuzzstub.
...
This only affects builds with a static libsudo_util.
Also fix a warning on HP-UX about main not being public.
2021-06-07 15:53:57 -06:00
Todd C. Miller
dfaa9b95f1
Add getgids utility to simular "id -G" using sudo_getgrouplist2()
2021-06-07 14:18:09 -06:00
Todd C. Miller
3104d8ba0b
Make sure we don't read or write past the end of the group buffer.
...
We need to leave room for the terminating NULL in gr_mem.
It is possible for gbm->numgids > gbm->maxgids if we ran out of room.
2021-06-07 13:08:10 -06:00
Todd C. Miller
4b73c98c06
Add some debugging to sudo_getgrouplist2().
2021-06-04 11:28:48 -06:00
Todd C. Miller
96fb72e7cb
Explicitly include netinet/in.h for struct sockaddr_in and sockaddr+_in6.
...
Fixes a compilation problem on FreeBSD.
2021-05-12 07:27:09 -06:00
Todd C. Miller
468e9c7f48
Awful hack to pass on macOS where group_source=dynamic by default.
2021-05-04 13:58:29 -06:00
Todd C. Miller
9077daee93
Avoid clobbering errno in warning().
2021-05-01 11:35:19 -06:00
Todd C. Miller
ac878d3e27
Quiet clang analyzer false positive in regress tests.
2021-04-27 15:56:24 -06:00
Todd C. Miller
2db9e64214
Move reference-counted string code from sudoers to libsudo_util.
...
It will be used by sudo_logsrvd too.
2021-04-06 14:44:19 -06:00
Todd C. Miller
d4517e0a1c
Move autoconf auxiliary files to the scripts directory.
2021-04-06 14:23:38 -06:00
Todd C. Miller
dfff132122
Add a new "fuzz" target that executes the fuzzers for 8192 runs each.
...
To run indefinately, set FUZZ_RUNS=-1, e.g. "make FUZZ_RUNS=-1 fuzz"
2021-03-18 16:48:19 -06:00
Todd C. Miller
6eff3b313b
Move corpus files to a seed subdirectory.
2021-03-18 15:28:29 -06:00
Todd C. Miller
5498c6a938
We can now rely on LLVMFuzzerTestOneInput to flush stdout.
2021-03-18 13:40:26 -06:00
Todd C. Miller
95bfd65fec
Flush stdout before successful return from LLVMFuzzerTestOneInput().
...
Fixes a problem with diag lines from libFuzzer being interspersed
with test output.
2021-03-18 13:08:30 -06:00
Todd C. Miller
4c182c90f1
Rename "fuzz" makefile target to "check-fuzzer".
...
It's purpose is to run the fuzzers are part of a normal "make check"
to avoid bit rot, not to perform a fuzzer run.
The fuzz_logsrvd_conf fuzzer was not wired up to "make check" previously.
2021-03-18 09:08:16 -06:00
Todd C. Miller
d9d450292d
Remove compatibility defines for POSIX sys/stat.h macros.
...
Modern systems have them and we no longer support pre-POSIX systems.
This fixes potential redefinition of the macros if sys/stat.h is
included after sudo_compat.h. Bug #968 .
2021-03-10 12:26:11 -07:00
Todd C. Miller
3f11e8d9a6
Quiet a few Solaris Studio compiler warnings.
2021-03-10 08:57:28 -07:00
Todd C. Miller
0cf7c3a951
Set locale for all "make check" targets.
2021-03-08 12:51:48 -07:00
Todd C. Miller
d452678787
Log peer address in sudo_logsrvd JSON-format logs.
...
The peer that connected to us might not be the same host where the
log entry originated.
2021-03-02 18:37:35 -07:00
Todd C. Miller
5ffa0ce053
Make "group_source=dynamic" the default on macOS.
...
Recent versions of macOS do not reliably return all of a user's
non-local groups via getgroups(2), even when _DARWIN_UNLIMITED_GETGROUPS
is defined. Bug #946 .
2021-03-02 14:09:31 -07:00
Todd C. Miller
9bbf120bd8
For regess/fuzz set LC_ALL to C.UTF-8 if possible, falling back on C.
...
Works around a crash in leak sanitizer when the locale is set to C
and TLS support is enabled.
2021-03-02 13:40:23 -07:00
Todd C. Miller
7f27b04616
In sudo_lbuf_destroy(), reset error, len and size.
2021-03-01 16:05:51 -07:00
Todd C. Miller
79dbf9f17e
Disable debug code for FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
...
It will not be used and just confuses the coverage stats.
2021-02-28 19:52:03 -07:00
Todd C. Miller
851247e58c
Split iolog_fileio.c into multiple files.
2021-02-26 21:07:48 -07:00
Todd C. Miller
d51d4af7a6
Break out I/O log config handling into iolog_conf.c.
2021-02-26 15:02:58 -07:00
Todd C. Miller
7144955b07
regen Makefile.in
2021-02-26 14:30:16 -07:00
Todd C. Miller
bdfc07f330
Add some missing files to the clean target
2021-02-26 14:27:27 -07:00
Todd C. Miller
80e223b6c8
Remove unnecessary warnings, we want to fail silently.
2021-02-25 16:15:47 -07:00
Todd C. Miller
1ae4c1bf67
Remove fuzzer targets in "make clean"
2021-02-24 15:25:44 -07:00
Todd C. Miller
a3f38fac0c
Set program name in fuzzers so we get consisten warnings.
2021-02-24 15:14:58 -07:00
Todd C. Miller
b93aad4e95
Move iolog info log writing to iolog_loginfo.c
2021-02-24 15:01:37 -07:00
Todd C. Miller
a56f7daeea
Split iolog_util.c into iolog_loginfo.c and iolog_timing.c.
...
Also rename check_iolog_util -> check_iolog_timing.
2021-02-24 14:40:33 -07:00
Todd C. Miller
2a657e2a12
Move legacy I/O log info file parsing to iolog_legacy.c
2021-02-24 14:34:14 -07:00
Todd C. Miller
4128582723
Move eventlog config code into eventlog_conf.c
2021-02-24 14:25:39 -07:00
Todd C. Miller
f399c449ad
Move eventlog_free() into its own file.
2021-02-24 13:59:17 -07:00
Todd C. Miller
03e610dab5
Strings in dictionary files need to be quoted.
2021-02-23 12:38:02 -07:00
Todd C. Miller
081e219e23
Add dictionary files for fuzzers where possible.
2021-02-23 11:28:47 -07:00
Todd C. Miller
4adc11e335
Print "running" and "executed" lines to stderr like libfuzzer does.
2021-02-22 15:43:45 -07:00
Todd C. Miller
387169ac67
Add support on AIX for loading plugins that are .a (not .so) files.
...
It is possible to specify the member name in parens after the path,
e.g. sudoers.a(shr.o) for 32-bit or sudoers.a(shr_64.o) for 64-bit.
If no member is specified in the path and dlopen() fails with ENOEXEC,
try again with an explicit member, either shr.o or shr_64.o.
2021-02-19 11:03:26 -07:00
Todd C. Miller
14c71eaa86
Add clean rules to .PHONY target.
2021-02-19 08:54:04 -07:00
Todd C. Miller
9f1e016cde
Add install-fuzz Makefile target to install the fuzzers and seed corpus.
...
The FUZZ_DESTDIR make variable needs to be set in the environment
or on the command line.
2021-02-18 19:38:54 -07:00
Todd C. Miller
a7e2dd15e1
Test the error case by closing the underlying fd.
...
Note that we don't use ferror() here since our getdelim() has no
way to set the error flag if there is a memory allocation error.
2021-02-18 13:15:35 -07:00
Todd C. Miller
db70a70d07
Test the case where getdelim() must reallocate the buffer.
...
Reproduces Bug #960 .
2021-02-18 10:42:04 -07:00
Todd C. Miller
e5c1778e7d
When logging JSON to syslog, wrap the contents in a "sudo" object.
...
This makes it easier for log parsers to identify what is a sudo log entry.
2021-02-18 08:32:13 -07:00
Todd C. Miller
e047e99306
Use %td when printing the difference of two pointers.
2021-02-18 07:22:36 -07:00
Todd C. Miller
75004b7059
Reset end pointer when reallocing the line buffer in getdelim().
...
Fixes excessive memory allocations for long lines. Bug #960 .
2021-02-17 16:46:02 -07:00