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

2014-12-07 Thread Guy Harris

On Dec 6, 2014, at 11:44 PM, Loganaden Velvindron  wrote:

> On Sat, Dec 06, 2014 at 11:41:51PM -0800, Guy Harris wrote:
>> 
>> On Dec 6, 2014, at 9:19 PM, Loganaden Velvindron  wrote:
>> 
>>> 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_init'
>>> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>> 
>> So, in FreeBSD 10.1, is cap_rights_init() a function in libc, or is it a 
>> macro that calls a function with a different name? The linker seems to be 
>> indicating that it's not present in the standard library.
> 
> According to the man page, it's part of the standard libc:

And the answer is B) it's a macro that calls a function with a different name; 
from  in FreeBSD SVN:

#define cap_rights_init(...)
\
__cap_rights_init(CAP_RIGHTS_VERSION, __VA_ARGS__, 0ULL)
cap_rights_t *__cap_rights_init(int version, cap_rights_t *rights, ...);

The same is true of cap_rights_set, cap_rights_clear, and cap_rights_is_set, so 
we can't check *any* of them with AC_CHECK_FUNCS.

The only one we're checking for is cap_rights_init, though, so removing that 
from the list (with a comment explaining why we can't check for it) would 
suffice.
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


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

2014-12-07 Thread Loganaden Velvindron
On Sun, Dec 07, 2014 at 12:13:09AM -0800, Guy Harris wrote:
> 
> On Dec 6, 2014, at 11:44 PM, Loganaden Velvindron  wrote:
> 
> > On Sat, Dec 06, 2014 at 11:41:51PM -0800, Guy Harris wrote:
> >> 
> >> On Dec 6, 2014, at 9:19 PM, Loganaden Velvindron  
> >> wrote:
> >> 
> >>> 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_init'
> >>> cc: error: linker command failed with exit code 1 (use -v to see 
> >>> invocation)
> >> 
> >> So, in FreeBSD 10.1, is cap_rights_init() a function in libc, or is it a 
> >> macro that calls a function with a different name? The linker seems to be 
> >> indicating that it's not present in the standard library.
> > 
> > According to the man page, it's part of the standard libc:
> 
> And the answer is B) it's a macro that calls a function with a different 
> name; from  in FreeBSD SVN:
> 
>   #define cap_rights_init(...)
> \
>   __cap_rights_init(CAP_RIGHTS_VERSION, __VA_ARGS__, 0ULL)
>   cap_rights_t *__cap_rights_init(int version, cap_rights_t *rights, ...);
> 
> The same is true of cap_rights_set, cap_rights_clear, and cap_rights_is_set, 
> so we can't check *any* of them with AC_CHECK_FUNCS.
> 
> The only one we're checking for is cap_rights_init, though, so removing that 
> from the list (with a comment explaining why we can't check for it) would 
> suffice.

When I checked using "strings", the function is __cap_rights_init() :-)

Here's the diff:

index d0e90dd..1620bbb 100644
--- a/configure.in
+++ b/configure.in
@@ -207,8 +207,10 @@ AC_ARG_WITH(sandbox-capsicum,
 #
 # All of them must be available in order to enable capsicum sandboxing.
 #
+# NOTE: cap_rights_init is a macro on FreeBSD, so remove it from the list.
+
 if test ! -z "$with_sandbox-capsicum" && test "$with_sandbox-capsicum" != "no" 
; then
-   AC_CHECK_FUNCS(cap_enter cap_rights_init cap_rights_limit 
cap_ioctls_limit openat,
+   AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat,
ac_lbl_capsicum_function_seen=yes,
ac_lbl_capsicum_function_not_seen=yes)
 fi
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers