Re: [PATCH] Re: glibc and getgrouplist



Leonard den Ottolander wrote:
 AC_CHECK_FUNCS([atoll cfgetospeed getsid initgroups memcpy memmove memset \
 		putenv setreuid setuid statfs strerror strftime \
-		sysconf tcgetattr tcsetattr truncate getgrouplist])
+		sysconf tcgetattr tcsetattr truncate])
+
+dnl The GNU libc, versions < 2.3.3 have a buffer overflow in the getgrouplist(3)
+dnl function, so we cannot use that function.
+AC_ARG_WITH(getgrouplist, + [ --with-getgrouplist Force using getgrouplist on patched glibc systems [[no]]])
+if test "x$with_getgrouplist" == "xyes"; then

"==" is only valid for the bash. For portable programs, please use "=".

+    AC_CHECK_FUNCS([getgrouplist])
+else
+    AC_MSG_CHECKING([for glibc version])
+    AC_LINK_IFELSE([
+    #include <gnu/libc-version.h>
+    #include <stdio.h>
+int main(void) {
+    return puts(gnu_get_libc_version());
+}
+    ], [
+    mc_glibc_version=`./conftest$ac_exeext`
+    if [ strverscmp(${mc_glibc_version}, "2.3.3") >= 0 ]; then

Have you tried to run this patch? You're in the shell here, and the >= operator is interpreted as redirection.

+        AC_CHECK_FUNCS([getgrouplist])
+    fi
+    AC_MSG_RESULT([${mc_glibc_version}])
+    ], [
+    AC_CHECK_FUNCS([getgrouplist])
+    AC_MSG_RESULT([none])
+    ])
+fi

Roland



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]