[tcpdump-workers] Fix FreeBSD capsicum build on FreeBSD 10.1

Loganaden Velvindron logan at elandsys.com
Sun Dec 7 00:19:49 EST 2014


On Sat, Dec 06, 2014 at 12:40:57PM -0800, Guy Harris wrote:
> 
> On Dec 6, 2014, at 6:51 AM, Loganaden Velvindron <logan at elandsys.com> wrote:
> 
> > Support for FreeBSD capsicum doesn't work on FreeBSD 10.1, due to 
> > cap_rights_init which returns a struct, instead of an int.
> 
> Did its return value change in FreeBSD 10?  (Presumably it didn't change between 10 and 10.1.)
> 

No it didn't.

> > I think that we should follow OpenSSH and not test cap_rights_init.
> 
> If there are no systems that offer Capsicum but that don't have cap_rights_init(), there's no need to check for it.

Agreed.

> 
> The comment there is
> 
> #
> # Check whether various functions are available.  If any are, set
> # ac_lbl_capsicum_function_seen to yes; if any are not, set
> # ac_lbl_capsicum_function_not_seen to yes.
> #
> # All of them must be available in order to enable capsicum sandboxing.
> #
> 
> but, if there aren't any systems that have some but not all, testing for all of them is overkill.
> 
> However, AC_CHECK_FUNCS is intended not to care what type a function returns - unless a header is included that declares a function, it gets declared within the test program as returning char, so the compiler shouldn't choke on returning its value from main().  Is this failing due to the *linker* rejecting it because of mismatched function signatures?
> 

Here's the config.log output:

configure:4540: checking for cap_rights_init
configure:4540: cc -o conftest -g -O2   conftest.c  >&5
/tmp/conftest-942ee0.o: In function `main':
/root/tcpdump/tcpdump-4.6.2/conftest.c:66: undefined reference to `cap_rights_in
it'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
configure:4540: $? = 1
configure: failed program was:
| /* Define cap_rights_init to an innocuous variant, in case <limits.h> declares
 cap_rights_init.
|    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
| #define cap_rights_init innocuous_cap_rights_init
| 
| /* System header to define __stub macros and hopefully few prototypes,
|     which can conflict with char cap_rights_init (); below.
|     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|     <limits.h> exists even on freestanding compilers.  */
| 
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| 
| #undef cap_rights_init

| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char cap_rights_init ();
| /* The GNU C library defines this for functions which it implements
|     to always fail with ENOSYS.  Some functions are actually named
|     something starting with __ and the normal name is an alias.  */
| #if defined __stub_cap_rights_init || defined __stub___cap_rights_init
| choke me
| #endif
| 
| int
| main ()
| {
| return cap_rights_init ();
|   ;
|   return 0;
| }
configure:4540: result: no


More information about the tcpdump-workers mailing list