Commit Graph

12819 Commits

Author SHA1 Message Date
Todd C. Miller
ecdf0c80f3 Add pam_silent sudoers option.
Inspired by PR #368
GitHub issue #216
2024-04-17 19:30:11 -06:00
Todd C. Miller
f0823c70c6 Remove offensive insults that were disabled by default anyway.
Bug #1058
2024-03-18 09:14:15 -06:00
Todd C. Miller
b6175b78ad Remove EVLOG_JSON, callers must use EVLOG_JSON_COMPACT or EVLOG_JSON_PRETTY 2024-03-09 11:42:07 -07:00
Todd C. Miller
46e31a74d7 Add "json_pretty" log format, currently the same as "json".
In a future version, "json" will be an alias for "json_compact"
instead.  GitHub issue #357.
2024-03-09 10:59:54 -07:00
Todd C. Miller
1debad3bec Add json_compact log type for compact/minified JSON.
The "json_compact" log type logs one event per line in compact/minified
JSON format.  GitHub issue #357.
2024-03-08 16:31:39 -07:00
Todd C. Miller
b3ade1c5f9 Fix typo 2024-03-08 13:58:36 -07:00
Todd C. Miller
602a58e86a Set SUDO_HOME to the invoking user's home directory.
GitHub issue #358
2024-03-08 09:15:36 -07:00
Martin
836d2b556b sudo-logsrvd.pp: Remove syslog.target (non-existent upstream since 11~ years ago)
Remove syslog.target from service file, this target hasn't existed for over a decade.

6aa8d43ade/NEWS (L72-L73)
2024-03-02 06:44:23 -07:00
Todd C. Miller
72cee2fa25 Explicitly link check_symbols with zlib.
Fixes a test failure on some systems when using sudo's built-in zlib.
2024-02-29 12:41:36 -07:00
Fabrice Fontaine
f66ebfa0f3 m4/openssl.m4: fix cross-compilation with wolfssl
Do not append -I/usr/include/wolfssl when cross-compiling

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2024-02-22 11:12:22 -07:00
Todd C. Miller
81acb2bd7b Regenerate dependencies 2024-02-21 13:17:54 -07:00
Todd C. Miller
3944ab1fbe Use $(CPP) instead if $(CC) -E when buiding .i files from .c. 2024-02-21 12:31:50 -07:00
Todd C. Miller
2a61e4b07d Add missing subdirs to depend target. 2024-02-21 13:01:15 -07:00
Todd C. Miller
9b073f3124 Using $< in a non-suffix rule context is a GNU make extension. 2024-02-21 13:01:14 -07:00
Yann E. MORIN
6ec958f27e lib/utils: detect failure to generate signals list and names
Currently, we generate the signal list and names by running cpp on our
header, and piping the result into sed.

However, when cpp fails [0], we do not catch that failure, as the error
code of the LHS of a pipe is lost, with the pipe returning the RHS-most
return code.

Fix that by introducing two new intermediate rules, each to generate the
preprocessed .i files, and use those as dependencies and input to the
rule that generates the headers. Those two .i files will be cleaned up
by the existing *.i glob.

[0] a failure happens on recent hosts, due to inconsistency with
time64_t and large-file support (lines elided and wrapped for
readability):

    /usr/bin/cpp [...] ./sys_signame.h \
    | /usr/bin/sed -e '1,/^int sudo_end_of_headers;/d' -e '/^#/d' > mksigname.h
    In file included from /usr/include/features.h:394,
                     from /usr/include/sys/types.h:25,
                     from ./sys_signame.h:4:
    /usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
       26 | #   error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
          |     ^~~~~
    /usr/bin/gcc [...] ./mksigname.c -o mksigname
    In file included from /usr/include/features.h:394,
                     from /usr/include/bits/libc-header-start.h:33,
                     from /usr/include/stdlib.h:26,
                     from ./mksigname.c:27:
    /usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
       26 | #   error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
          |     ^~~~~
    make[2]: *** [Makefile:263: mksigname] Error 1

In that case, we were lucky that the subsequent gcc call also failed,
and for the same reason. That time64_t and lfs issue should be fixed (at
least investigated), but that does not mean we should not be more robust
when parsing the header either.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-02-18 07:17:58 -07:00
Todd C. Miller
f3ebf31aa9 Regen with autoconf 2.72 2024-02-18 07:10:08 -07:00
Todd C. Miller
bafdcc3d40 Check if ac_cv_sys_file_offset_bits is "64", not "yes"
This is used for determining whether to set _TIME_BITS with autoconf
versions before 2.72.
2024-02-18 07:09:10 -07:00
Yann E. MORIN
5bbfaa8e68 src/exec_ptrace: fix build without precess_vm_readv()
Commit 32f4b98f6b (sudo frontend: silence most -Wconversion warnings.)
broke the build on C libraries that miss process_vm_readv(), like
uClibc-ng.

Indeed, the ssize_t nwritten is declared guarded by HAVE_PROCESS_VM_READV,
but is then re-assigned and used a few lines below, outside any guard.

