--------------------- PatchSet 11622 Date: 2007/09/01 20:09:50 Author: hno Branch: SQUID_2_6 Tag: (none) Log: MFC: Test for sys/capability.h linux include file to avoid failing on systems missing libcap not all Linux systems have libcap development files installed.. Merged changes: 2007/08/31 21:58:40 hno +14 -5 Test for sys/capability.h linux include file to avoid failing on systems missing libcap Members: configure.in:1.416.2.18->1.416.2.19 src/tools.c:1.250.2.2->1.250.2.3 Index: squid/configure.in =================================================================== RCS file: /cvsroot/squid/squid/configure.in,v retrieving revision 1.416.2.18 retrieving revision 1.416.2.19 diff -u -r1.416.2.18 -r1.416.2.19 --- squid/configure.in 31 Aug 2007 14:48:33 -0000 1.416.2.18 +++ squid/configure.in 1 Sep 2007 20:09:50 -0000 1.416.2.19 @@ -1,7 +1,7 @@ dnl dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.416.2.18 2007/08/31 14:48:33 hno Exp $ +dnl $Id: configure.in,v 1.416.2.19 2007/09/01 20:09:50 hno Exp $ dnl dnl dnl @@ -10,7 +10,7 @@ AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE -AC_REVISION($Revision: 1.416.2.18 $)dnl +AC_REVISION($Revision: 1.416.2.19 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -1665,6 +1665,7 @@ db.h \ db_185.h \ aio.h \ + sys/capability.h \ ,,,[ #if HAVE_SYS_TYPES_H #include Index: squid/src/tools.c =================================================================== RCS file: /cvsroot/squid/squid/src/tools.c,v retrieving revision 1.250.2.2 retrieving revision 1.250.2.3 diff -u -r1.250.2.2 -r1.250.2.3 --- squid/src/tools.c 31 Aug 2007 13:44:00 -0000 1.250.2.2 +++ squid/src/tools.c 1 Sep 2007 20:09:50 -0000 1.250.2.3 @@ -1,6 +1,6 @@ /* - * $Id: tools.c,v 1.250.2.2 2007/08/31 13:44:00 hno Exp $ + * $Id: tools.c,v 1.250.2.3 2007/09/01 20:09:50 hno Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -41,6 +41,7 @@ #include "squid.h" #ifdef _SQUID_LINUX_ +#if HAVE_SYS_CAPABILITY_H #undef _POSIX_SOURCE /* Ugly glue to get around linux header madness colliding with glibc */ #define _LINUX_TYPES_H @@ -48,6 +49,7 @@ typedef uint32_t __u32; #include #endif +#endif #if HAVE_SYS_PRCTL_H #include @@ -1319,7 +1321,7 @@ void keepCapabilities(void) { -#if HAVE_PRCTL && defined(PR_SET_KEEPCAPS) +#if HAVE_PRCTL && defined(PR_SET_KEEPCAPS) && HAVE_SYS_CAPABILITY_H if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) { /* Silent failure unless TPROXY is required. Maybe not started as root */ #if LINUX_TPROXY @@ -1334,7 +1336,7 @@ static void restoreCapabilities(int keep) { -#ifdef _SQUID_LINUX_ +#if defined(_SQUID_LINUX_) && HAVE_SYS_CAPABILITY_H cap_user_header_t head = (cap_user_header_t) xcalloc(1, sizeof(cap_user_header_t)); cap_user_data_t cap = (cap_user_data_t) xcalloc(1, sizeof(cap_user_data_t)); @@ -1368,5 +1370,11 @@ nocap: xfree(head); xfree(cap); +#else +#if LINUX_TPROXY + if (need_linux_tproxy) + debug(50, 1) ("Missing needed capability support. Will continue without tproxy support\n"); + need_linux_tproxy = 0; +#endif #endif }