Commit Graph

88 Commits

Author SHA1 Message Date
Todd C. Miller
d6d467b92e Add implementation of SSL_read_ex/SSL_write_ex for those without. 2023-08-05 10:38:02 -06:00
Todd C. Miller
e6d14c95b6 Use SSL_read_ex() and SSL_write_ex() instead of SSL_read() and SSL_write(). 2023-08-05 10:38:01 -06:00
Todd C. Miller
bfb6132d9c Add configure tests for __builtin_clz/__builtin_clzl 2023-07-04 12:39:31 -06:00
Todd C. Miller
d4c6ef1222 Add adminconfdir and --enable-adminconf to set it.
Configuration paths in sudo are now a colon-separated list of files
with the adminconfdir instance first (if enabled), followed by a
sysconfdir instance.
2023-05-02 10:37:39 -06:00
Todd C. Miller
9ad6dfa371 Substitute for _PATH_SUDO* variables in pathnames.h.
Previously these were hard-coded with Makefile overrides.
2023-02-08 16:47:18 -07:00
Todd C. Miller
075ee0f9dc Add missing stdio.h include for the _FORTIFY_SOURCE=2 check.
Implementations of _FORTIFY_SOURCE require the header file to be
included.  Also remove the useless test of an empty program with
_FORTIFY_SOURCE defined.  Pointed out by Florian Weimer.
2023-04-26 12:44:10 -06:00
Todd C. Miller
b83140e0f1 Use ldap_msgfree() instead of ldap_init() for the lber.h test.
The ldap_init() function is marked as deprecated and not defined
by default on some systems.  This can cause an error for compilers
that do not support implicit function declarations.
From Florian Weimer.
2023-04-26 11:10:46 -06:00
Todd C. Miller
fc253048f5 Add LDAP-specific innetgr() implementation.
Wheh netgroup_base is set we now do out own netgroup lookups using
LDAP.  Previously, LDAP was queried directly to get a list of the
netgroups the user belongs to but other netgroups queries went
through innetgr(3).  This makes it possible to use netgroups
in LDAP sudoers on systems that don't have an innetgr() function.
GitHub issue #251.
2023-03-10 10:05:33 -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
1977f98d21 Fix a typo. 2023-01-27 14:44:45 -07:00
Todd C. Miller
f65a51afdf Try to link a simple shared object with -Wl,--no-undefined.
This only works for gcc-style compilers, which should not be a
problem.  The source uses environ (FreeBSD) and errno (OpenBSD).
2023-01-20 12:30:33 -07:00
Todd C. Miller
83b4cee98a Add -Wl,--no-undefined to LDFLAGS if it is supported.
This will find missing symbols at build-time instead of run-time.
Don't use it on FreeBSD where environ is filled in by the dynamic loader.
We also need to pull in -llber with -lldap where possible (instead
of relying on DT_NEEDED) to avoid undefined symbol errors when
building with LDAP support.
2023-01-19 07:47:10 -07:00
Todd C. Miller
544c978217 Solaris: use lt_prog_compiler_pic instead of assuming -KPIC 2023-01-18 16:05:52 -07:00
Todd C. Miller
e72d75d38e Solaris: the aslr, nxheap and nxstack link options are only for executables.
Move them back to PIE_LDFLAGS, which is only used when linking a binary.
2023-01-18 15:38:31 -07:00
Todd C. Miller
7d4666656e Solaris: move aslr linker option to hardening and try to build real PIEs
These flags are specific to the Solaris linker.
2023-01-18 15:14:55 -07:00
Todd C. Miller
b44ad49bf7 Enable non-executable heap and stack options for Solaris ld. 2023-01-18 14:54:20 -07:00
Todd C. Miller
73c52e731a Limit some of the hardening tests to compilers that define __GNUC__.
This should avoid false positives on other compilers.
2023-01-18 14:39:52 -07:00
Todd C. Miller
a960d2c45f Add back the linker check for -fstack-clash-protection.
This is expected to fix GitHub issue #231.
2023-01-17 16:19:29 -07:00
Todd C. Miller
e647997236 SUDO_CHECK_SANITIZER: quote "$3" in awk script so m4 doesn't eat it. 2022-12-17 16:46:26 -07:00
Todd C. Miller
2e322c0943 Fix a typo in SUDO_CHECK_NET_FUNC. 2022-12-06 18:28:49 -07:00
Todd C. Miller
104a0294e1 Initialize "found" in SUDO_CHECK_NET_FUNC. 2022-12-06 16:45:47 -07:00
Todd C. Miller
11264cd49b Fix pasto introduced in last commit. 2022-12-06 16:36:30 -07:00
Todd C. Miller
3d2082cdf3 Add SUDO_CHECK_NET_FUNC to check functions in the network libraries.
If a function is not found, check again with "-lsocket", "-linet",
"-lsocket -lnsl", or "-lresolv".
Also display network libs in final summary as well as the different
linker flags.
2022-12-06 16:09:26 -07:00
Todd C. Miller
f9639aca89 Make sure HAVE_MAILLOCK_H is defined on Solaris 10. 2022-12-06 14:03:40 -07:00
Todd C. Miller
3cdd044c68 Make path checks in sudo.m4 cachable. 2022-12-06 13:40:12 -07:00
Todd C. Miller
38ffd03cd6 Move gettext checks to m4/gettext.m4 2022-12-05 19:26:50 -07:00
Todd C. Miller
12da6bd0ce Move LDAP library checks to m4/ldap.m4 and make more tests cacheable. 2022-12-05 16:52:34 -07:00
Todd C. Miller
00e22508a7 Move OpenSSL/wolfSSL checks to m4/openssl.m4 2022-12-05 16:45:18 -07:00
Todd C. Miller
f515c238bc Move PIE executable checks to m4/pie.m4 2022-12-05 12:34:12 -07:00
Todd C. Miller
4220e6631b Move address sanitizer and fuzzer checks to m4/sanitizer.m4 2022-12-05 12:33:44 -07:00
Todd C. Miller
ea5668086c Move symbol visibility checks to m4/visibility.m4 2022-12-05 12:33:42 -07:00
Todd C. Miller
5bf5a4e26c Move hardening checks to m4/hardening.m4 2022-12-05 12:32:53 -07:00
Todd C. Miller
8718fc2083 Make cpp variadic arguments check into a macro and move to sudo.m4.
Also move the PVS-Studio.cfg generation to sudo.m4.
2022-12-05 09:47:21 -07:00
Todd C. Miller
4af5e6293c Update macros from autoconf-archive. 2022-11-16 19:24:42 -07:00
Todd C. Miller
03559d0770 Replace foo in descriptions with 'foo' 2022-11-16 10:10:20 -07:00
Todd C. Miller
cc4d7196ff Update to libtool 2.4.7. 2022-03-31 16:14:10 -06:00
Todd C. Miller
cccefb962b Improve macOS version detection to support macOS 11 and simplify legacy logic
From Jeremy Huddleston Sequoia
2021-10-20 19:31:57 -06:00
Todd C. Miller
3a4aec7a62 sudo_intercept.so: only replace execvpe() if it is present.
execvpe() is a GNU extension also found on *BSD (but not macOS).
2021-09-08 11:09:59 -06:00
Todd C. Miller
242e4d070f Fix typo in comment. 2021-09-01 11:07:36 -06:00
Todd C. Miller
b40f74cb24 Cross-build support for mksigname and mksiglist
We must build these with the host C compiler but use the target
preprocessor to generate the output.
2021-08-19 09:50:05 -06:00
Todd C. Miller
f8e05dd984 Use AC_CACHE_CHECK in place of AC_MSG_CHECKING + AC_CACHE_VAL where possible. 2021-07-25 19:29:25 -06:00
Todd C. Miller
fda17ecfda Rename logsrvd log dir to /var/log/sudo_logsrvd. 2021-05-02 08:28:19 -06:00
Todd C. Miller
6f5b353e87 Add configuration for sudo_logsrvd store-and-forward mode.
Adds "relay_dir" and "store_first" settings to sudo_logsrvd.conf
in the [relay] section.  Also adds a --with-relaydir configure
argument to change the default value (usually /var/log/logsrvd-relay.
2021-04-23 16:54:15 -06:00
Todd C. Miller
5ffa915c9c determine Python (3.10) version number correctly.
from upstream automake
2021-04-16 14:06:07 -06:00
Todd C. Miller
fbbf602664 Move python.m4 and runlog.m4 to the m4 directory.
Previously they were inline in aclocal.m4.
2021-04-16 13:41:43 -06:00
Todd C. Miller
e0c2635fb3 Apply Google inclusive language guidelines.
Also replace backwards with backward.
2020-10-30 10:15:30 -06:00
Evan Anderson
92e5d81943 configure: Fix runstatedir handling for distros that do not support it
runstatedir was added in yet-to-be released autoconf 2.70. Some distros
are shipping this addition in their autoconf packages, but others, such as Fedora,
are not. This causes the rundir variable to be set incorrectly if the configure script
is regenerated with an unpatched autoconf since the runstatedir variable set is deleted
after regeneration. This change works around that problem by checking that runstatedir
is non-empty before potentially using it to set the rundir variable
2020-09-06 15:32:50 -06:00
Todd C. Miller
9ef09595f9 Allow HP-UX share libs and modules to link against static libs.
hppa64 and ia64 use PIC by default
2020-06-26 09:13:38 -06:00
Todd C. Miller
23b1ee2f45 Fix some warnings from configure test programs. 2020-06-20 13:51:02 -06:00
Todd C. Miller
026caf0081 Add basic support for --runstatedir
If the user specifies --runstatedir but not --with-rundir, use
runstatdir as the parent directory of the sudo rundir.

In the future we may deprecate --with-rundir in favor of --runstatedir
but that will require changes for systems with no /var/run directory.
2020-05-20 18:51:52 -06:00