summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac27
-rw-r--r--openbsd-compat/openbsd-compat.h10
2 files changed, 35 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 2240c725c..9b05c30f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1674,7 +1674,6 @@ AC_CHECK_FUNCS([ \
1674 pstat \ 1674 pstat \
1675 readpassphrase \ 1675 readpassphrase \
1676 reallocarray \ 1676 reallocarray \
1677 realpath \
1678 recvmsg \ 1677 recvmsg \
1679 rresvport_af \ 1678 rresvport_af \
1680 sendmsg \ 1679 sendmsg \
@@ -1891,6 +1890,32 @@ AC_CHECK_FUNCS([setresgid], [
1891 ) 1890 )
1892]) 1891])
1893 1892
1893AC_CHECK_FUNCS([realpath], [
1894 dnl the sftp v3 spec says SSH_FXP_REALPATH will "canonicalize any given
1895 dnl path name", however some implementations of realpath (and some
1896 dnl versions of the POSIX spec) do not work on non-existent files,
1897 dnl so we use the OpenBSD implementation on those platforms.
1898 AC_MSG_CHECKING([if realpath works with non-existent files])
1899 AC_RUN_IFELSE(
1900 [AC_LANG_PROGRAM([[
1901#include <limits.h>
1902#include <stdlib.h>
1903#include <errno.h>
1904 ]], [[
1905 char buf[PATH_MAX];
1906 if (realpath("/opensshnonexistentfilename1234", buf) == NULL)
1907 if (errno == ENOENT)
1908 exit(1);
1909 exit(0);
1910 ]])],
1911 [AC_MSG_RESULT([yes])],
1912 [AC_DEFINE([BROKEN_REALPATH], [1],
1913 [realpath does not work with nonexistent files])
1914 AC_MSG_RESULT([no])],
1915 [AC_MSG_WARN([cross compiling: assuming working])]
1916 )
1917])
1918
1894dnl Checks for time functions 1919dnl Checks for time functions
1895AC_CHECK_FUNCS([gettimeofday time]) 1920AC_CHECK_FUNCS([gettimeofday time])
1896dnl Checks for utmp functions 1921dnl Checks for utmp functions
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index cb59ccd57..1ff7114ef 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -70,8 +70,16 @@ void *reallocarray(void *, size_t, size_t);
70#endif 70#endif
71 71
72#if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH) 72#if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH)
73/*
74 * glibc's FORTIFY_SOURCE can redefine this and prevent us picking up the
75 * compat version.
76 */
77# ifdef BROKEN_REALPATH
78# define realpath(x, y) _ssh_compat_realpath(x, y)
79# endif
80
73char *realpath(const char *path, char *resolved); 81char *realpath(const char *path, char *resolved);
74#endif 82#endif
75 83
76#ifndef HAVE_RRESVPORT_AF 84#ifndef HAVE_RRESVPORT_AF
77int rresvport_af(int *alport, sa_family_t af); 85int rresvport_af(int *alport, sa_family_t af);