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
271ead2fd3
Don't pass an invalid session or process group ID to the plugin.
...
Fixes a regression in 1.8.28 when there is no terminal session leader.
2019-10-23 12:47:44 -06:00
Todd C. Miller
c3ce3a84fb
Refer to user-ID and group-ID instead of "user ID" and "group ID"
2019-10-19 14:26:41 -06:00
Todd C. Miller
40bf4081be
Rename sudo_strtoid() to sudo_strtoidx() and add simplified sudo_strtoid()
2019-10-20 10:21:29 -06:00
Todd C. Miller
b02851dcf3
Change how the umask is handled with PAM and login.conf.
...
If the umask is explicitly set in sudoers, use that value regardless
of what is in PAM or login.conf. If using the default umask from
sudoers, allow PAM or login.conf to override it. Bug #900
2019-10-18 06:20:27 -06:00
Todd C. Miller
2512f6efbf
Use sudo_strtonum() explicitly instead of via a macro.
2019-10-14 10:09:30 -06:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
6dceca47cc
Use SET macro instead of bitwise OR.
2019-02-05 16:47:08 -07: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
63afa569f7
Fix handling of timeout values in sudoers.
...
When passing the timeout back to the front end, ignore the
user-specified timeout if it is not set (initialized to 0).
Otherwise, sudo would choose a zero user-specified timeout over
the sudoers-specified timeout (non-zero).
2018-10-18 08:08:44 -06:00
Todd C. Miller
fe58062547
Cast uid/gid to unsigned int before printing.
2018-08-22 12:58:24 -06:00
Todd C. Miller
1e5af35564
Refactor code to convert defaults to tags and do conversion on
...
output for "sudo -l".
Remove the short_list (was long_list) global in favor of a verbose
argument.
2018-08-05 07:17:34 -06:00
Todd C. Miller
413b53cda3
Assign short_list true, not 1 now that it is a boolean.
2018-08-04 20:02:00 -06:00
Todd C. Miller
608574a219
For ldap/sssd, include defaults in the generate privilege unless
...
we are listing in short mode (in which case we convert them to tags
if possible). Fixes a problem where sudoOptions were not being
applied to the command.
2018-08-02 14:45:00 -06:00
Todd C. Miller
71e98d9493
Include parse.h in sudoers.h since it will soon be required.
2018-05-14 09:05:02 -06:00
Todd C. Miller
29d188f4b4
Garbage collect the command argv, envp and info vectors since they are
...
not available at policy close time.
2018-05-03 10:52:17 -06:00
Todd C. Miller
5106bfc139
Allow the plugin to determine whether or not an empty timeout is
...
allowed. For sudoers, an error will be returned for an empty timeout.
2017-12-11 09:20:41 -07:00
Todd C. Miller
00a00ebd1d
Better input validation of settings passed by the sudo front-end.
...
Instead of ignoring an empty setting, throw an error.
2017-12-10 07:45:49 -07: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
53a8ad7120
Return an error if the sudo front end doesn't set the user name, user ID,
...
group ID or host name. Bug #807
2017-10-20 07:55:48 -06:00
Todd C. Miller
52b25940c6
When examining environment variables or variables passed in from
...
the front-end, ignore variables with no value specified.
2017-07-20 12:02:22 -06:00
Todd C. Miller
c86a6a23ad
Add a command line option to specify the command timeout, as long
...
as sudoers does not specify a shorter time limit.
2017-02-16 09:58:18 -07:00
Todd C. Miller
3980f1531b
Add support for command timeouts in sudoers. After the timeout,
...
the command will be terminated.
2017-02-14 15:56:34 -07:00
Todd C. Miller
6c5936296f
Add SUDO_DEBUG_INSTANCE_ERROR return value for sudo_debug_register()
...
and check for it in places where we check the return value of
sudo_debug_register().
2016-11-21 06:37:23 -10:00
Todd C. Miller
f70f595b5b
Add umask to user_info passed in from the front end to the plugin.
2016-11-17 16:00:06 -07:00
Todd C. Miller
6dff4ac7fd
Always define _PATH_SUDO_NOEXEC, _PATH_SUDO_SESH, _PATH_SUDO_PLUGIN_DIR,
...
even if only defined to NULL. This means the accessors can always be
present.
Use RTLD_PRELOAD_VAR instead of _PATH_SUDO_NOEXEC to tell when
noexec is available.
Add ENABLE_SUDO_PLUGIN_API and use it instead of _PATH_SUDO_PLUGIN_DIR
to tell when the plugin API is available.
Add sudo_conf_clear_paths() to clear the path values so the
regress tests are not affected by compile-time settings.
2016-11-16 10:13:26 -07:00
Todd C. Miller
8133cdfdf6
Use sys/stat.h defines instead of bare octal values.
2016-11-07 13:36:05 -07:00
Todd C. Miller
2b020c9f17
Pass iolog mode, group and user from policy plugin to I/O log plugin.
2016-11-07 10:19:04 -07:00
Todd C. Miller
3f022419ae
Be consistent with the naming of the variable used to store the
...
function return value. Previously, some code used "rval", some
used "ret". This standardizes on "ret" and uses "rc" for temporary
return codes.
2016-09-08 16:38:08 -06:00
Todd C. Miller
ed18d0d5f8
Make the behavior when we cannot write to a log or audit file
...
configurable. File log failures are ignored by default for consistency
with syslog. Audit errors are ignored by default to allow the admin
to fix the issue. I/O log file errors are still fatal by default
since if I/O logging is activated it is usually to have an audit trail.
Bug #751
2016-08-17 07:22:51 -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
db2c732931
sudo_version should be unsigned
2016-05-25 08:44:53 -06:00
Todd C. Miller
61c53c8e66
Fix memory leak of gid_list in sudoers_policy_exec_setup() in the
...
error path. Coverity CID 104111.
2016-05-06 09:17:14 -06:00
Todd C. Miller
20ff6023aa
Fix cut and paste error when checking cols for 0.
...
Coverity CID 104081
2016-05-04 11:15:20 -06:00
Todd C. Miller
c5cafb4331
hook_version and hook_type are unsigned so use 0, not -1 in the
...
final (empty) entry. Quiets a warning on Solaris Studio 12.2.
2016-03-16 10:53:43 -06:00
Todd C. Miller
7ed519125e
Set sudoedit_checkdir=false in command_details when it is disabled
...
in sudoers.
2016-01-20 15:51:43 -07:00
Todd C. Miller
b20977d445
Add support for using fexecve() if supported on commands that are
...
checksummed.
2016-01-04 10:35:18 -07:00
Todd C. Miller
330a209695
Fix compilation with --disable-shared
2015-12-24 08:26:26 -07:00
Todd C. Miller
ad1068c1ee
Actually use the plugin_dir Path setting in sudo.conf.
2015-12-18 14:05:02 -07:00
Todd C. Miller
c50cead833
Add directory writability checks for sudoedit.
2015-10-23 14:04:35 -06:00
Todd C. Miller
edfeee6a7a
No need to have version macros for hooks, callbacks and the sudoers
...
group plugin. We can just use the main sudo API macros. The sudoers
group plugin macros are preserved for source compatibility but are
not documented.
2015-09-09 14:56:52 -06:00
Todd C. Miller
00142c91fa
Lock individual records in the timestamp file instead of the entire
...
file. This will make it possible for multiple sudo processes using
the same tty to serialize their timestamp lookups.
2015-09-07 06:06:08 -06:00
Todd C. Miller
3354d27a17
Do not follow symbolic links in sudoedit by default. This behavior
...
can be controlled by the sudoedit_follow Defaults flag as well as
the FOLLOW/NOFOLLOW tags.
2015-08-06 13:20:01 -06: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
81f94499bf
Check restore_perms() return value in all cases, pushing the
...
return value back up the call stack.
2015-06-25 11:12:36 -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
c36415417f
Add function name to "unable to allocate memory" warnings.
2015-06-19 14:51:17 -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