From a6fea9e8b283586226483ff36aeff9644a6dc81c Mon Sep 17 00:00:00 2001 From: grant Date: Wed, 10 Dec 2003 07:21:20 +0000 Subject: always use local glob() as some glob() implementations have security issues. suggested by lukem. --- pkgtools/libnbcompat/files/Makefile.in | 13 ++--- pkgtools/libnbcompat/files/configure | 73 +------------------------ pkgtools/libnbcompat/files/configure.ac | 22 +------- pkgtools/libnbcompat/files/dummy.c | 4 -- pkgtools/libnbcompat/files/nbcompat.h | 14 ++--- pkgtools/libnbcompat/files/nbcompat/config.h.in | 9 --- 6 files changed, 14 insertions(+), 121 deletions(-) delete mode 100644 pkgtools/libnbcompat/files/dummy.c (limited to 'pkgtools') diff --git a/pkgtools/libnbcompat/files/Makefile.in b/pkgtools/libnbcompat/files/Makefile.in index 61adafda801..75d4208ec5d 100644 --- a/pkgtools/libnbcompat/files/Makefile.in +++ b/pkgtools/libnbcompat/files/Makefile.in @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.in,v 1.21 2003/12/08 15:28:54 grant Exp $ +# $NetBSD: Makefile.in,v 1.22 2003/12/10 07:21:20 grant Exp $ # srcdir= @srcdir@ @@ -24,7 +24,8 @@ INCS= nbcompat.h nbcompat/err.h nbcompat/fts.h nbcompat/getopt.h \ nbcompat/nbtypes.h nbcompat/poll.h nbcompat/rmd160.h \ nbcompat/sha1.h nbcompat/statfs.h nbcompat/vis.h -OBJS= @LIBOBJS@ +# always use our local glob() implementation. +OBJS= glob.o @LIBOBJS@ LINK= $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@ COMPILE= $(CC) $(CPPFLAGS) $(CFLAGS) @@ -36,12 +37,8 @@ all: nbcompat/nbtypes.h nbcompat/nbconfig.h $(LIB) .c.o: nbcompat/nbtypes.h $(COMPILE) $(DEFS) -c $< -# Add dummy.o not to become totally empty, which some ld's don't like. -$(LIB): $(OBJS) dummy.o - @set -x; case "$(OBJS)" in \ - *.*) $(AR) cr $@ $(OBJS);; \ - *) $(AR) cr $@ dummy.o;; \ - esac +$(LIB): $(OBJS) + $(AR) cr $@ $(OBJS) $(RANLIB) $@ nbcompat/nbconfig.h: nbcompat/config.h diff --git a/pkgtools/libnbcompat/files/configure b/pkgtools/libnbcompat/files/configure index dccad66214c..0a73ebe4d78 100755 --- a/pkgtools/libnbcompat/files/configure +++ b/pkgtools/libnbcompat/files/configure @@ -3165,11 +3165,10 @@ done - for ac_header in arpa/nameser.h assert.h bind/bitypes.h dirent.h err.h \ - errno.h fcntl.h fts.h glob.h inttypes.h libutil.h limits.h \ + errno.h fcntl.h fts.h inttypes.h libutil.h limits.h \ machine/endian.h memory.h ndir.h netdb.h netinet/in6_machtypes.h \ paths.h poll.h pwd.h stdint.h stdlib.h stringlist.h strings.h \ string.h sys/bitypes.h sys/byteorder.h sys/cdefs.h sys/dir.h \ @@ -6321,8 +6320,7 @@ done - -for ac_func in err fgetln fparseln fseeko getenv glob inet_ntop \ +for ac_func in err fgetln fparseln fseeko getenv inet_ntop \ inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \ poll setprogname snprintf strdup strerror strlcat strlcpy \ strmode strptime strsep strtoll timegm usleep @@ -8080,73 +8078,6 @@ _ACEOF LIBOBJS="$LIBOBJS statfs.$ac_objext" fi -pkg_use_nbcompat_glob=yes - - echo "$as_me:$LINENO: checking if GLOB_NOMATCH and GLOB_ABORTED are defined in glob.h" >&5 -echo $ECHO_N "checking if GLOB_NOMATCH and GLOB_ABORTED are defined in glob.h... $ECHO_C" >&6 -if test "${pkg_cv_GLOB_NOMATCH_ABORTED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - #include -int -main () -{ - int f = GLOB_NOMATCH + GLOB_ABORTED ; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - pkg_cv_GLOB_NOMATCH_ABORTED=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - pkg_cv_GLOB_NOMATCH_ABORTED=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $pkg_cv_GLOB_NOMATCH_ABORTED" >&5 -echo "${ECHO_T}$pkg_cv_GLOB_NOMATCH_ABORTED" >&6 - if test "x$pkg_cv_GLOB_NOMATCH_ABORTED" = "xyes"; then - pkg_use_nbcompat_glob=no - else - - : - fi - - -if test $pkg_use_nbcompat_glob = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_NBCOMPAT_GLOB 1 -_ACEOF - - - - LIBOBJS="$LIBOBJS glob.$ac_objext" -fi - - if test $ac_cv_type_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then diff --git a/pkgtools/libnbcompat/files/configure.ac b/pkgtools/libnbcompat/files/configure.ac index 582b7cb861b..b07fd6d0930 100644 --- a/pkgtools/libnbcompat/files/configure.ac +++ b/pkgtools/libnbcompat/files/configure.ac @@ -1,4 +1,4 @@ -dnl $NetBSD: configure.ac,v 1.32 2003/12/08 14:52:02 grant Exp $ +dnl $NetBSD: configure.ac,v 1.33 2003/12/10 07:21:20 grant Exp $ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.52) @@ -33,7 +33,7 @@ AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS([arpa/nameser.h assert.h bind/bitypes.h dirent.h err.h \ - errno.h fcntl.h fts.h glob.h inttypes.h libutil.h limits.h \ + errno.h fcntl.h fts.h inttypes.h libutil.h limits.h \ machine/endian.h memory.h ndir.h netdb.h netinet/in6_machtypes.h \ paths.h poll.h pwd.h stdint.h stdlib.h stringlist.h strings.h \ string.h sys/bitypes.h sys/byteorder.h sys/cdefs.h sys/dir.h \ @@ -117,7 +117,7 @@ AC_FUNC_MALLOC AC_FUNC_STRERROR_R AC_FUNC_VPRINTF -AC_REPLACE_FUNCS([err fgetln fparseln fseeko getenv glob inet_ntop \ +AC_REPLACE_FUNCS([err fgetln fparseln fseeko getenv inet_ntop \ inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \ poll setprogname snprintf strdup strerror strlcat strlcpy \ strmode strptime strsep strtoll timegm usleep]) @@ -216,22 +216,6 @@ if test $pkg_use_nbcompat_statfs = yes; then AC_LIBOBJ(statfs) fi -pkg_use_nbcompat_glob=yes -AC_MSG_TRY_COMPILE([if GLOB_NOMATCH and GLOB_ABORTED are defined in glob.h], - pkg_cv_GLOB_NOMATCH_ABORTED, - [ #include ], - [ int f = GLOB_NOMATCH + GLOB_ABORTED ], - [ pkg_use_nbcompat_glob=no ]) - -if test $pkg_use_nbcompat_glob = yes; then - AC_DEFINE(HAVE_NBCOMPAT_GLOB, 1) - AH_TEMPLATE([HAVE_NBCOMPAT_GLOB], [ - Define to 1 if the `glob' function is built into the library. - ]) - AC_LIBOBJ(glob) -fi - - if test $ac_cv_type_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then dnl We assume that if sprintf() supports %lld or %qd, diff --git a/pkgtools/libnbcompat/files/dummy.c b/pkgtools/libnbcompat/files/dummy.c deleted file mode 100644 index dee24053621..00000000000 --- a/pkgtools/libnbcompat/files/dummy.c +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: dummy.c,v 1.1 2003/09/14 07:38:13 itohy Exp $ */ - -/* Written by ITOH Yasufumi in 2003. Public domain. */ -static int nbcompat_dummy; diff --git a/pkgtools/libnbcompat/files/nbcompat.h b/pkgtools/libnbcompat/files/nbcompat.h index 14910c29aff..69b855f1004 100644 --- a/pkgtools/libnbcompat/files/nbcompat.h +++ b/pkgtools/libnbcompat/files/nbcompat.h @@ -1,4 +1,4 @@ -/* $NetBSD: nbcompat.h,v 1.28 2003/12/08 14:52:02 grant Exp $ */ +/* $NetBSD: nbcompat.h,v 1.29 2003/12/10 07:21:20 grant Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -225,17 +225,11 @@ struct { \ # include #endif -#if HAVE_NBCOMPAT_GLOB -# if HAVE_GLOB_H -# undef HAVE_GLOB_H -# endif -#endif - +/* always use our glob.h */ #if HAVE_GLOB_H -# include -#else -# include +# undef HAVE_GLOB_H #endif +#include #if HAVE_SYS_MKDEV_H # include diff --git a/pkgtools/libnbcompat/files/nbcompat/config.h.in b/pkgtools/libnbcompat/files/nbcompat/config.h.in index 82d37406025..e0e8cedcf10 100644 --- a/pkgtools/libnbcompat/files/nbcompat/config.h.in +++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in @@ -70,12 +70,6 @@ /* Define to 1 if you have the `gid_from_group' function. */ #undef HAVE_GID_FROM_GROUP -/* Define to 1 if you have the `glob' function. */ -#undef HAVE_GLOB - -/* Define to 1 if you have the header file. */ -#undef HAVE_GLOB_H - /* Define to 1 if you have the `group_from_gid' function. */ #undef HAVE_GROUP_FROM_GID @@ -158,9 +152,6 @@ /* Define to 1 if the `getopt_long' function is built into the library. */ #undef HAVE_NBCOMPAT_GETOPT_LONG -/* Define to 1 if the `glob' function is built into the library. */ -#undef HAVE_NBCOMPAT_GLOB - /* Define to 1 if the `MD5Init' function is built into the library. */ #undef HAVE_NBCOMPAT_MD5INIT -- cgit v1.2.3