Commit Graph

3272 Commits

Author SHA1 Message Date
Todd C. Miller
0e2e4b6882 Update Project-Id-Version to 1.9.10. 2022-02-11 18:34:04 -07:00
Todd C. Miller
541c165e65 Update .pot files for 1.9.10 2022-02-11 14:15:31 -07:00
Todd C. Miller
7c17f84a35 Add helper function to compile a regex that supports (?i). 2022-02-11 12:01:31 -07:00
Todd C. Miller
86d2173937 Add support for matching command and args using regular expressions.
Either the command, its arguments or both may be (separate)
regular expressions.
2022-02-10 18:26:24 -07:00
Todd C. Miller
c8bf591042 Clear sudoers_errstr after it is used.
This way we avoid printing the same error message more than once
if there are multiple ERROR tokens returned from the lexer.
2022-02-10 16:09:44 -07:00
Todd C. Miller
4e3a48f2d1 testsudoers: disable argument permutation in GNU getopt
This makes it easier to test commands with arguments.
2022-02-10 10:36:03 -07:00
Todd C. Miller
c5027c796c Free potential leaks of passprompt_regex_handle.
Coverity CID 249057
2022-02-10 09:08:31 -07:00
Jaroslav Jindrak
1f3815c4fb Do not unset user timeout when no default timeout is set. 2022-02-09 17:37:26 +01:00
Todd C. Miller
10ad934b77 Don't escape double quotes (") in a command when printing it.
Previously, cvtsudoers and "sudo -l" would escape double quotes in
a command or command line argument, which is not valid sudoers syntax.
2022-02-08 15:44:18 -07:00
Todd C. Miller
c5133d84eb Upgrade http links to https where possible and fix some broken links. 2022-02-04 08:31:03 -07:00
Todd C. Miller
6aa320c96a Remove "This incident will be reported." from user warnings.
This used to indicate that email had been sent to the administrator
telling them that someone tried to run sudo.  Whether or not sudo
sends email is now configurable, so the warning may not be accurate.
It is also confusing to the user since they will not know who the
incident is being reported to.  See also https://xkcd.com/838/
2022-02-03 19:47:44 -07:00
Todd C. Miller
4d0aeea688 Log fn_get_values() return code in the debug log on error.
Also move a nested switch() statement out of 'case 0' for
improved readability.
2022-02-03 12:31:56 -07:00
Todd C. Miller
de0f4398e2 Do not return an error if we cannot connect to the SSSD connector.
This may simply mean that nsswitch.conf lists sss as a sudoers
source but SSSD is not configured for sudo.  Otherwise, the user
will receive a useless "problem with defaults entries" when the
sssd backend tries to fetch the global defaults.  Bug #1022.
2022-02-03 11:31:05 -07:00
Todd C. Miller
c236d58b5a Set client_closure to NULL after freeing it. 2022-02-03 10:55:45 -07:00
Todd C. Miller
3f1bb7bc97 client_closure_alloc: init write_bufs/free_bufs before other allocations.
We must initialize the tail queues before any possible call to
client_closure_free(), such as due to malloc() failure.
2022-02-03 10:40:03 -07:00
Todd C. Miller
85fef8b50f Add sudoers option to perform authentication even in non-interative mode.
If noninteractive_auth is set, authentication methods that do not
require input from the user's terminal may proceed.  It is off by
default, which restores the pre-1.9.9 behavior of "sudo -n".
2022-02-01 20:08:26 -07:00
Todd C. Miller
46ca288216 converse: don't set response pointer on error
Linux pam_conv(3) says not to set the pointer on PAM_CONV_ERR.
2022-02-01 10:57:40 -07:00
Todd C. Miller
3c84aef902 Add missing sudoers4 test file for new cvtsudoers test. 2022-01-31 19:28:06 -07:00
Todd C. Miller
960bf99656 defaults_check_conflict: it is only really a conflict if the binding match
If the Defaults name matched but the binding does not, we can simply
leave it be.  Fixes a problem where given two sudoers sources that
have a host specified, if they contain conflicting Defaults entries
we would drop one of the Defaults instead of keeping both after
making them host-specific.
2022-01-31 19:18:04 -07:00
Todd C. Miller
8f4351a897 Make it possible to merge a host-based Defaults with a global one.
We convert the global Defaults to a host-based one with a single
"ALL" member.  Later, when we simplify the host list, we'll convert
this back to a global Defaults.
2022-01-31 19:18:03 -07:00
Todd C. Miller
9303aec0de Sync fuzzing dictionary with current configuration keyword list. 2022-01-29 10:30:37 -07:00
Todd C. Miller
5ea0bf4ee2 Escape/unescape commas when serializing/deserializing a stringlist. 2022-01-28 08:52:42 -07:00
Todd C. Miller
c58a080dd5 Add a flag to avoid splitting list entries on white space. 2022-01-28 08:52:41 -07:00
Todd C. Miller
0efe280037 Add a new sudoers settings log_passwords and passprompt_regex.
When logging terminal input, if log_passwords is disabled and any
of the regular expressions in the passprompt_regex list are found
in the terminal output, terminal input will be replaced with '*'
characters until a newline or carriage return is found in the input
or an output character is received.
2022-01-28 08:52:41 -07:00
Todd C. Miller
86f123cd9d Pass the operator to the Defaults callback too.
That way we can tell what to do in callbacks for lists.
2022-01-28 08:52:41 -07:00
Todd C. Miller
368e5d49eb Quiet a cppcheck false positive. 2022-01-19 12:57:07 -07:00
Todd C. Miller
08abeb94a5 Fix logic inversion when setting negated flag. 2022-01-19 09:36:58 -07:00
Todd C. Miller
c8b9f4ad1d Regen .pot files. 2022-01-18 16:51:13 -07:00
Todd C. Miller
e1c2288fbc Don't set/run early Defaults if a custom defaults_list is specified.
Defaults settings passed in by the front end are already "early"
so there is no need to treat any of them as special.

