THE-Spellchecker
5eba4b48cf
Typographical and Grammatical fixes
2023-11-28 15:00:04 -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
Todd C. Miller
75209e2718
Rename check.h -> timestamp.h and add remaining timestamp.c prototypes.
2023-08-29 11:16:23 -06:00
Todd C. Miller
593998cb62
Quiet a PVS-Studio false positive about possible NULL dereference.
...
set_perms() is only called with a NULL ctx for PERM_ROOT, PERM_SUDOERS
and PERM_TIMESTAMP.
2023-08-22 09:58:05 -06:00
Todd C. Miller
821799d1f4
set_perms: ctx may be NULL for PERM_ROOT, PERM_SUDOERS, PERM_TIMESTAMP.
2023-08-21 16:53:35 -06:00
Todd C. Miller
49cd7463c5
Quiet a PVS-Studio false positive about possible NULL dereference.
...
set_perms() is only called with a NULL ctx for PERM_ROOT, PERM_SUDOERS
and PERM_TIMESTAMP.
2023-08-21 13:19:10 -06:00
Todd C. Miller
2440174954
Make struct sudoers_context private to sudoers.c.
...
We now pass a pointer to the context where necessary. There are a
few cases where we need to request the context from sudoers via
sudoers_get_context() for the plugin API functions. If the plugin
API was able to pass around a closure pointer this would not be
necessary.
2023-08-21 09:21:49 -06:00
Todd C. Miller
2d2529a15e
Add a sudoers_context struct that embeds the user and runas structs.
2023-08-20 16:27:08 -06:00
Todd C. Miller
a321e6cedf
Add struct sudoers_runas_context and move runas-specific bits into it.
2023-08-12 14:20:30 -06:00
Todd C. Miller
d8b28dad97
Expand the user_* (and more) macros to user_ctx.foo.
2023-08-12 10:39:59 -06:00
Todd C. Miller
a38b714667
sudoers plugin: silence most -Wconversion warnings.
2023-07-07 15:07:04 -06:00
Todd C. Miller
9d7c30c5a8
Add struct sudoers_parser_config and pass it to init_parser().
...
This struct contains parser configuration such as the sudoers file
uid/gid/mode and parse flags such as verbose, strict and recovery.
2023-05-08 17:03:31 -06:00
Todd C. Miller
72489d7a83
Make timestamp_uid and timestamp_gid private to timestamp.c.
...
Add getter (for set_perms.c) and setter (for sudoers.c).
2023-05-04 13:08:23 -06:00
Todd C. Miller
5e3ce532fe
Allow set_perms(PERM_INITIAL) to be called more than once.
...
If the perm stack depth is non-zero when set_perms(PERM_INITIAL)
is called, rewind it first and re-initialize the stack depth to 0.
Fixes a user-after-free bug if set_perms(PERM_INITIAL) is called
multiple times.
2021-08-09 15:50:25 -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
961a4afe67
Fix some warnings from pvs-studio
2020-08-12 13:45:09 -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
af4eb80dfb
Fix typo
2020-04-17 15:37:41 -06: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
059b55ce72
Refactor code in sudoers that creates I/O log files to share with logsrvd.
2019-10-24 20:04:31 -06:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
985600e7f0
Minor snprintf() usage tweaks:
...
1) don't assume snprintf() returns -1 on error, check for <0
2) when comparing return value of sizeof(foo), cast the sizeof, not the len
3) cast return value to void in cases where snprintf cannot fail
2019-01-20 07:49:48 -07:00
Todd C. Miller
391ed95f50
Allow the group set by "sudo -g" to be any of the target user's groups.
...
Previously, this was only allowed if the group matched the target
user's primary group ID (from the passwd database entry).
The sudoers policy will now allow the group if it is one of the
target user's supplemental groups as well.
2018-10-27 06:37:34 -06:00
Todd C. Miller
6c3d20cb41
Convert PVS-Studio comment to ANSI C.
2018-10-26 08:39:09 -06:00
Todd C. Miller
64e5d34c57
Add comments in .c files so PVS-Studio will check them.
2018-10-21 08:46:05 -06:00
Todd C. Miller
48fba3c2cc
update my email to Todd.Miller@sudo.ws
2017-12-03 17:53:40 -07:00
Todd C. Miller
250209d7a8
When running a command as the invoking user we cannot use the gid
...
list from the front-end since it may not correspond to the user's
aux group vector as defined by the group database.
2017-11-28 09:48:43 -07:00
Todd C. Miller
a842913aa7
Use debug logging instead of ignore_result() where possible.
2017-05-12 10:02:18 -06:00
Todd C. Miller
8d57491dc1
Add PERM_IOLOG so we can create I/O log files on an NFS-mounted
...
filesystem where root is remapped to an unprivileged user.
2017-03-21 13:41:14 -06:00
Todd C. Miller
63adb21cea
Add some missing casts from uid_t/gid_t to int when printing uid/gid
...
values. We print these as signed so a value of -1 (no change) is
obvious. Quiets PVS-Studio warnings.
2016-10-26 11:08:33 -06:00
Todd C. Miller
985ab1dd3e
Cache the user's group IDs and group names separately and only
...
resolve group IDs -> names when needed. If the sudoers file doesn't
contain groups we will no longer try to resolve all the user's group
IDs to names, which can be expensive on some systems.
2016-08-13 16:27:44 -06:00
Todd C. Miller
6cbba7d665
Add an administrative domain to the passwd/group cache key for
...
AIX which can have different name <-> ID mappings depending
on whether the database is local, LDAP, etc.
2016-02-01 11:08:58 -07:00
Todd C. Miller
0b241088b3
There's no need to conditionalize the #include <unistd.h>, we require
...
a POSIX system.
2015-07-02 09:08:28 -06:00
Todd C. Miller
4a07b472f0
Only include stddef.h where it is needed.
2015-06-20 05:34:35 -06:00
Todd C. Miller
dc883f2454
We require ANSI C so stop using the obsolete STDC_HEADERS.
2015-06-19 14:29:27 -06:00
Todd C. Miller
b727d4309c
Handle sudo_get_grlist() returning NULL which can happen if
...
getgrouplist() fails even after allocating the appropriate amount
of memory. From Stephane Chazelas
2015-02-05 11:17:24 -07:00
Todd C. Miller
59ab26dbcc
Go back to a 2 args debug_decl and just use the "default" instance,
...
now renamed "active".
2015-02-01 08:24:49 -07:00
Todd C. Miller
e9914a91b1
The sudoers plugin now defines its own list of debugging subsystem names
...
and defines.
2014-10-22 13:30:52 -06:00
Todd C. Miller
866cfc4fc3
Add support for multiple Debug lines per program. Callers may
...
register arbitrary debug facilities or use built-in defaults. We
now use separate Debug statements for plugins and programs.
2014-10-22 13:23:05 -06:00
Todd C. Miller
aecef4aa1d
Rename warning/fatal -> sudo_warn/sudo_fatal to avoid namespace
...
pollution in libsudo_util.so.
2014-06-27 09:30:52 -06:00
Todd C. Miller
a78da37487
Make set_perms() and restore_perms() return an error instead of
...
calling exit() on failure.
2014-04-10 16:11:47 -06:00
Todd C. Miller
b1cdb3708c
Remove a few more unnecessary uses of fatal().
2014-04-07 19:52:28 -06:00
Todd C. Miller
a5aeaf20da
Fix some sign comparision warnings.
2014-03-25 16:16:11 -06:00
Todd C. Miller
d75e5f6fef
Fix typo in setreuid() PERM_ROOT error message.
2014-02-27 16:40:28 -07:00
Todd C. Miller
96eb2c4f8f
Add warning_gettext() wrapper function that changes to the user locale,
...
then calls gettext().
Add U_ macro that calls warning_gettext() instead of gettext().
Rename warning2()/error2() back to warning_nodebug()/error_nodebug().
2013-11-18 08:59:57 -07:00
Todd C. Miller
0817429583
More sign compare fixes. On Solaris id_t is signed so use uid_t
...
in the set_perms.c ID macro instead.
2013-10-23 15:19:41 -06:00
Todd C. Miller
07a804caf3
Quiet sign comparision warnings.
2013-10-23 15:03:31 -06:00
Todd C. Miller
23a2bdbcba
In rewind_perms() there is nothing to do if perm_stack_depth == 0.
2013-08-07 09:42:14 -06:00
Todd C. Miller
f6e8fb8b1c
Quiet a few -Wunused-result compiler warnings.
2013-05-01 11:02:09 -04:00