]> granicus.if.org Git - sudo/commitdiff
Do not use GLOB_BRACE or GLOB_TILDE flags to glob()--we want the
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 8 Apr 2012 23:40:03 +0000 (19:40 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 8 Apr 2012 23:40:03 +0000 (19:40 -0400)
glob() and fnmatch() results to be consistent.

--HG--
branch : 1.7

config.h.in
configure
configure.in
match.c

index 7abf45feb191e44949ff4fc779718d240b85969b..5372a1fbb1fb3484ad598627a87271eeb14a24ab 100644 (file)
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
-/* Define to 1 if your glob.h defines the GLOB_BRACE and GLOB_TILDE flags. */
-#undef HAVE_EXTENDED_GLOB
-
 /* Define to 1 if your system has the F_CLOSEM fcntl. */
 #undef HAVE_FCNTL_CLOSEM
 
index 8eabbcd497439c2dd2495a9c4dafcb83b1b3e2f5..412e708e58edd77fd95851904d69e50b93761154 100755 (executable)
--- a/configure
+++ b/configure
@@ -16038,7 +16038,7 @@ $as_echo "#define HAVE_GETGROUPS 1" >>confdefs.h
 fi
 LIBS=$ac_save_LIBS
 
-for ac_func in strchr strrchr memchr memcpy memset sysconf tzset \
+for ac_func in glob strchr strrchr memchr memcpy memset sysconf tzset \
               strftime setrlimit initgroups getgroups fstat gettimeofday \
               regcomp setlocale nl_langinfo getaddrinfo setenv \
               mbr_check_membership setrlimit64
 
 
 fi
-for ac_func in glob
-do :
-  ac_fn_c_check_func "$LINENO" "glob" "ac_cv_func_glob"
-if test "x$ac_cv_func_glob" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GLOB 1
-_ACEOF
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_BRACE and GLOB_TILDE in glob.h" >&5
-$as_echo_n "checking for GLOB_BRACE and GLOB_TILDE in glob.h... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <glob.h>
-int
-main ()
-{
-int i = GLOB_BRACE | GLOB_TILDE; (void)i;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  $as_echo "#define HAVE_EXTENDED_GLOB 1" >>confdefs.h
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  case " $LIBOBJS " in
-  *" glob.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS glob.$ac_objext"
- ;;
-esac
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  case " $LIBOBJS " in
-  *" glob.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS glob.$ac_objext"
- ;;
-esac
-
-fi
-done
-
 for ac_func in lockf flock
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -22165,6 +22119,5 @@ fi
 
 
 
-
 
 
index 2d94a854ce0874ec6e8752034bd96822f77d1c7d..fbc4c4f217daf2bffa3d3433de3e66ccc97cbc19 100644 (file)
@@ -2009,7 +2009,7 @@ dnl
 dnl Function checks
 dnl
 AC_FUNC_GETGROUPS
-AC_CHECK_FUNCS(strchr strrchr memchr memcpy memset sysconf tzset \
+AC_CHECK_FUNCS(glob strchr strrchr memchr memcpy memset sysconf tzset \
               strftime setrlimit initgroups getgroups fstat gettimeofday \
               regcomp setlocale nl_langinfo getaddrinfo setenv \
               mbr_check_membership setrlimit64)
@@ -2086,10 +2086,6 @@ fi
 if test -z "$BROKEN_GETCWD"; then
     AC_REPLACE_FUNCS(getcwd)
 fi
-AC_CHECK_FUNCS(glob, [AC_MSG_CHECKING(for GLOB_BRACE and GLOB_TILDE in glob.h)
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <glob.h>]], [[int i = GLOB_BRACE | GLOB_TILDE; (void)i;]])], [AC_DEFINE(HAVE_EXTENDED_GLOB)
-    AC_MSG_RESULT(yes)], [AC_LIBOBJ(glob)
-    AC_MSG_RESULT(no)])], [AC_LIBOBJ(glob)])
 AC_CHECK_FUNCS(lockf flock, [break])
 AC_CHECK_FUNCS(waitpid wait3, [break])
 AC_CHECK_FUNCS(innetgr _innetgr, [AC_CHECK_FUNCS(getdomainname) [break]])
@@ -3109,7 +3105,6 @@ AH_TEMPLATE(HAVE_DD_FD, [Define to 1 if your `DIR' contains dd_fd.])
 AH_TEMPLATE(HAVE_DIRFD, [Define to 1 if you have the `dirfd' function or macro.])
 AH_TEMPLATE(HAVE_DGETTEXT, [Define to 1 if you have the `dgettext' function.])
 AH_TEMPLATE(HAVE_DISPCRYPT, [Define to 1 if you have the `dispcrypt' function.])
-AH_TEMPLATE(HAVE_EXTENDED_GLOB, [Define to 1 if your glob.h defines the GLOB_BRACE and GLOB_TILDE flags.])
 AH_TEMPLATE(HAVE_FCNTL_CLOSEM, [Define to 1 if your system has the F_CLOSEM fcntl.])
 AH_TEMPLATE(HAVE_FNMATCH, [Define to 1 if you have the `fnmatch' function.])
 AH_TEMPLATE(HAVE_FWTK, [Define to 1 if you use the FWTK authsrv daemon.])
diff --git a/match.c b/match.c
index 40d93ba46ea0d5327c6fb3cf38a509937a682fa2..b150b5e7bc65a5d40b4fc75e9cd1f4916a6b4513 100644 (file)
--- a/match.c
+++ b/match.c
@@ -48,9 +48,9 @@
 #ifdef HAVE_FNMATCH
 # include <fnmatch.h>
 #endif /* HAVE_FNMATCH */
-#ifdef HAVE_EXTENDED_GLOB
+#ifdef HAVE_GLOB
 # include <glob.h>
-#endif /* HAVE_EXTENDED_GLOB */
+#endif /* HAVE_GLOB */
 #ifdef HAVE_NETGROUP_H
 # include <netgroup.h>
 #endif /* HAVE_NETGROUP_H */
@@ -85,9 +85,9 @@
 #ifndef HAVE_FNMATCH
 # include "emul/fnmatch.h"
 #endif /* HAVE_FNMATCH */
-#ifndef HAVE_EXTENDED_GLOB
+#ifndef HAVE_GLOB
 # include "emul/glob.h"
-#endif /* HAVE_EXTENDED_GLOB */
+#endif /* HAVE_GLOB */
 #ifdef USING_NONUNIX_GROUPS
 # include "nonunix.h"
 #endif /* USING_NONUNIX_GROUPS */
@@ -492,8 +492,7 @@ command_matches_glob(sudoers_cmnd, sudoers_args)
      *  c) there are args in sudoers and on command line and they match
      * else return false.
      */
-#define GLOB_FLAGS     (GLOB_NOSORT | GLOB_BRACE | GLOB_TILDE)
-    if (glob(sudoers_cmnd, GLOB_FLAGS, NULL, &gl) != 0 || gl.gl_pathc == 0) {
+    if (glob(sudoers_cmnd, GLOB_NOSORT, NULL, &gl) != 0 || gl.gl_pathc == 0) {
        globfree(&gl);
        return FALSE;
     }