Todd C. Miller
1a68935ae3
add_timestamp: check sudo_json_* return values.
2023-11-09 17:12:55 -07: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
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
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
797cc917a8
Add basic regress for JSON functions.
...
Fix a bug in escaped control character handling.
Roll back changes to buffer if sudo_json_add_value() fails.
2022-12-15 19:49:11 -07:00
Todd C. Miller
57b5ff8e8c
Avoid a -Wshadow warning on Solaris 9.
2022-10-07 11:00:17 -06:00
Todd C. Miller
13672f28df
Make sudo pass -Wwrite-strings
2022-06-28 16:33:15 -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
70aef0eb2d
sudo_debug_register: add minfd argument to specify lowest fd number
...
Use this in sudo_intercept.so to avoid allocating a low-numbered
fd which the shell reserves for use by scripts.
2021-08-26 09:57:24 -06:00
Todd C. Miller
b7e81c46b1
Make sure we store an octal number (like umask) as a string.
...
JSON doesn't (portably) support octal numbers with a leading zero.
2021-06-16 16:19:12 -06:00
Todd C. Miller
8f7cae69cc
Check arrays that are passed in for NULL before using them.
2021-06-09 16:07:49 -06:00
Todd C. Miller
4e11bc0e26
Suppress PVS Studio false positives.
2021-01-06 14:27:09 -07:00
Todd C. Miller
961a4afe67
Fix some warnings from pvs-studio
2020-08-12 13:45:09 -06:00
Todd C. Miller
985af422d2
Rename __dso_public -> sudo_dso_public and move to config.h.
2020-08-12 09:57:42 -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
f0dc48548c
Add support for "accept" audit events sent by the sudo front-end.
...
With this change, the sudo front-end will send an "accept" audit
event to the audit plugins after all the I/O logging plugins have
been initialized. This can be used by an audit plugin that does
not care about the result of the individual policy and approval
plugins and only wants to receive a single "accept" event if all
policy and approval plugins have succeeded. The plugin_type argument
for events sent by the front-end is SUDO_FRONT_END (0).
2020-06-02 09:07:44 -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
Todd C. Miller
0cf2e09e0c
Apply spelling fixes.
...
Fixes from PR #30 (ka7) and Bug #925 (fossies.org codespell)
2020-05-06 09:27:43 -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
8ef5b734c4
Rework the JSON API to write to a memory buffer, not a stdio stream.
2020-02-17 16:10:55 -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
0e4c3c47d1
Move duplicated code to parse plugin debug flags to libsudo_util.
...
There's no need for four copies of sudo_debug_parse_flags().
2020-02-11 15:15:36 -07:00
Todd C. Miller
55b61b989f
Use unique function names to avoid confusion with front-end functions.
...
Also add a missing sudo_debug_enter() after debug registration.
2020-02-10 14:37:43 -07:00
Todd C. Miller
a75992897c
Check fseeko() return value; coverity CID 207993
2020-02-07 13:24:11 -07:00
Todd C. Miller
ce21233fbe
Tech audit_json about approval plugin accept/reject
2020-02-06 12:49:13 -07:00
Todd C. Miller
1b7dc82fee
Change audit close arguments to a type and value.
...
That way we can distinguish between different error types.
2020-01-30 17:05:27 -07:00
Todd C. Miller
bf85ea2bf7
Example audit plugin that writes JSON output to a log file.
2020-01-30 13:25:52 -07:00