From 0d108287b9ae8beedfdf346de16b63d18558e91f Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 8 Apr 2012 18:00:31 -0400 Subject: [PATCH] Do not use GLOB_BRACE or GLOB_TILDE flags to glob()--we want the glob() and fnmatch() results to be consistent. --- compat/regress/glob/globtest.c | 2 +- config.h.in | 3 -- configure | 52 +--------------------------------- configure.in | 10 +------ plugins/sudoers/match.c | 11 ++++--- 5 files changed, 8 insertions(+), 70 deletions(-) diff --git a/compat/regress/glob/globtest.c b/compat/regress/glob/globtest.c index 70de67caf..b4f61f24b 100644 --- a/compat/regress/glob/globtest.c +++ b/compat/regress/glob/globtest.c @@ -14,7 +14,7 @@ #ifdef HAVE_STRINGS_H # include #endif /* HAVE_STRINGS_H */ -#ifdef HAVE_EXTENDED_GLOB +#ifdef HAVE_GLOB # include #else # include "compat/glob.h" diff --git a/config.h.in b/config.h.in index 7be0d1a9d..45211d83c 100644 --- a/config.h.in +++ b/config.h.in @@ -115,9 +115,6 @@ /* Define to 1 if you have the `dlopen' function. */ #undef HAVE_DLOPEN -/* 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 083d2cb97..7584a798b 100755 --- a/configure +++ b/configure @@ -16388,7 +16388,7 @@ $as_echo "#define HAVE_GETGROUPS 1" >>confdefs.h fi LIBS=$ac_save_LIBS -for ac_func in strrchr sysconf tzset strftime setenv \ +for ac_func in glob strrchr sysconf tzset strftime setenv \ regcomp setlocale nl_langinfo mbr_check_membership \ setrlimit64 do : @@ -16898,55 +16898,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 - - COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }globtest" - { $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 - - COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }globtest" - -fi -done - for ac_func in lockf flock do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -22439,6 +22390,5 @@ fi - diff --git a/configure.in b/configure.in index 58f771097..14bfe25f6 100644 --- a/configure.in +++ b/configure.in @@ -2127,7 +2127,7 @@ dnl dnl Function checks dnl AC_FUNC_GETGROUPS -AC_CHECK_FUNCS(strrchr sysconf tzset strftime setenv \ +AC_CHECK_FUNCS(glob strrchr sysconf tzset strftime setenv \ regcomp setlocale nl_langinfo mbr_check_membership \ setrlimit64) AC_REPLACE_FUNCS(getgrouplist) @@ -2214,13 +2214,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) - COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }globtest" - AC_MSG_RESULT(no)])], [AC_LIBOBJ(glob)] - COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }globtest" - ) AC_CHECK_FUNCS(lockf flock, [break]) AC_CHECK_FUNCS(innetgr _innetgr, [AC_CHECK_FUNCS(getdomainname) [break]]) AC_CHECK_FUNCS(utimes, [AC_CHECK_FUNCS(futimes futimesat, [break])], [AC_CHECK_FUNCS(futime) AC_LIBOBJ(utimes)]) @@ -3303,7 +3296,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_DISPCRYPT, [Define to 1 if you have the `dispcrypt' function.]) AH_TEMPLATE(HAVE_DLOPEN, [Define to 1 if you have the `dlopen' 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/plugins/sudoers/match.c b/plugins/sudoers/match.c index 0fcf57dc0..f0c5dc1ad 100644 --- a/plugins/sudoers/match.c +++ b/plugins/sudoers/match.c @@ -47,9 +47,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 */ @@ -81,9 +81,9 @@ #ifndef HAVE_FNMATCH # include "compat/fnmatch.h" #endif /* HAVE_FNMATCH */ -#ifndef HAVE_EXTENDED_GLOB +#ifndef HAVE_GLOB # include "compat/glob.h" -#endif /* HAVE_EXTENDED_GLOB */ +#endif /* HAVE_GLOB */ static struct member_list empty; @@ -477,8 +477,7 @@ command_matches_glob(char *sudoers_cmnd, char *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); debug_return_bool(false); } -- 2.40.0