Otherwise, we end up running the early defaults callbacks before
sudoers has been parsed.  This means that, for instance, it is not
possible to disable the fqdn flag before its callback is run if
sudo is build with the --with-fqdn option.  Bug #1016.
2022-01-18 15:38:57 -07:00
Todd C. Miller
28cfe868ec Mark is_early_default(), run_early_defaults(), set_early_default() static.
They are not used outside of defaults.c.
2022-01-18 13:40:59 -07:00
Todd C. Miller
9bb3df748e Add support in SSSD for negated users. 2022-01-18 11:31:36 -07:00
Todd C. Miller
e88087721b Add support in the LDAP filter for negated users.
Based on a diff from Simon Lees
2022-01-18 11:20:22 -07:00
Todd C. Miller
853e710f4a Only emulate Py_FinalizeEx for Python 3.[0-5]. 2022-01-12 13:07:21 -07:00
Todd C. Miller
5fdaa48228 The pre-install target requires visudo, add an explicit dependency. 2022-01-11 11:01:09 -07:00
Todd C. Miller
48bc498a6f Add pam_askpass_service sudoers setting for "sudo -A".
This makes it possible to use a different PAM configuration for
when "sudo -A" is used.  The main use case is to only use PAM modules
that can interact with the askpass program.  GitHub issue #112.
2022-01-08 11:35:03 -07:00
Todd C. Miller
3b7d32b251 sss_sudo_free_values() checks for NULL, no need to do it manually. 2022-01-06 11:18:45 -07:00
Todd C. Miller
8aec6c2a8d Quiet a clang analyzer false positive. 2022-01-06 10:53:01 -07:00
Todd C. Miller
de7171ab6c Quiet a clang analyzer false positive. 2022-01-05 17:34:18 -07:00
Todd C. Miller
a2d27bc9ec Fix return value for non-interactive mode for non-standalone auth methods.
AUTH_NONINTERACTIVE was being stored in the wrong variable.
2022-01-05 16:41:19 -07:00
Todd C. Miller
513574ce10 Updated translations from translationproject.org 2022-01-05 11:13:01 -07:00
Todd C. Miller
d6ff97d837 defaults_var_matches() should return bool, not enum match_result.
Remove enum match_result as it is no longer used.
2022-01-05 11:12:07 -07:00
Todd C. Miller
72989bf83f Quiet two PVS-studio warnings. 2022-01-05 11:04:18 -07:00
Todd C. Miller
1b72f138e3 Remove PAM_TTY workaround for old, buggy PAM modules.
In the past, some PAM modules assumed that PAM_TTY was set and would
misbehave (or crash) if not.  This was primarily obsolete versions
of Linux-PAM, so it should now be safe to remove this.  Setting
PAM_TTY to an empty string can cause its own set of issues.
GitHub issue #74
2022-01-05 10:59:27 -07:00
Todd C. Miller
521ef37aea Push non-interactive mode checking down into the auth methods.
For "sudo -n" we only want to reject a command if user input is
actually required.  In the case of PAM at least, we may not need
to interact with the user.  Bug #956, GitHub issue #83
2022-01-04 18:57:36 -07:00
Todd C. Miller
296d876b76 userspec_overridden: fix checks when there is more than one userspec 2022-01-03 16:40:32 -07:00
Todd C. Miller
835079fa3f Fix merging of global/ALL entries when each input file has a host.
If a host is specified for the input file, cvtsudoers will bind
global Defaults to that host and change host "ALL" in a userspec
to the host name.  However, if all the input files have matching
hosts we can simplify the merged file by converting back to ALL
after resolving conflicts.
2022-01-03 13:23:22 -07:00
Todd C. Miller
e22cc72530 Back out changes to enable SELinux by default.
This may return in a future release in a different form.
2021-12-22 11:13:22 -07:00
Todd C. Miller
149e8208b5 cvtsudoers: fix a regression when merging matching Defaults.
If a host is specified with a sudoers file, we have to treat Defaults
as Defaults@host checking for duplicates.
2021-12-20 12:57:02 -07:00
Todd C. Miller
4ffc3142c5 add_defaults: add defs == NULL check to quiet coverity false positive 2021-12-18 07:54:26 -07:00
Todd C. Miller
dfc11d7483 When merging Defaults, allow a subsequent global Defaults (no
binding) to override a prior Defaults setting with a binding.
2021-12-17 18:59:29 -07:00