summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2016-08-02 12:16:34 +1000
committerDarren Tucker <dtucker@zip.com.au>2016-08-02 12:16:34 +1000
commit20e5e8ba9c5d868d897896190542213a60fffbd2 (patch)
treea812e7db9009b53412f3421d4ca1a12434ab6c17 /configure.ac
parentb0b48beab1b74100b61ecbadb9140c9ab4c2ea8c (diff)
Explicitly test for broken strnvis.
NetBSD added an strnvis and unfortunately made it incompatible with the existing one in OpenBSD and Linux's libbsd (the former having existed for over ten years). Despite this incompatibility being reported during development (see http://gnats.netbsd.org/44977) they still shipped it. Even more unfortunately FreeBSD and later MacOS picked up this incompatible implementation. Try to detect this mess, and assume the only safe option if we're cross compiling. OpenBSD 2.9 (2001): strnvis(char *dst, const char *src, size_t dlen, int flag); NetBSD 6.0 (2012): strnvis(char *dst, size_t dlen, const char *src, int flag); ok djm@
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac39
1 files changed, 35 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 7c1956dc6..1df3cbfdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -849,8 +849,6 @@ mips-sony-bsd|mips-sony-newsos4)
849 AC_DEFINE([SSH_TUN_PREPEND_AF], [1], 849 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
850 [Prepend the address family to IP tunnel traffic]) 850 [Prepend the address family to IP tunnel traffic])
851 TEST_MALLOC_OPTIONS="AJRX" 851 TEST_MALLOC_OPTIONS="AJRX"
852 AC_DEFINE([BROKEN_STRNVIS], [1],
853 [NetBSD strnvis argument order is swapped compared to OpenBSD])
854 AC_DEFINE([BROKEN_READ_COMPARISON], [1], 852 AC_DEFINE([BROKEN_READ_COMPARISON], [1],
855 [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it]) 853 [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it])
856 ;; 854 ;;
@@ -861,8 +859,6 @@ mips-sony-bsd|mips-sony-newsos4)
861 AC_CHECK_HEADER([net/if_tap.h], , 859 AC_CHECK_HEADER([net/if_tap.h], ,
862 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support])) 860 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
863 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need]) 861 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
864 AC_DEFINE([BROKEN_STRNVIS], [1],
865 [FreeBSD strnvis argument order is swapped compared to OpenBSD])
866 TEST_MALLOC_OPTIONS="AJRX" 862 TEST_MALLOC_OPTIONS="AJRX"
867 # Preauth crypto occasionally uses file descriptors for crypto offload 863 # Preauth crypto occasionally uses file descriptors for crypto offload
868 # and will crash if they cannot be opened. 864 # and will crash if they cannot be opened.
@@ -2336,6 +2332,41 @@ if test "x$check_for_conflicting_getspnam" = "x1"; then
2336 ) 2332 )
2337fi 2333fi
2338 2334
2335dnl NetBSD added an strnvis and unfortunately made it incompatible with the
2336dnl existing one in OpenBSD and Linux's libbsd (the former having existed
2337dnl for over ten years). Despite this incompatibility being reported during
2338dnl development (see http://gnats.netbsd.org/44977) they still shipped it.
2339dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible
2340dnl implementation. Try to detect this mess, and assume the only safe option
2341dnl if we're cross compiling.
2342dnl
2343dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag);
2344dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag);
2345if test "x$ac_cv_func_strnvis" = "xyes"; then
2346 AC_MSG_CHECKING([for working strnvis])
2347 AC_RUN_IFELSE(
2348 [AC_LANG_PROGRAM([[
2349#include <signal.h>
2350#include <stdlib.h>
2351#include <string.h>
2352#include <vis.h>
2353static void sighandler(int sig) { _exit(1); }
2354 ]], [[
2355 char dst[16];
2356
2357 signal(SIGSEGV, sighandler);
2358 if (strnvis(dst, "src", 4, 0) && strcmp(dst, "src") == 0)
2359 exit(0);
2360 exit(1)
2361 ]])],
2362 [AC_MSG_RESULT([yes])],
2363 [AC_MSG_RESULT([no])
2364 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis detected broken])],
2365 [AC_MSG_WARN([cross compiling: assuming broken])
2366 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis assumed broken])]
2367 )
2368fi
2369
2339AC_FUNC_GETPGRP 2370AC_FUNC_GETPGRP
2340 2371
2341# Search for OpenSSL 2372# Search for OpenSSL