Commit Graph

12255 Commits

Author SHA1 Message Date
Todd C. Miller
f4d2412628 Sudo 1.9.13p2. 2023-02-25 11:20:55 -07:00
Todd C. Miller
87ce692468 Fix potential double free for rules that include a CHROOT= option.
If a rule with a CHROOT= option matches the user, host and runas,
the user_cmnd variable could be freed twice.
2023-02-21 20:01:13 -07:00
Todd C. Miller
6c52056d36 Include error string when formatting a SLOG_PARSE_ERROR message if present. 2023-02-23 11:37:04 -07:00
Todd C. Miller
0be5a51918 Add missing include of errno.h. 2023-02-23 09:14:28 -07:00
Todd C. Miller
3281d0eec4 sudo_lbuf_expand: check for overflow when rounding to the nearest power of 2.
Problem deteced by oss-fuzz using the fuzz_sudoers fuzzer.
2023-02-23 08:19:18 -07:00
Todd C. Miller
91814990aa Fix --enable-static-sudoers, broken in sudo 1.9.13.
sudo_qualify_plugin() should not try to fully-qualify the path to
a statically-compiled plugin.  GitHub issue #245
2023-02-23 06:57:37 -07:00
Todd C. Miller
fb6740fa2e Add sudoers open errors to the list of parse errors sent via mail.
Previously there would be one email for the open failure and a
separate one describing the parse error.  Now a single email message
contains everything.
2023-02-22 18:49:09 -07:00
Todd C. Miller
1641c30ed6 visudo: quiet a compiler warning on Solaris 10.
Also explicitly close /dev/tty fd instead of relying on closefrom()
in case the fd ends up being a value 0-2.
2023-02-22 10:55:27 -07:00
Todd C. Miller
8bb1160624 Replace LIBMD with LIBCRYPTO display crypto/tls libs in summary.
We can only have one of either -lmd, -lgcrypt or -lcrypto so there
is no need to have more than one variable.
2023-02-22 08:49:33 -07:00
Todd C. Miller
05c866b6e1 Merge pull request #244 from ffontaine/main
configure.ac: fix openssl static build
2023-02-22 09:47:42 -07:00
Fabrice Fontaine
1fed5adc16 configure.ac: fix openssl static build
Do not use AX_APPEND_FLAG as it will break static builds by removing
duplicates such as -lz or -latomic which are needed by -lssl and
-lcrypto. This will fix the following build failure with sparc which
needs -latomic:

Checking for X509_STORE_CTX_get0_cert
configure:21215: /home/thomas/autobuild/instance-3/output-1/host/bin/sparc-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0  -static -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DZLIB_CONST  -static conftest.c   -L/home/thomas/autobuild/instance-3/output-1/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib -lssl -lz -pthread -latomic -lcrypto >&5
/home/thomas/autobuild/instance-3/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/10.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: /home/thomas/autobuild/instance-3/output-1/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libcrypto.a(x509cset.o): in function `X509_CRL_up_ref':
x509cset.c:(.text+0x108): undefined reference to `__atomic_fetch_add_4'

[...]

