244 Commits

Author SHA1 Message Date
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
Todd C. Miller
4f9cabd005 Remove obsolete memory.h include. 2015-06-18 21:02:57 -06:00
Todd C. Miller
d004b02fc6 Use non-exiting allocatings in the sudoers plugin. 2015-06-17 06:49:59 -06:00
Todd C. Miller
c5e4c3055a Fix typo, efree vs. free. 2015-05-27 09:48:31 -06:00
Todd C. Miller
4131449ffb Add a few missing sudo_new_key_val() return value checks.
Also use non-exiting allocators for consistency.
2015-05-27 09:42:51 -06:00
Todd C. Miller
caf5d45e0f Previously, debug_return_bool was the same as debug_return_int
except that it logged true/false for 1/0.  However, this appears
to trigger a bug in some compilers.  To avoid this, debug_return_bool
now uses bool, not int.  Callers that were passing it an int have
been converted to use debug_return_int instead.
2015-05-07 10:33:23 -06:00
Todd C. Miller
1e30824a1a The plugin no longer needs to call initprogname() now that it links
with the same libsudo_util as sudo.
2015-02-05 11:08:55 -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
9d6e1a57d5 Add sudoers_debug_deregister() and use it instead of calling
sudo_debug_deregister() directly.
2014-10-27 16:06:20 -06:00
Todd C. Miller
34d9cfe1cf Initialize the debug subsystem in sudoers early. Currently this
means iterating over the settings list twice.
2014-10-24 12:50:12 -06:00
Todd C. Miller
4bf641df69 In the plugin registers with the debug framework at open time, the
sudo front-end will now set the default debug instance appropriately
before calling into the plugin.  This means the plugin no longer needs
to do the sudo_debug_set_default_instance() dance.
2014-10-24 11:17:48 -06:00
Todd C. Miller
935e48c6e4 Don't call into the debug subsystem after we've deregistered the
plugin's instance.
2014-10-23 13:42:50 -06: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
79f4471e41 Move sudo_printf to policy.c to match sudo_conv. 2014-10-06 10:13:42 -06:00
Todd C. Miller
e20475922d There is no longer a reason for the plugin to init the debug subsystem
itself.  It will always be initialized by the front-end if needed.
2014-09-08 16:24:32 -06:00
Todd C. Miller
36a5767e3e efree -> sudo_efree for consistency 2014-07-10 15:35:04 -06:00
Todd C. Miller
a8fa112a53 atobool -> sudo_strtobool
atoid-> sudo_strtoid
atomode -> sudo_strtomode
2014-06-27 14:53:54 -06:00