From 8026ad6a97272b5203f218d3c6ab6d1a337f00a7 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 8 Apr 2012 19:40:03 -0400 Subject: [PATCH] Do not use GLOB_BRACE or GLOB_TILDE flags to glob()--we want the glob() and fnmatch() results to be consistent. --HG-- branch : 1.7 --- config.h.in | 3 --- configure | 49 +------------------------------------------------ configure.in | 7 +------ match.c | 11 +++++------ 4 files changed, 7 insertions(+), 63 deletions(-) diff --git a/config.h.in b/config.h.in index 7abf45feb..5372a1fbb 100644 --- a/config.h.in +++ b/config.h.in @@ -111,9 +111,6 @@ /* Define to 1 if you have the 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 diff --git a/configure b/configure index 8eabbcd49..412e708e5 100755 --- 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 @@ -16544,52 +16544,6 @@ fi 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 -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 - diff --git a/configure.in b/configure.in index 2d94a854c..fbc4c4f21 100644 --- a/configure.in +++ b/configure.in @@ -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 ]], [[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 40d93ba46..b150b5e7b 100644 --- a/match.c +++ b/match.c @@ -48,9 +48,9 @@ #ifdef HAVE_FNMATCH # include #endif /* HAVE_FNMATCH */ -#ifdef HAVE_EXTENDED_GLOB +#ifdef HAVE_GLOB # include -#endif /* HAVE_EXTENDED_GLOB */ +#endif /* HAVE_GLOB */ #ifdef HAVE_NETGROUP_H # include #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; } -- 2.40.0