In file included from ./hostcheck.c:38:
../../include/sudo_compat.h:342:41: error: conflicting types for 'ASN1_STRING_data'
  342 | #  define ASN1_STRING_get0_data(x)      ASN1_STRING_data(x)
      |                                         ^~~~~~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/8be59dd94e4916f9457cb435104e36e62a28373b

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2023-02-22 10:45:36 +01:00
Todd C. Miller
ba7b126451 Check tcsetpgrp() return value. 2023-02-21 16:34:12 -07:00
Todd C. Miller
0339337103 Run the editor in its own process group.
This fixes suspending the editor on GNU Hurd which doesn't seem to
have proper process group signal handling.
2023-02-21 16:14:14 -07:00
Todd C. Miller
1bcddb9602 Stub out pivot_root() and unpivot_root() for all but the sudoers module. 2023-02-21 14:46:27 -07:00
Todd C. Miller
8b9c1b962f Fix build when SUDOERS_NAME_MATCH is defined. 2023-02-21 13:47:27 -07:00
Todd C. Miller
b52631e877 Match using canonicalized directories where possible. 2023-02-21 13:24:33 -07:00
Todd C. Miller
0ef5373678 Add canon_path(), a realpath() wrapper that performs caching.
This also adds a new user_cmnd_dir variable that stores the
canonicalized parent directory of the command to be run.
2023-02-21 13:24:33 -07:00
Todd C. Miller
0443d14578 Add checks for realpath(3) and a version from NetBSD for those without it. 2023-02-12 13:27:17 -07:00
Todd C. Miller
78ff514358 match_command: apply runchroot if set when matching the command
Previously we would prepend runchroot to the path we were checking
but that does not properly handle symbolic links.
2023-02-21 13:24:33 -07:00
Todd C. Miller
bff4e3ce16 set_cmnd_path: apply runchroot if set when finding the command path
Previously we would prepend runchroot to the path we were checking
but that does not properly handle symbolic links.
2023-02-21 13:24:33 -07:00
Todd C. Miller
13a311bc71 Add pivot_root() and unpivot_root() to switch the root dir and restore it.
This will be used to more accurately handling command resolution and
path matching when a new root directory is specified.
2023-02-21 13:24:33 -07:00
Todd C. Miller
440d9649a8 Move initial values into AC_SUBST() where possible. 2023-02-21 10:17:24 -07:00
Todd C. Miller
7c6f373587 No need to AC_SUBST() standard autoconf variables. 2023-02-21 09:34:49 -07:00
Todd C. Miller
8d95992c1a ptrace_intercept_execve: preserve old argv[0] after policy check.
We have to replace argv[0] with the pathname for the policy check
but want to restore it afterwards if the policy has not changed the
command's path name to avoid a mismatch later on.
2023-02-21 10:25:14 -07:00
Todd C. Miller
ceee445e8c Document --disable-largefile and --disable-year2038. 2023-02-19 09:46:12 -07:00
Todd C. Miller
b8c13bbe89 Fix indentation of intercept file in summary output. 2023-02-19 09:21:39 -07:00
Todd C. Miller
a72bc5e6bf get_starttime: add support for GNU Hurd using the mach task_info call.
This is currently Hurd-specific but could be made Mach-generic as
long as the equivalent of pid2task() is available.
2023-02-19 07:18:37 -07:00
Todd C. Miller
0b000aab86 Only test get_starttime() on platforms where we support it.
Fixes a test failure on systems where we have no way to determine
a process's start time.
2023-02-18 11:46:33 -07:00
Todd C. Miller
58382028aa Sudo 1.9.13p1 2023-02-16 10:17:32 -07:00
Todd C. Miller
42163ac0a9 Use m4_bmatch, m4_case does not support shell-style globbing. 2023-02-16 10:05:26 -07:00
Todd C. Miller
2feea9b2f6 Allow configure.ac to be processed by autoconf 2.69.
AC_PROG_CC_STDC is deprecated in autoconf 2.70 and above but it is
necessary for autoconf 2.69.
2023-02-16 09:46:07 -07:00
Todd C. Miller
d7080afe0e Only use AC_SYS_YEAR2038 if it is defined.
Otherwise, use the method from 1.9.12.
GitHub issue #242
2023-02-16 07:21:05 -07:00
Todd C. Miller
439f0734f5 Sudo-specific executables moved to /usr/libexec/sudo starting in
Debian 12 (Bookworm) and Ubuntu 22.04 (Jammy Jellyfish).
Previously, they were stored in /usr/lib/sudo.
2023-02-15 17:18:39 -07:00
Todd C. Miller
2845ceafb0 Handle "locale -a" returning both C.UTF-8 and C.utf8.
It is possible to have mutiple matches from the output of "locale
-a".  Just take the first one.  Fixes GitHub issue #241.
2023-02-15 13:49:04 -07:00
Todd C. Miller
4f50692acc Add some missing files to the clean and distclean targets. 2023-02-15 10:22:42 -07:00
Todd C. Miller
a845039de5 Merge pull request #240 from thesamesam/c23
sudo_fatal: Fix build where compiler recognises [[noreturn]] attribut…
2023-02-15 07:59:52 -07:00
Sam James
66359c2bc9 sudo_fatal: Fix build where compiler recognises [[noreturn]] attribute (C23)
If the compiler supports [[noreturn]] as a attribute as in C23,
then we define sudo_noreturn to be it. When that's the case, we must place
it at the beginning of the declaration, before any other *extension*
attributes (__attribute(...)).

A bug has been filed with GCC regarding rejecting/accepting mixed
attribute styles.

sudo_dso_public is always an extension attribute, while sudo_noreturn only
might be, so put it first.

This only shows up with GCC 13 so far (see the linked GCC bug for a bit more
exploration). Clang 16 does support the attribute but doesn't let you use it
for earlier language versions (need to pass explicit -std=c2x, unlike with GCC here).

This is essentially a followup to e707ffe58b.

Tested with GCC 13.0.1 20230212 (unreleased), GCC 12.2.1 20230211,
Clang 16.0.0_rc2, and Clang 15.0.7.

Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796
Closes: https://github.com/sudo-project/sudo/issues/239
Fixes: e707ffe58b
Fixes: 16ae61dcd7
2023-02-15 04:06:15 +00:00
Todd C. Miller
defec5d46e Add missing '[' to AS_IF() call.
Fixes GitHub issue #238.
2023-02-14 14:24:28 -07:00
Todd C. Miller
a80dcc6aca Add compiled version of the sudoers Georgian translation. 2023-02-14 09:52:06 -07:00
Todd C. Miller
5eed6adb6f Do not ignore .mo files.
Otherwise we are likely to miss uncommitted changes in them.
2023-02-14 09:51:34 -07:00
Todd C. Miller
f1b07aed47 Regenerate .mo files. 2023-02-14 09:44:59 -07:00
Todd C. Miller
bdef2ad6d2 No longer need to define sudoers_recovery here. 2023-02-09 16:39:25 -07:00
Todd C. Miller
0008d1f719 Mention that a missing include file is no longer fatal. 2023-02-09 15:37:12 -07:00
Todd C. Miller
26385b45cf Recover from missing include file unless error_recovery is disabled.
It is still treated as an error from a logging perspective, and
mail is still sent.
2023-02-09 15:33:58 -07:00
Todd C. Miller
8960f50961 Updated translations from translationproject.org 2023-02-03 10:26:24 -07:00
Todd C. Miller
b333d16878 Add eventlog_mail() to send a log message via mail.
This is used by mail_parse_errors() to send multi-line messages.
Previously, the newlines would be escaped as control characters.
2023-02-09 11:09:24 -07:00
Todd C. Miller
b6caacfe4e send_mail: pass a single string instead of using varargs
These days we only ever pass in a const string.
2023-02-09 11:09:03 -07:00
Todd C. Miller
2e1a73502e Use AS_IF instead of if; then where possible. 2023-02-05 08:06:02 -07:00
Todd C. Miller
cfa1fee622 Mention the fix for GitHub #237. 2023-02-03 10:35:34 -07:00
Todd C. Miller
f160e5e6c6 Display error in error message if we can't restore the terminal. 2023-02-03 07:19:19 -07:00