mirror of
https://github.com/openssh/openssh-portable.git
synced 2026-11-06 05:16:43 +00:00
Move USE_SYSTEM_GLOB into a glob.h compat shim.
This moves the logic for selecting whether or not we can use the system glob into configure, and if either don't have glob or can't use it, we create the shim. Removes several diffs vs upstream.
This commit is contained in:
10 files changed
+43
-42
No files matched your search
+1
-5
@@ -32,6 +32,7 @@
|
||||
#include <errno.h>
|
||||
#include <paths.h>
|
||||
#include <pwd.h>
|
||||
#include <glob.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
@@ -39,11 +40,6 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#ifdef USE_SYSTEM_GLOB
|
||||
# include <glob.h>
|
||||
#else
|
||||
# include "openbsd-compat/glob.h"
|
||||
#endif
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "ssh.h"
|
||||
|
||||
+36
-8
@@ -464,7 +464,6 @@ AC_CHECK_HEADERS([ \
|
||||
floatingpoint.h \
|
||||
fnmatch.h \
|
||||
getopt.h \
|
||||
glob.h \
|
||||
ia.h \
|
||||
iaf.h \
|
||||
inttypes.h \
|
||||
@@ -553,7 +552,6 @@ AC_CHECK_HEADERS([ \
|
||||
*) ;;
|
||||
esac >"$header"
|
||||
])
|
||||
AC_SUBST([COMPATINCLUDES])
|
||||
|
||||
AC_CHECK_DECLS([le32toh, le64toh, htole64], [], [], [
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
@@ -805,7 +803,7 @@ int main(void) { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
|
||||
AC_DEFINE([SETEUID_BREAKS_SETUID])
|
||||
AC_DEFINE([BROKEN_SETREUID])
|
||||
AC_DEFINE([BROKEN_SETREGID])
|
||||
AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
|
||||
broken_glob=yes # OS X glob does not do what we expect
|
||||
AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
|
||||
[Define if your resolver libs need this for getrrsetbyname])
|
||||
AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
|
||||
@@ -1123,7 +1121,7 @@ mips-sony-bsd|mips-sony-newsos4)
|
||||
[Use tunnel device compatibility to OpenBSD])
|
||||
AC_CHECK_HEADER([net/if_tap.h], ,
|
||||
AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
|
||||
AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
|
||||
broken_glob=yes # FreeBSD glob does not do what we need
|
||||
TEST_MALLOC_OPTIONS="AJRX"
|
||||
# Preauth crypto occasionally uses file descriptors for crypto offload
|
||||
# and will crash if they cannot be opened.
|
||||
@@ -1678,6 +1676,15 @@ else
|
||||
[Define to rpl_calloc if the replacement function should be used.])
|
||||
fi
|
||||
|
||||
dnl Figure out if we have a system glob, and if so if we can use it.
|
||||
AC_CHECK_FUNCS([glob],
|
||||
[ AC_CHECK_HEADERS([glob.h],
|
||||
[use_system_glob=yes],
|
||||
[use_system_glob=no])
|
||||
],
|
||||
use_system_glob=no
|
||||
)
|
||||
|
||||
# Check for ALTDIRFUNC glob() extension
|
||||
AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
|
||||
AC_EGREP_CPP([FOUNDIT],
|
||||
@@ -1695,6 +1702,7 @@ AC_EGREP_CPP([FOUNDIT],
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
use_system_glob=no
|
||||
]
|
||||
)
|
||||
|
||||
@@ -1709,7 +1717,9 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
use_system_glob=no
|
||||
]
|
||||
)
|
||||
|
||||
# Check for g.gl_statv glob() extension
|
||||
AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
|
||||
@@ -1727,10 +1737,28 @@ g.gl_statv = NULL;
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
use_system_glob=no
|
||||
]
|
||||
)
|
||||
|
||||
])
|
||||
AC_CHECK_DECLS([GLOB_NOMATCH], , [use_system_glob=no], [#include <glob.h>])
|
||||
|
||||
AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
|
||||
if test "x$broken_glob" = "xyes"; then
|
||||
AC_DEFINE([BROKEN_GLOB], [1], [Do not use system glob])
|
||||
use_system_glob=no
|
||||
fi
|
||||
|
||||
dnl If we don't have a system glob, or we do but we're not using it, then
|
||||
dnl create a glob.h shim so we don't have to sprinkle ifdefs everywhere.
|
||||
AC_MSG_CHECKING([if we can use the system glob])
|
||||
if test "x$use_system_glob" = "xyes" ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
COMPATINCLUDES="openbsd-compat/include"
|
||||
mkdir -p "$COMPATINCLUDES"
|
||||
echo '# include "openbsd-compat/glob.h"' >$COMPATINCLUDES/glob.h
|
||||
fi
|
||||
|
||||
AC_CHECK_DECL([VIS_ALL], ,
|
||||
AC_DEFINE(BROKEN_STRNVIS, 1, [missing VIS_ALL]), [#include <vis.h>])
|
||||
@@ -2089,7 +2117,6 @@ AC_CHECK_FUNCS([ \
|
||||
getrandom \
|
||||
getsid \
|
||||
getttyent \
|
||||
glob \
|
||||
group_from_gid \
|
||||
inet_aton \
|
||||
inet_ntoa \
|
||||
@@ -5830,6 +5857,7 @@ LDFLAGS_NOPIE=`echo "$LDFLAGS" | sed 's/^-pie //;s/ -pie//g'`
|
||||
CFLAGS_NOPIE=`echo "$CFLAGS" | sed 's/^-fPIE //;s/ -fPIE//g'`
|
||||
AC_SUBST([LDFLAGS_NOPIE])
|
||||
AC_SUBST([CFLAGS_NOPIE])
|
||||
AC_SUBST([COMPATINCLUDES])
|
||||
|
||||
AC_EXEEXT
|
||||
AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
|
||||
|
||||
@@ -979,13 +979,6 @@ struct winsize {
|
||||
# endif /* gcc version */
|
||||
#endif /* __predict_true */
|
||||
|
||||
#if defined(HAVE_GLOB_H) && defined(GLOB_HAS_ALTDIRFUNC) && \
|
||||
defined(GLOB_HAS_GL_MATCHC) && defined(GLOB_HAS_GL_STATV) && \
|
||||
defined(HAVE_DECL_GLOB_NOMATCH) && HAVE_DECL_GLOB_NOMATCH != 0 && \
|
||||
!defined(BROKEN_GLOB)
|
||||
# define USE_SYSTEM_GLOB
|
||||
#endif
|
||||
|
||||
/*
|
||||
* sntrup761 uses variable length arrays and c99-style declarations after code,
|
||||
* so only enable if the compiler supports them.
|
||||
|
||||
+1
-5
@@ -28,6 +28,7 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <glob.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <limits.h>
|
||||
#include <netdb.h>
|
||||
@@ -38,11 +39,6 @@
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#ifdef USE_SYSTEM_GLOB
|
||||
# include <glob.h>
|
||||
#else
|
||||
# include "openbsd-compat/glob.h"
|
||||
#endif
|
||||
#include <util.h>
|
||||
#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS)
|
||||
# include <vis.h>
|
||||
|
||||
@@ -87,11 +87,7 @@
|
||||
#ifdef HAVE_FNMATCH_H
|
||||
#include <fnmatch.h>
|
||||
#endif
|
||||
#ifdef USE_SYSTEM_GLOB
|
||||
# include <glob.h>
|
||||
#else
|
||||
# include "openbsd-compat/glob.h"
|
||||
#endif
|
||||
#include <glob.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <util.h>
|
||||
|
||||
+1
-5
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <glob.h>
|
||||
#include <netdb.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
@@ -37,11 +38,6 @@
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <util.h>
|
||||
#ifdef USE_SYSTEM_GLOB
|
||||
# include <glob.h>
|
||||
#else
|
||||
# include "openbsd-compat/glob.h"
|
||||
#endif
|
||||
|
||||
#include "openbsd-compat/sys-queue.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
@@ -21,12 +21,6 @@
|
||||
#ifndef _SFTP_CLIENT_H
|
||||
#define _SFTP_CLIENT_H
|
||||
|
||||
#ifdef USE_SYSTEM_GLOB
|
||||
# include <glob.h>
|
||||
#else
|
||||
# include "openbsd-compat/glob.h"
|
||||
#endif
|
||||
|
||||
typedef struct SFTP_DIRENT SFTP_DIRENT;
|
||||
|
||||
struct SFTP_DIRENT {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <glob.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <openbsd-compat/sys-tree.h>
|
||||
|
||||
#include <glob.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
Reference in new issue
Block a user