Date: Fri, 19 Dec 2008 12:42:57 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 154996 for review Message-ID: <200812191242.mBJCgvYo097607@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=154996 Change 154996 by rwatson@rwatson_cinnamon on 2008/12/19 12:42:02 Don't use sys/endian.h unless be32enc becomes available as a result of including it; FreeBSD 4.x's sys/endian.h is not capable enough to meet our requirements, so must use our compat/endian.h there. Affected files ... .. //depot/projects/trustedbsd/openbsm/config/config.h.in#16 edit .. //depot/projects/trustedbsd/openbsm/configure#45 edit .. //depot/projects/trustedbsd/openbsm/configure.ac#47 edit .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#59 edit .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#85 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/config/config.h.in#16 (text+ko) ==== @@ -6,6 +6,9 @@ /* Define if audit system calls present */ #undef HAVE_AUDIT_SYSCALLS +/* Define if be32enc is present */ +#undef HAVE_BE32ENC + /* Define to 1 if you have the `bzero' function. */ #undef HAVE_BZERO ==== //depot/projects/trustedbsd/openbsm/configure#45 (xtext) ==== @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#45 . +# From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#46 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for OpenBSM 1.1alpha4. # @@ -23032,6 +23032,66 @@ fi +# +# There are a wide variety of endian macros and functions in the wild; we try +# to use the native support if it defines be32enc(), but otherwise have to +# use our own. +# +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <sys/endian.h> + #include <stdlib.h> + +int +main () +{ + + be32enc(NULL, 1); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BE32ENC +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + # Check to see if Mach IPC is used for trigger messages. If so, use Mach IPC # instead of the default for sending trigger messages to the audit components. { echo "$as_me:$LINENO: checking for /usr/include/mach/audit_triggers.defs" >&5 ==== //depot/projects/trustedbsd/openbsm/configure.ac#47 (text+ko) ==== @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_INIT([OpenBSM], [1.1alpha4], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) -AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#46 $]) +AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#47 $]) AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_HEADER([config/config.h]) @@ -121,6 +121,20 @@ ]) AM_CONDITIONAL(HAVE_AUDIT_SYSCALLS, $have_audit_syscalls) +# +# There are a wide variety of endian macros and functions in the wild; we try +# to use the native support if it defines be32enc(), but otherwise have to +# use our own. +# +AC_TRY_LINK([ + #include <sys/endian.h> + #include <stdlib.h> +], [ + be32enc(NULL, 1); +], [ +AC_DEFINE(HAVE_BE32ENC,, Define if be32enc is present) +]) + # Check to see if Mach IPC is used for trigger messages. If so, use Mach IPC # instead of the default for sending trigger messages to the audit components. AC_CHECK_FILE([/usr/include/mach/audit_triggers.defs], [ ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#59 (text+ko) ==== @@ -32,15 +32,15 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#58 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#59 $ */ #include <sys/types.h> #include <config/config.h> -#ifdef HAVE_SYS_ENDIAN_H +#if defined(HAVE_SYS_ENDIAN_H) && defined(HAVE_BE32ENC) #include <sys/endian.h> -#else /* !HAVE_SYS_ENDIAN_H */ +#else /* !HAVE_SYS_ENDIAN_H || !HAVE_BE32ENC */ #ifdef HAVE_MACHINE_ENDIAN_H #include <machine/endian.h> #else /* !HAVE_MACHINE_ENDIAN_H */ @@ -51,7 +51,7 @@ #endif /* !HAVE_ENDIAN_H */ #endif /* !HAVE_MACHINE_ENDIAN_H */ #include <compat/endian.h> -#endif /* !HAVE_SYS_ENDIAN_H */ +#endif /* !HAVE_SYS_ENDIAN_H || !HAVE_BE32ENC */ #ifdef HAVE_FULL_QUEUE_H #include <sys/queue.h> #else /* !HAVE_FULL_QUEUE_H */ ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#85 (text+ko) ==== @@ -30,15 +30,15 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#84 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#85 $ */ #include <sys/types.h> #include <config/config.h> -#ifdef HAVE_SYS_ENDIAN_H +#if defined(HAVE_SYS_ENDIAN_H) && defined(HAVE_BE32ENC) #include <sys/endian.h> -#else /* !HAVE_SYS_ENDIAN_H */ +#else /* !HAVE_SYS_ENDIAN_H || !HAVE_BE32ENC */ #ifdef HAVE_MACHINE_ENDIAN_H #include <machine/endian.h> #else /* !HAVE_MACHINE_ENDIAN_H */ @@ -49,7 +49,7 @@ #endif /* !HAVE_ENDIAN_H */ #endif /* !HAVE_MACHINE_ENDIAN_H */ #include <compat/endian.h> -#endif /* !HAVE_SYS_ENDIAN_H */ +#endif /* !HAVE_SYS_ENDIAN_H || !HAVE_BE32ENC */ #ifdef HAVE_FULL_QUEUE_H #include <sys/queue.h> #else /* !HAVE_FULL_QUEUE_H */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812191242.mBJCgvYo097607>