From: wessels <> Date: Tue, 30 Dec 1997 09:49:40 +0000 (+0000) Subject: more thorough check for setresuid(); esp needed on linux X-Git-Tag: SQUID_3_0_PRE1~4340 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=609399271f1fe02e691838f540bade09bb1807c1;p=thirdparty%2Fsquid.git more thorough check for setresuid(); esp needed on linux --- diff --git a/configure b/configure index 3ffd83a1e1..4c280564fa 100755 --- a/configure +++ b/configure @@ -2929,7 +2929,6 @@ for ac_func in \ res_init \ seteuid \ setpgrp \ - setresuid \ setrlimit \ setsid \ sigaction \ @@ -2944,12 +2943,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2948: checking for $ac_func" >&5 +echo "configure:2947: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3005,8 +3004,49 @@ case "$host" in ;; esac +echo $ac_n "checking if setresuid is implemented""... $ac_c" 1>&6 +echo "configure:3009: checking if setresuid is implemented" >&5 +if eval "test \"`echo '$''{'ac_cv_func_setresuid'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < +int +main() +{ + if (setresuid(-1, -1, -1)) { + perror("setresuid:"); + exit(1); + } + exit(0); +} + +EOF +if { (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_func_setresuid="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_setresuid="no" +fi +rm -fr conftest* +fi + + +fi + +echo "$ac_t""$ac_cv_func_setresuid" 1>&6 + echo $ac_n "checking if GNUregex needs to be compiled""... $ac_c" 1>&6 -echo "configure:3010: checking if GNUregex needs to be compiled" >&5 +echo "configure:3050: checking if GNUregex needs to be compiled" >&5 if test "$ac_cv_func_regcomp" = "no" ; then USE_GNUREGEX="yes" else @@ -3038,12 +3078,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3042: checking for $ac_func" >&5 +echo "configure:3082: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3094,12 +3134,12 @@ done echo $ac_n "checking Default FD_SETSIZE value""... $ac_c" 1>&6 -echo "configure:3098: checking Default FD_SETSIZE value" >&5 +echo "configure:3138: checking Default FD_SETSIZE value" >&5 if test "$cross_compiling" = yes; then DEFAULT_FD_SETSIZE=256 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then DEFAULT_FD_SETSIZE=`cat conftestval` else @@ -3142,12 +3182,12 @@ EOF echo $ac_n "checking Maximum number of filedescriptors we can open""... $ac_c" 1>&6 -echo "configure:3146: checking Maximum number of filedescriptors we can open" >&5 +echo "configure:3186: checking Maximum number of filedescriptors we can open" >&5 if test "$cross_compiling" = yes; then SQUID_MAXFD=256 else cat > conftest.$ac_ext < @@ -3199,7 +3239,7 @@ main() { } EOF -if { (eval echo configure:3203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_MAXFD=`cat conftestval` else @@ -3218,12 +3258,12 @@ EOF echo $ac_n "checking Default UDP send buffer size""... $ac_c" 1>&6 -echo "configure:3222: checking Default UDP send buffer size" >&5 +echo "configure:3262: checking Default UDP send buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_UDP_SO_SNDBUF=16384 else cat > conftest.$ac_ext < @@ -3242,7 +3282,7 @@ main () } EOF -if { (eval echo configure:3246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_UDP_SO_SNDBUF=`cat conftestval` else @@ -3261,12 +3301,12 @@ EOF echo $ac_n "checking Default UDP receive buffer size""... $ac_c" 1>&6 -echo "configure:3265: checking Default UDP receive buffer size" >&5 +echo "configure:3305: checking Default UDP receive buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_UDP_SO_RCVBUF=16384 else cat > conftest.$ac_ext < @@ -3285,7 +3325,7 @@ main () } EOF -if { (eval echo configure:3289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_UDP_SO_RCVBUF=`cat conftestval` else @@ -3304,12 +3344,12 @@ EOF echo $ac_n "checking Default TCP send buffer size""... $ac_c" 1>&6 -echo "configure:3308: checking Default TCP send buffer size" >&5 +echo "configure:3348: checking Default TCP send buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_TCP_SO_SNDBUF=16384 else cat > conftest.$ac_ext < @@ -3328,7 +3368,7 @@ main () } EOF -if { (eval echo configure:3332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_TCP_SO_SNDBUF=`cat conftestval` else @@ -3347,12 +3387,12 @@ EOF echo $ac_n "checking Default TCP receive buffer size""... $ac_c" 1>&6 -echo "configure:3351: checking Default TCP receive buffer size" >&5 +echo "configure:3391: checking Default TCP receive buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_TCP_SO_RCVBUF=16384 else cat > conftest.$ac_ext < @@ -3371,7 +3411,7 @@ main () } EOF -if { (eval echo configure:3375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_TCP_SO_RCVBUF=`cat conftestval` else @@ -3390,16 +3430,16 @@ EOF echo $ac_n "checking if sys_errlist is already defined""... $ac_c" 1>&6 -echo "configure:3394: checking if sys_errlist is already defined" >&5 +echo "configure:3434: checking if sys_errlist is already defined" >&5 cat > conftest.$ac_ext < int main() { char *s = sys_errlist[0]; ; return 0; } EOF -if { (eval echo configure:3403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3443: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3415,16 +3455,16 @@ fi rm -f conftest* echo $ac_n "checking for libresolv _dns_ttl_ hack""... $ac_c" 1>&6 -echo "configure:3419: checking for libresolv _dns_ttl_ hack" >&5 +echo "configure:3459: checking for libresolv _dns_ttl_ hack" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF diff --git a/configure.in b/configure.in index 479b3c80df..621d285f23 100644 --- a/configure.in +++ b/configure.in @@ -3,13 +3,13 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.84 1997/12/06 05:45:24 wessels Exp $ +dnl $Id: configure.in,v 1.85 1997/12/30 02:49:41 wessels Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.84 $)dnl +AC_REVISION($Revision: 1.85 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(aux) @@ -335,7 +335,6 @@ AC_CHECK_FUNCS(\ res_init \ seteuid \ setpgrp \ - setresuid \ setrlimit \ setsid \ sigaction \ @@ -357,6 +356,25 @@ case "$host" in ;; esac +dnl Yay! Another Linux brokenness. Its not good enough +dnl to know that setresuid() exists, because RedHat 5.0 declares +dnl setresuid() but doesn't implement it. +dnl +AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid, +AC_TRY_RUN([ +#include +int +main() +{ + if (setresuid(-1, -1, -1)) { + perror("setresuid:"); + exit(1); + } + exit(0); +} +],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no") +) + AC_MSG_CHECKING(if GNUregex needs to be compiled) if test "$ac_cv_func_regcomp" = "no" ; then USE_GNUREGEX="yes" diff --git a/include/autoconf.h.in b/include/autoconf.h.in index 12d5c6b7a1..64e5164d56 100644 --- a/include/autoconf.h.in +++ b/include/autoconf.h.in @@ -161,9 +161,6 @@ /* Define if you have the setpgrp function. */ #undef HAVE_SETPGRP -/* Define if you have the setresuid function. */ -#undef HAVE_SETRESUID - /* Define if you have the setrlimit function. */ #undef HAVE_SETRLIMIT