Commit Graph

11767 Commits

Author SHA1 Message Date
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
c4e67624e3 Add missing default return in last commit. 2022-02-03 10:24:10 -07:00
Todd C. Miller
d18ee79354 sudo_logsrvd: make sure journal exists before writing the alert message.
Fixes a potential NULL dereference when journaling an alert message.
2022-02-03 10:19:40 -07:00
Todd C. Miller
2e957cd43d Fix compilation on Debian kFreeBSD.
The configure script correctly detects that utimensat() and futimens()
are missing but the headers define stub versions of the functions.
Including sys/stat.h pulls in the system definitions  so we can override
them safely.  Bug #1021.
2022-02-03 09:33:30 -07:00
Todd C. Miller
a299406291 Add fallback if /proc/self/stat or /proc/pid/psinfo is missing or invalid.
If the /proc file indicates no terminal is present there is no fallback.
Bug #1020
2022-02-02 08:32:44 -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
6564f1ae4c Work around a glibc regcomp() bug with repeated '+' operators.
Glibc regcomp() has a bug where it uses excessive memory for repeated
'+' ops.  Collapse them to avoid running the fuzzer out of memory.
2022-02-01 13:12:19 -07:00
Todd C. Miller
ac555d454f Rebase seed corpus on updated sudo_logsrvd.conf example. 2022-02-01 13:10:05 -07:00
Todd C. Miller
ad719d06be Fix parsing of "retry_interval" in the relay section.
The setting was present but the callback was missing so it could
not be parsed in the conf file.
2022-02-01 13:08:40 -07:00
Todd C. Miller
2df2276d56 Use TIME_T_MAX as the upper limit when parsing timeouts. 2022-02-01 13:07:27 -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
be4d62e9a4 Check for garbage after [section] in sudo_logsrvd.conf. 2022-01-29 10:50: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
9b93961b3e Add new log_passwords and passprompt_regex settings.
When logging terminal input, if log_passwords is false 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: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
946404434e lib/iolog: add support for filtering password out of tty input
If a password regex is found in the tty output, tty input will be
replaced with '*' chars until a newline or another tty 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
be45d8fef4 "plain text" -> "plaintext" for consistency. 2022-01-27 12:43:19 -07:00
Todd C. Miller
cc5eb2bc4d Updated translations from translationproject.org 2022-01-25 16:02:17 -07:00
Todd C. Miller
f4dd590498 Sync with autoconf git. 2022-01-25 13:06:11 -07:00
Todd C. Miller
ada7d43825 Fix potential infinite loop when trying to format long lines. 2022-01-25 12:10:36 -07:00
Todd C. Miller
5f45fd907b Document how commands are passed to the shell for the -i and -s options.
The concatenation of command and arguments and escaping of special
characters was not documented.
Text adapted from GitHub issue #121 from Kris Rinzwind
2022-01-20 14:05:00 -07:00
Todd C. Miller
805e1b9470 Also mention no_new_privs error in the troubleshooting guide. 2022-01-20 10:26:01 -07:00
Todd C. Miller
e4ee1a8502 Replace uid and gid with user-ID and group-ID in more places. 2022-01-20 10:08:34 -07:00
Todd C. Miller
bdae9843ab PAM is enabled on NetBSD by default too. 2022-01-19 19:04:42 -07:00
Todd C. Miller
9d79a0767c Use the Oxford comma consistently, it is helpful in technical documents. 2022-01-19 19:03:12 -07:00
Todd C. Miller
78e74c605e Document the error message when no_new_privs is set. 2022-01-19 18:53:03 -07:00
Todd C. Miller
17b7ac3460 Sudo now recovers from sudoers syntax errors. 2022-01-19 18:42:09 -07:00
Todd C. Miller
0d0e7de454 Use the Oxford comma consistently, it is helpful in technical documents. 2022-01-19 18:41:23 -07:00
Todd C. Miller
144e578324 Mention docker configuration. 2022-01-19 13:18:38 -07:00
Todd C. Miller
368e5d49eb Quiet a cppcheck false positive. 2022-01-19 12:57:07 -07:00
Todd C. Miller
9a013b79b8 Mention https://www.sudo.ws/security/fuzzing/ in the fuzzing section. 2022-01-19 11:02:19 -07:00
Todd C. Miller
08abeb94a5 Fix logic inversion when setting negated flag. 2022-01-19 09:36:58 -07:00
Todd C. Miller
5e30d01205 Quiet a PVS-Studio format string warning. 2022-01-19 09:20:42 -07:00
Todd C. Miller
c8b9f4ad1d Regen .pot files. 2022-01-18 16:51:13 -07:00
Todd C. Miller
3f8b7f6eae Bug #1016, #1017 and negated sudoUser in LDAP. 2022-01-18 16:49:17 -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
1afce22f7f Use PATH_MAX, not NAME_MAX+1 for the directory entry length.
On some systems, such as Solaris, the max length of a directory
entry is filesystem-dependent.  We could use fpathconf() and
dynamically allocate the name but it is simpler to just use
PATH_MAX here.
2022-01-12 15:30:39 -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
1f098a2029 Use POSIX NAME_MAX, not the obsolete MAXNAMLEN define.
Fixes compilation with musl libc.
2022-01-12 10:25:44 -07:00
Todd C. Miller
757c3a1d37 When applying fallback limits, make sure we don't reduce rlim_max.
Fixes a problem where sudo could reduce the max stack size on some
systems if the original limit was higher than the fallback limit,
but not unlimited/infinity.
2022-01-11 13:30:20 -07:00