Rose
a925829e60
Restrict-qualify a few methods that are listed as such
2025-06-04 11:12:18 -06:00
Todd C. Miller
ce0ec8ddca
Free existing contents of struct eventlog before overwriting.
...
In the unlikely event that there are duplicate keys in info_msgs,
free the old string before overwriting with the new one.
2025-03-31 20:11:34 -06:00
Todd C. Miller
b9275b7eab
Rename submit_time -> event_time in struct eventlog.
2023-11-23 09:08:04 -05:00
Todd C. Miller
3bbc7c8f85
Store submitenv in eventlog and pass it to sudo_logsrvd.
2023-10-22 08:36:44 -06:00
Todd C. Miller
726b646b48
struct eventlog: rename argv/env to runargv/runenv.
...
This matches the JSON logs.
2023-10-21 19:15:46 -06:00
Todd C. Miller
09a4264372
logsrvd: display error string in message if iolog_mkpath() fails
2023-10-19 14:39:13 -06:00
Todd C. Miller
1398289fab
Add casts when storing values in a struct timespec.
...
Fixes -Wconversion warnings on some 32-bit systems where time_t is
still 32-bit.
2023-09-27 15:11:10 -06:00
Todd C. Miller
e343e07543
Use #include <foo.h> instead of #include "foo.h" in most cases.
...
We rely on the include path to find many of these headers. It
especially doesn't make sense to use #include "foo.h" for headers
in the top-level include directory.
2023-09-25 10:13:28 -06:00
Todd C. Miller
0b03511b85
Log source in JSON logs
...
This makes it possible to tell which rule resulted in a match.
2023-08-08 09:56:19 -06:00
Todd C. Miller
2eee45ef96
evlog_new: store a new copy of peeraddr, not a pointer to a buffer.
...
Starting in sudo 1.9.14, eventlog_free() will free the peeraddr
member too so it needs to be dynamically allocated.
2023-07-11 13:51:16 -06:00
Rose
5d758264ab
Give every printf-like function restrict qualifiers
...
The format value has to be a string literal, every time.
Otherwise, you are not using these functions correctly. To reinforce this fact, I putrestrict over every non-contrib example of this I could find.
2023-07-07 20:23:20 -04:00
Todd C. Miller
4891f37a45
sudo_logsrvd: silence most -Wconversion warnings.
2023-07-07 15:07:04 -06:00
Rose
e54ba33ea0
Avoid compiler casting warnings by assigning to the same type where possible
...
This saves instructions that are related to casting as well as compiler warnings.
2023-06-28 17:25:26 -04:00
Todd C. Miller
166e0e13bc
Change max user-ID and group-ID from INT_MAX to UINT_MAX.
2022-09-28 09:06:32 -06:00
Todd C. Miller
e6f2ad0ed6
Add missing NULL checks for mandatory fields in protobuf messages.
...
Also no longer reject an InfoMessage with an unknown value_case,
just log and ignore it.
2022-09-28 08:47:25 -06:00
Todd C. Miller
3e21c8da5c
Add missing PVS Studio Open Source comments.
...
Also avoid checking protobuf-c source and protobuf-c generated files.
2022-06-29 09:45:04 -06:00
Todd C. Miller
e5834bd405
Use #include <config.h> not #include "config.h" for consistency.
...
Otherwise, some compilers may do the wrong thing in a build
dir if there is a config.h file in the source dir too.
2022-06-29 08:47:16 -06:00
Todd C. Miller
c7ed03c986
sudo_logsrvd: update elapsed time for winsize and suspend in journal mode
...
Fixes a bug in store-first relay mode where the commit point messages
sent by the server were incorrect.
2022-04-24 17:26:05 -06:00
Todd C. Miller
2315c0b3bb
iolog_rewrite: initialize struct timing_closure before using.
...
Coverity CID 249971
2022-02-23 20:17:58 -07:00
Todd C. Miller
87c1dd9d7d
Move include of log_server.pb-c.h into logsrvd.h and sendlog.h
...
This way there is no include file order issue with the
PROTOBUF_C_VERSION_NUMBER check.
2021-10-25 12:25:24 -06:00
Todd C. Miller
d415624ffc
Read command run_time, signal and exit_value from I/O log log.json file.
2021-10-19 08:58:33 -06:00
Todd C. Miller
a554629d84
Flush I/O logs before we send a commit point.
...
The commit point message means we have written the data to disk so
we should not be buffering it any longer.
We do not currently fsync(2) the data after flushing, perhaps we should.
2021-10-15 19:10:34 -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
5a3bbba12b
Use sudo_warnx?() instead of sudo_debug_printf for errors.
...
We now hook the warn functions so the messages are logged.
The messages still show up in the debug log too.
2021-06-15 13:58:12 -06:00
Todd C. Miller
c3534712de
Fix I/O log restart of locally-store logs.
...
This got broken a while ago when evlog in struct connection_closure
was changed to a pointer.
2021-05-03 16:54:25 -06:00
Todd C. Miller
84a01d3a93
Move local iolog log functions to logsrvd_local.c
2021-04-27 14:46:27 -06:00
Todd C. Miller
c2d3070fa1
Journal messages to disk when store_first is set in the relay section.
...
Instead of forwarding messages immediately, they are journaled
locally in wire format.
This will be used to implement relay store-and-forward mode.
2021-04-23 16:55:30 -06: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
851247e58c
Split iolog_fileio.c into multiple files.
2021-02-26 21:07:48 -07:00
Todd C. Miller
9779009fae
Add info_msgs to AlertMessage and populate it.
...
This lets us log eventlog info along with the alert if it is available.
2020-11-09 17:15:11 -07: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
8c43340474
Use libeventlog in sudo_logsrvd.
2020-10-26 15:26:02 -06:00
Todd C. Miller
eaa95acb31
Post-process protoc-c files to avoid depending on anonymous unions.
...
Based on a patch from Michael Osipov.
GitHub issue #60
2020-09-04 13:17:51 -06:00
Todd C. Miller
226307591c
Log the runcwd not submitcwd in the sudo-style log file.
...
The log entry should reflect the working directory the command
actually ran in.
2020-09-02 11:23:26 -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
84e6e6ccf9
Update copyright year on some files where it was out of date.
2020-08-31 14:09:36 -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
Robert Manner
ace8e18953
logsrvd/iolog_writer.c: treat runuid, rungid 0 as valid (usually ==root)
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
9b144069fc
Store runenv in the I/O log info file too.
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
5034ea91be
Some new source files got created with my old email address.
2020-03-29 05:05:08 -06:00
Todd C. Miller
5781a6a4cf
Add support for JSON logging in sudo_logsrvd.
2020-02-17 16:10:56 -07:00
Todd C. Miller
fb9d7d8cc6
Store submit time in struct iolog_info.
...
Fixes missing time stamp in remote I/O log info file.
2020-01-16 17:37:36 -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
73031bbb55
Rename cwd -> submitcwd to match man page.
2019-11-05 15:18:07 -07:00
Todd C. Miller
ee91b7360b
Simplify expand_iolog_path()
2019-10-24 20:04:33 -06:00
Todd C. Miller
955fa11b53
Clear the write bit on the timing file for completed logs.
...
This allows us to tell whether or not a log can be restarted.
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
1df3230c2a
Document the sudo log server protocol
2019-10-24 20:04:33 -06:00