diff options
-rw-r--r-- | configure.ac | 39 |
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 | ) |
2337 | fi | 2333 | fi |
2338 | 2334 | ||
2335 | dnl NetBSD added an strnvis and unfortunately made it incompatible with the | ||
2336 | dnl existing one in OpenBSD and Linux's libbsd (the former having existed | ||
2337 | dnl for over ten years). Despite this incompatibility being reported during | ||
2338 | dnl development (see http://gnats.netbsd.org/44977) they still shipped it. | ||
2339 | dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible | ||
2340 | dnl implementation. Try to detect this mess, and assume the only safe option | ||
2341 | dnl if we're cross compiling. | ||
2342 | dnl | ||
2343 | dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag); | ||
2344 | dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag); | ||
2345 | if 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> | ||
2353 | static 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 | ) | ||
2368 | fi | ||
2369 | |||
2339 | AC_FUNC_GETPGRP | 2370 | AC_FUNC_GETPGRP |
2340 | 2371 | ||
2341 | # Search for OpenSSL | 2372 | # Search for OpenSSL |