Todd C. Miller
cf9c0102d4
Only set MODE_PRESERVE_ENV when preserving the entire environment.
...
Fixes a problem introduced in 1.8.23 where "sudo -i" could not be
used in conjunction with --preserve-env=VARIABLE. Bug #835
2018-05-16 09:10:43 -06:00
Todd C. Miller
4b29e0bd70
Restore line to set MODE_PRESERVE_ENV in flags when the -E command
...
line option is used. The caller doesn't check MODE_PRESERVE_ENV
these days but parse_args uses it to detect usage errors when -E
is used along with a mutually excusive option. Problem found by
Yuriy Vostrikov.
2018-02-28 07:05:36 -07: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
bbc43b5e30
Change some _() into U_() since they are used for warn/fatal.
...
We always want to issue warnings in the user's locale.
2017-12-11 08:07:01 -07:00
Todd C. Miller
d322caf7ac
Print usage and return an error when an empty argument is given for
...
all command line arguments other than -p and -E. Bug #817
2017-12-10 07:53:09 -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
c18dde2350
Allow the user to specify a list of environment variables to preserve.
...
This adds an option paramter to the --preserve-env option, a
comma-separated list of variable names.
2017-08-03 07:32:24 -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
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
efe957544f
Add the argument vector allocated for -s and -i mode to the garbage
...
collector list. Avoids an ASAN warning on exit when the -s or -i
flags are used.
2016-11-10 10:11:18 -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
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
cb63ca701c
Avoid using exiting allocators in the front end.
2015-06-17 17:00:54 -06:00
Todd C. Miller
fc7143760b
Fix indentation of -a flag help line.
2015-05-11 13:34:41 -06:00
Todd C. Miller
0008747bef
Bail with usage() early if argc <= 0.
2015-02-06 09:17:39 -07:00
Todd C. Miller
67eba7e534
Don't assume argv[0] is set without first checking argc.
2015-02-05 11:17:25 -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
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
a7e724b75d
Change how sudo.conf is parsed. We now do a quick parse and then
...
set the values after the entire file has been parsed. This lets
us init the debug system earlier. Plugin-specific debug flags are
now stored in struct plugin_info and struct plugin_container and
passed to the plugin via one or more debug_flags settings.
2014-10-22 13:20:32 -06:00
Todd C. Miller
1e0b8903f2
Return settings from parse_args as struct sudo_settings and format
...
for the plugin at plugin open time. This will allow for additional,
plugin-specific settings to be added to the array.
2014-10-22 13:13:00 -06:00
Todd C. Miller
1cc2433428
If we were invoked with any name ending in "edit", treat as sudoedit.
2014-09-08 09:37:39 -06:00
Todd C. Miller
2d61d38c23
Add sudo_ prefix to alloc.c functions and rename alloc.h -> sudo_alloc.h
2014-06-27 10:48:31 -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
7bafa63c15
Don't pollute the namespace with lbuf struct and functions
2014-06-26 15:51:15 -06:00
Todd C. Miller
9ba5d82926
Rename fmt_string -> sudo_new_key_val to better describe its function.
2014-06-26 15:51:15 -06:00
Todd C. Miller
088edcb6f5
Add exported libsudo_util functions to util.exp and mark in headers
...
using __dso_public.
2014-06-26 15:51:15 -06:00
Todd C. Miller
134b2a4228
Rename emalloc2() -> emallocarray() and erealloc3() -> ereallocarray().
2014-04-22 16:02:28 -06:00
Todd C. Miller
cbf41b8b96
The OpenBSD strtonum() uses very short error strings that can't
...
be translated usefully. Convert them to longer strings on error.
Also use the longer strings for atomode() and atoid().
2013-12-11 13:43:10 -07:00
Todd C. Miller
8f9ce7249a
Use strtonum() instead of atoi(), strtol() or strtoul() where possible.
2013-12-10 16:23:21 -07:00
Todd C. Miller
0d81263e26
Instead of setprogname(), add initprogname() which gets the program
...
name for getprogname() using /proc or pstat() if possible.
2013-12-01 19:12:21 -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
6484574f9f
Don't escape '$' when running "sudo -i command". Bug #564
2013-08-19 10:40:05 -06:00
Todd C. Miller
a5b64a1d2e
Use lower card for the long option arguments to match the manual.
...
This is inconsistent with GNU but it is better to match the sudo
documentation.
2013-08-16 09:41:46 -06:00
Todd C. Miller
85fc5792d4
Change some fatalx(NULL) that should be fatal(NULL).
2013-08-15 13:06:49 -06:00
Todd C. Miller
79104ce751
Fix parsing of "-h host" when used in conjunction with the -l flag.
2013-08-14 13:41:47 -06:00
Todd C. Miller
8b1d645534
Simplify usage messages a bit and make --help output more closely
...
resemble GNU usage wrt long options. Sync usage and man page
SYNOPSYS sections and improve long options in the manual pages.
Now that we have long options we don't need to give the mnemonic
for the single-character options in the description.
2013-08-14 10:30:51 -06:00
Todd C. Miller
d9fd6281e4
Allow default plugin dir to be configured in sudo.conf.
2013-08-13 12:24:28 -06:00
Todd C. Miller
6e56e6d8c8
Add support for long options and fix inclusion of sudo_usage.h with
...
modern gcc broken in 8597:1fcb7ba13018.
2013-07-18 16:51:56 -06:00
Todd C. Miller
db05b9ae0d
Make "-h hostname" work. Optional args in GNU getopt() only work
...
when there is no space between the option flag and the argument.
2013-07-18 10:02:43 -06:00
Todd C. Miller
9309c9eab7
Use getopt_long() so we can make the -h flag take an optional argument.
...
Includes a version for those without it.
2013-07-17 17:00:55 -06:00
Todd C. Miller
c2860cce57
Overload -h option to specify an optional hostname for remote access.
...
This is future-proofing; no policy plugins currently support this.
2013-07-16 16:31:05 -06:00
Todd C. Miller
b4e1f7c446
Do not error out if arg to -U option cannot be resolved, that is for
...
the plugin to decide.
There is no need for runas_user and runas_group to be global, make
them local to parse_args() instead.
2013-07-16 14:04:23 -06:00
Todd C. Miller
d6282d154a
Update copyright years.
2013-04-24 09:35:02 -04:00
Todd C. Miller
39acd2fcba
Rename error/errorx -> fatal/fatalx and remove the exit value as
...
it was always 1.
2013-04-18 14:07:59 -04:00
Todd C. Miller
af4d3489f9
Pass the default plugin directory to the plugin via the settings list.
...
Could be used by a stacking plugin.
2013-02-21 15:05:51 -05:00
Todd C. Miller
2d9da65881
#include "sudo_usage.h" not <sudo_usage.h> so we get the one in the
...
build directory and not the src dir when using a separate build
directory.
2013-02-15 08:57:21 -05:00
Todd C. Miller
35548ae4e3
Pass max_groups to plugin in settings list.
2013-02-14 15:18:10 -05:00
Todd C. Miller
1d7072fe09
Don't include <sys/param.h>. We only needed it for MAXPATHLEN,
...
MAXHOSTNAMELEN and the MIN/MAX macros. We now use PATH_MAX and
HOST_NAME_MAX throughout without falling back on MAXPATHLEN or
MAXHOSTNAMELEN and define our own MIN/MAX macros as needed.
2012-12-04 10:40:47 -05:00