From 442cc6f1b4a5ff25a6301acee58199b65800730d Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Wed, 7 Oct 2015 08:55:05 -0500 Subject: [PATCH] add tame(2) check --- configure.ac | 3 ++- include/compat/unistd.h | 4 ++++ m4/check-libc.m4 | 17 ++++++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index d02b3d4..c103399 100644 --- a/configure.ac +++ b/configure.ac @@ -49,7 +49,8 @@ AM_CONDITIONAL([BUILD_CERTHASH], [test "x$ac_cv_func_symlink" = xyes]) AC_CHECK_FUNC([funopen]) CHECK_LIBC_COMPAT -CHECK_LIBC_CRYPTO_COMPAT +CHECK_SYSCALL_COMPAT +CHECK_CRYPTO_COMPAT CHECK_VA_COPY CHECK_B64_NTOP diff --git a/include/compat/unistd.h b/include/compat/unistd.h index 5dc2908..758512b 100644 --- a/include/compat/unistd.h +++ b/include/compat/unistd.h @@ -29,4 +29,8 @@ unsigned int sleep(unsigned int seconds); int getentropy(void *buf, size_t buflen); #endif +#ifndef HAVE_TAME +#define tame(request, paths) +#endif + #endif diff --git a/m4/check-libc.m4 b/m4/check-libc.m4 index 63fd893..2e3e820 100644 --- a/m4/check-libc.m4 +++ b/m4/check-libc.m4 @@ -2,14 +2,11 @@ AC_DEFUN([CHECK_LIBC_COMPAT], [ # Check for libc headers AC_CHECK_HEADERS([err.h readpassphrase.h]) # Check for general libc functions -AC_CHECK_FUNCS([accept4 asprintf inet_pton memmem poll]) -AC_CHECK_FUNCS([readpassphrase reallocarray]) +AC_CHECK_FUNCS([asprintf inet_pton memmem readpassphrase reallocarray]) AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum]) -AM_CONDITIONAL([HAVE_ACCEPT4], [test "x$ac_cv_func_accept4" = xyes]) AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes]) AM_CONDITIONAL([HAVE_INET_PTON], [test "x$ac_cv_func_inet_pton" = xyes]) AM_CONDITIONAL([HAVE_MEMMEM], [test "x$ac_cv_func_memmem" = xyes]) -AM_CONDITIONAL([HAVE_POLL], [test "x$ac_cv_func_poll" = xyes]) AM_CONDITIONAL([HAVE_READPASSPHRASE], [test "x$ac_cv_func_readpassphrase" = xyes]) AM_CONDITIONAL([HAVE_REALLOCARRAY], [test "x$ac_cv_func_reallocarray" = xyes]) AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes]) @@ -20,6 +17,13 @@ AM_CONDITIONAL([HAVE_STRSEP], [test "x$ac_cv_func_strsep" = xyes]) AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes]) ]) +AC_DEFUN([CHECK_SYSCALL_COMPAT], [ +AC_CHECK_FUNCS([accept4 poll tame]) +AM_CONDITIONAL([HAVE_ACCEPT4], [test "x$ac_cv_func_accept4" = xyes]) +AM_CONDITIONAL([HAVE_POLL], [test "x$ac_cv_func_poll" = xyes]) +AM_CONDITIONAL([HAVE_TAME], [test "x$ac_cv_func_tame" = xyes]) +]) + AC_DEFUN([CHECK_B64_NTOP], [ AC_SEARCH_LIBS([b64_ntop],[resolv]) AC_SEARCH_LIBS([__b64_ntop],[resolv]) @@ -38,9 +42,8 @@ AC_CACHE_CHECK([for b64_ntop], ac_cv_have_b64_ntop_arg, [ AM_CONDITIONAL([HAVE_B64_NTOP], [test "x$ac_cv_func_b64_ntop" = xyes]) ]) - -AC_DEFUN([CHECK_LIBC_CRYPTO_COMPAT], [ -# Check crypto-related libc functions +AC_DEFUN([CHECK_CRYPTO_COMPAT], [ +# Check crypto-related libc functions and syscalls AC_CHECK_FUNCS([arc4random_buf explicit_bzero getauxval getentropy]) AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp]) AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], [test "x$ac_cv_func_arc4random_buf" = xyes])