Todd C. Miller
71339c574f
Check the return value of fcntl() when setting FD_CLOEXEC.
...
This should never fail unless the fd is invalid.
Problem reported by Matthias Gerstner of SUSE.
2021-01-06 10:16:00 -07:00
Todd C. Miller
6e1986e915
Remove #ifdefs around code using pread(3) and pwrite(3).
2021-01-02 10:43:34 -07:00
Todd C. Miller
fe6e0fb215
If no JSON callback is provided, store the contents of struct eventlog.
...
This moves the JSON formatting of struct eventlog out of libsudo_iolog
and into libsudo_eventlog where it belongs.
2020-10-26 15:43:43 -06:00
Todd C. Miller
db72498257
Use struct eventlog in place of struct iolog_info.
2020-10-26 15:31:41 -06:00
Todd C. Miller
bd254e1042
Read/write runchroot and runcwd entries in the JSON event log.
2020-09-01 06:26:05 -06:00
Todd C. Miller
961a4afe67
Fix some warnings from pvs-studio
2020-08-12 13:45:09 -06:00
Todd C. Miller
076d0376db
We no longer need to include sudo_gettext.h before sudo_compat.h
2020-08-12 09:50:35 -06:00
Todd C. Miller
3175049e45
Fix typo, runas_uid should be runas_gid.
2020-07-06 12:17:58 -06:00
Todd C. Miller
bc6e36e940
Fix a typo that prevented swapids() from restoring the original gid.
...
This led to a regression when the iolog_file setting ends in six or
more X's or when the I/O logs are stored on NFS.
2020-06-16 05:44:57 -06:00
Todd C. Miller
c63ba01e0e
In iolog_openat() enable the write bit on pre-existing files if needed.
...
This prevents problems caused by the change to strip the write bit
from the timing file when it is finished.
2020-05-19 13:14:31 -06:00
Todd C. Miller
0312292e99
Add iolog_clearerr() that acts like clearerr(3).
...
Works for both compressed and uncompressed I/O logs.
2020-05-18 14:16:47 -06:00
Todd C. Miller
446ae3f507
Include string.h unconditionally and only use strings.h for strn?casecmp()
...
In the pre-POSIX days BSD had strings.h, not string.h.
Now strings.h is only used for non-ANSI string functions.
2020-05-18 07:59:24 -06:00
Todd C. Miller
dd88460800
We no longer need to include headers we don't use for sudo*.h files.
...
Previously we needed to include headers required by the various
sudo*h files. Now those files are more self-sufficient and we
should only include headers needed by code in the various .c files.
2020-05-18 06:47:04 -06:00
Robert Manner
8f0370cd8e
lib/iolog/iolog_fileio.c: do not call fchown on invalid fd
...
Fixes the warning in the log:
iolog_write_info_file_json: unable to fchown 0:0 /var/log/...: Bad file descriptor
2020-04-06 07:31:01 -06:00
Todd C. Miller
cffda82e20
Do not use JSON_ARRAY with sudo_json_add_value()
2020-03-29 05:05:08 -06:00
Todd C. Miller
ea9b711a70
Write an extended I/O info log in JSON format.
...
This will be used by sudoreplay if it exists to get more information
about the command being replayed.
2020-03-29 05:05:08 -06:00
Todd C. Miller
5635c22f6b
Add --disable-log-server and --disable-log-client configure options.
...
These can be used to optionally disable building sudo_logsrvd and
support for remote I/O logging in the sudoers plugin respectively.
2020-02-26 13:17:40 -07:00
Todd C. Miller
92e42ff548
Add compatibility define for fseeko(3).
...
This is better than cluttering up the code with #ifdefs for obsolete
systems.
2020-02-15 10:22:15 -07:00
Todd C. Miller
9d5f066180
Check return value of sudo_lock_file(); coverity CID 207991
2020-02-07 12:59:52 -07:00
Todd C. Miller
9e57bea4e3
Fix coverity CID 206586.
...
Potential use after free calling gzstrerror() after gzclose().
2020-01-05 07:48:48 -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
Todd C. Miller
ee91b7360b
Simplify expand_iolog_path()
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
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
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
3394785f6d
Add restart support for compresses I/O logs.
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
059b55ce72
Refactor code in sudoers that creates I/O log files to share with logsrvd.
2019-10-24 20:04:31 -06:00