Fix that by always declaring the object, as it is always needed.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-02-17 11:28:46 -07:00
Todd C. Miller
f69031da24 Quest no longer sponsors sudo development. 2024-01-31 10:05:50 -07:00
Todd C. Miller
0a39814e4b Correct a misleading debug message. 2024-01-23 10:57:00 -07:00
Todd C. Miller
eb4506f434 Update embedded copy of zlib to version 1.3.1. 2024-01-23 09:16:22 -07:00
Todd C. Miller
3899f2ef90 Update copyright data in the package files. 2024-01-18 07:00:38 -07:00
Rose
725d3fdc20 Prefer putchar over fputc where possible
putchar is easier to understand than fputc and printf and does less work than those two do.
2024-01-13 15:24:43 -07:00
Rose
7fc7d69532 Add restrict qualifiers to strlcpy_no_slash
It's just strlcpy except it replaces '/' with '_'.
2024-01-13 15:20:10 -07:00
Todd C. Miller
67e328d6f8 Only log "a password is required" for "sudo -n" if a command is specified.
This means that it is not logged for "sudo -nv" and "sudo -nl".
We only log this message when sudo's -n flag is specified (and not
when the user presses ^C at the password prompt) so that there is
a record of failed non-interactive commands.
2024-01-10 13:54:41 -07:00
Todd C. Miller
b39dc7c5f1 Document side-effects of enabling the use_pty option. 2024-01-08 14:28:58 -07:00
Todd C. Miller
ff3dbe60b1 Update "!use_pty" example to only disable it for non-root users.
Also add a commented out entry for "exec_background" which can also
be used to prevent sudo from consuming tty input.
Related to GitHub issue #338
2024-01-08 14:16:29 -07:00
Todd C. Miller
00452471b1 Add check for sysconf(_SC_PAGESIZE) failure. 2024-01-01 11:03:01 -07:00
Todd C. Miller
f52fa574c7 sudo_edit_mktemp: remove useless cast 2024-01-01 11:05:23 -07:00
Todd C. Miller
22b01501eb Welcome to 2024 2023-12-31 07:58:23 -07:00
Todd C. Miller
c15e0aeea8 Bump zlib copyright date for version 1.3 2023-12-31 07:58:04 -07:00
Todd C. Miller
69a024304f Restore the ability to override default configure settings.
The user-specified options must go last...
2023-12-30 11:21:08 -07:00
Todd C. Miller
00b2bd3589 Sudo 1.9.15p5 2023-12-29 14:43:39 -07:00
Todd C. Miller
b5a3513fb9 Handle Debian GNU Hurd 2023-12-28 18:45:30 -07:00
Todd C. Miller
e4057faca2 Properly handle sysconf(_SC_LOGIN_NAME_MAX) returning -1 on failure.
The cast to size_t needs to be outside the MAX() macro or the -1
will get cast to unsigned.
2023-12-28 09:00:49 -07:00
Todd C. Miller
ad4dc22d5a Automatically migrate lecture file path from name-based to uid-based.
GitHub issue #342.
2023-12-22 09:39:24 -07:00
Todd C. Miller
63f2c54b86 Add missing checks for strdup() failure. 2023-12-21 16:55:08 -07:00
Todd C. Miller
5fbf7a3625 Disable netgroup_query when netgroup_base is not set.
The logic was inverted when support for netgroup_query was added.
This supercedes PR #341.
2023-12-19 20:16:35 -07:00
Todd C. Miller
6d4ffe6743 In the NOEXEC example make it clear that "shanty" is a host.
Bug #1064
2023-12-19 09:55:09 -07:00
Todd C. Miller
10fd66ac99 closefrom_nodebug: skip fds < 0
This can only happen if lowfd < 0, which is never the case.
Quiets a static analyzer warning.
2023-12-18 13:32:53 -07:00
Todd C. Miller
7019148160 Fix printing of warning when a Defaults setting is missing a value.
This is a bug in parse_default_entry() introduced in sudo 1.8.19
when support for using the default syslog facility was added at the
wrong place in a switch().
2023-12-16 08:08:44 -07:00
Todd C. Miller
f67a7e623e Sprinkle some more const in defaults.c. 2023-12-15 15:05:02 -07:00
Todd C. Miller
2df637b262 Fix evaluation of a tuple used in "true" boolean context.
Previously, a tuple in boolean context was always treated as a
negated entry, which doesn't match the documentation.  We assume
that there are at least two tuple entries where the first maps to
boolean false and the second maps to boolean true.
2023-12-15 14:57:59 -07:00
Todd C. Miller
680352b917 Sudo 1.9.15p4 2023-12-15 10:57:24 -07:00
Todd C. Miller
fbc4c50d4d sudoers_lookup_pseudo: init match to UNSPEC for sudo_nss_can_continue().
Otherwise, processing will stop after the first sudoers nsswitch
service specification where [SUCCESS=return] is present.
2023-12-15 10:45:22 -07:00
Todd C. Miller
c9198ef4df Sudo 1.9.15p3 2023-12-13 12:15:12 -07:00
Todd C. Miller
de242c5738 Pass back Solaris privs as "runas_privs" and "runas_limitprivs".
The "runas_" prefix got inadvertantly removed in the big sudoers_context
refactor.
2023-12-11 13:31:56 -07:00
Todd C. Miller
1e03cbd0b4 sudo_term_is_raw: only try to lock the fd if it is a tty
This moves sudo_isatty() to libsudo_util so sudo_term_is_raw() can
use it.  Fixes GitHub issue #335
2023-12-09 12:54:56 -07:00
Todd C. Miller
d17e28ad61 setup_terminal: fix an editing error introduced in 1.9.15. 2023-12-07 07:27:06 -07:00
Todd C. Miller
0c2de39da3 command_matches_regex: retry with canonicalized path if possible
If ctx->user.cmnd doesn't match, use ctx->user.cmnd_dir (if present)
to construct a canonicalized path and match on that.
2023-12-06 10:27:57 -07:00