Alexandru Ardelean
a12b15b436
lib: util: Makefile.in: use host CFLAGS and CPPFLAGS for mksig{name,list}
...
When cross-build support was added for mkig{name,list} was added, the
CFLAGS and CPPFLAGS should have been updated to the HOSTCFLAGS/HOSTCPPFLAGS
vars.
In a cross-build scenario, some of these flags don't match what the
compiler can understand (because they may be architecture specific) and
may fail the build.
Using the HOSTCFLAGS/HOSTCPPFLAGS works and builds successfully.
Also the output binary works on the target.
This is in continuation of
- https://github.com/sudo-project/sudo/pull/104
- https://github.com/sudo-project/sudo/pull/109
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com >
2021-08-25 15:24:21 +03:00
Todd C. Miller
d333f484ec
Fix mksiglist and mksigname dependencies.
2021-08-19 10:30:02 -06:00
Todd C. Miller
b40f74cb24
Cross-build support for mksigname and mksiglist
...
We must build these with the host C compiler but use the target
preprocessor to generate the output.
2021-08-19 09:50:05 -06:00
Todd C. Miller
ad5feeb40b
regen
2021-08-18 15:48:05 -06:00
Todd C. Miller
5902c0e21c
new_logline: limit offset to two significant digits after the decimal
...
Now instead of TSID=0001L3@5.168230749 we would log TSID=0001L3@5.16 .
2021-08-14 13:22:48 -06:00
Todd C. Miller
babb498c6e
new_logline: handle case where evlog is NULL
2021-08-14 09:24:39 -06:00
Todd C. Miller
0f6a74f180
Cast iolog_offset.tv_sec to long long for %lld printf format.
...
Quiets a compiler warning on systems where tv_sec in struct timeval
is not long long.
2021-08-13 16:19:58 -06:00
Todd C. Miller
4aefd43948
For intercepted commands, log an offset into the current I/O log.
...
This can be used with sudoreplay to jump to when a specific command
was executed within a session log.
2021-08-13 16:00:00 -06:00
Todd C. Miller
695f4bea05
Add support for an optional offset when parsing the ID to replay.
...
The offset is a suffix in the form of @sec[.nanosec]
2021-08-13 16:00:00 -06:00
Todd C. Miller
ef91b90ad6
Sync siglist.in with the generated files.
...
The change to prefer SIGSYS over SIGUNUSED wasn't made to siglist.in.
Also, mksigname.c doesn't need to explicitly set sudo_sys_signame[0].
2021-08-10 19:55:28 -06:00
Todd C. Miller
5d4120fa5d
Add separate convenience lib for protobuf-c
...
We need to use it for sudo <-> sudo_intercept.so communication.
2021-08-09 15:50:25 -06:00
Todd C. Miller
9d776b4e7b
Allow multiple accept/reject messages during a logsrv conversation.
...
The log server now advertises a subcommands flag if it supports
logging subcommands (e.g. commands run from a sudo-spawned program
like a shell). The client should only log additional commands
during a session if this flag is set in the ServerHello message.
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
e4568ceafe
iolog_mkdtemp: umask must not be more restrictive than the file modes.
...
We need this even though we will be calling mkdtemp() since the
umask affects the mode of any parent directories.
2021-07-30 13:55:26 -06:00
Todd C. Miller
d109cd61d9
In new_logline check for NULL args->reason for EVLOG_RAW.
...
This can't happen in practice since we never set EVLOG_RAW
without passing in a reason. Coverity CID 237142 237143
2021-07-27 12:19:53 -06:00
Todd C. Miller
e00ed390d5
format_json: don't dereference evlog if it is NULL.
...
Also silence a PVS Studio false positive.
2021-07-27 10:45:35 -06:00
Todd C. Miller
c234bab7b2
Remove unused info_cb and info arguments from eventlog_exit()
2021-07-15 11:07:25 -06:00
Todd C. Miller
fa7250ead7
Create a UUID and log it in the JSON version of the event log.
2021-07-15 11:07:25 -06:00
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