From owner-trustedbsd-cvs@FreeBSD.ORG Sun Mar 5 15:45:27 2006 Return-Path: X-Original-To: trustedbsd-cvs@freebsd.org Delivered-To: trustedbsd-cvs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2222316A422 for ; Sun, 5 Mar 2006 15:45:27 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 887F043D45 for ; Sun, 5 Mar 2006 15:45:26 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by cyrus.watson.org (Postfix) with ESMTP id B0F9D46BA2 for ; Sun, 5 Mar 2006 10:45:05 -0500 (EST) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 46E6A55928; Sun, 5 Mar 2006 15:45:25 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 339FB16A423; Sun, 5 Mar 2006 15:45:25 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0CCEE16A420 for ; Sun, 5 Mar 2006 15:45:25 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD2DD43D45 for ; Sun, 5 Mar 2006 15:45:24 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k25FjOxA060475 for ; Sun, 5 Mar 2006 15:45:24 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k25FjOtq060472 for perforce@freebsd.org; Sun, 5 Mar 2006 15:45:24 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sun, 5 Mar 2006 15:45:24 GMT Message-Id: <200603051545.k25FjOtq060472@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 92789 for review X-BeenThere: trustedbsd-cvs@FreeBSD.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: TrustedBSD CVS and Perforce commit message list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Mar 2006 15:45:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=92789 Change 92789 by rwatson@rwatson_peppercorn on 2006/03/05 15:45:02 Define a new API, au_to_header32_tm(), which adds a struct timeval argument to the ordinary au_to_header32(), which is now implemented by wrapping au_to_header32_tm() and calling gettimeofday(). #ifndef KERNEL the APIs that invoke gettimeofday(), rather than having a variable definition. Don't try to retrieve time zone information using gettimeofday(), as it's not needed, and introduces possible failure modes. Affected files ... .. //depot/projects/trustedbsd/openbsm/HISTORY#5 edit .. //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#16 edit .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_audit.c#26 edit .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#45 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/HISTORY#5 (text+ko) ==== @@ -13,6 +13,13 @@ - Modify au_to_file() so that it accepts a timeval in user space, not just kernel -- this is not a Solaris BSM API so can be modified without causing compatibility issues. +- Define a new API, au_to_header32_tm(), which adds a struct timeval + argument to the ordinary au_to_header32(), which is now implemented by + wrapping au_to_header32_tm() and calling gettimeofday(). #ifndef KERNEL + the APIs that invoke gettimeofday(), rather than having a variable + definition. Don't try to retrieve time zone information using + gettimeofday(), as it's not needed, and introduces possible failure + modes. OpenBSM 1.0 alpha 5 @@ -140,4 +147,4 @@ to support reloading of kernel event table. - Allow comments in /etc/security configuration files. -$P4: //depot/projects/trustedbsd/openbsm/HISTORY#4 $ +$P4: //depot/projects/trustedbsd/openbsm/HISTORY#5 $ ==== //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#16 (text+ko) ==== @@ -30,7 +30,7 @@ * * @APPLE_BSD_LICENSE_HEADER_END@ * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#15 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#16 $ */ #ifndef _BSM_AUDIT_RECORD_H_ @@ -240,17 +240,14 @@ token_t *au_to_file(char *file, struct timeval tm); -#if defined(KERNEL) || defined(_KERNEL) -token_t *au_to_header(int rec_size, au_event_t e_type, au_emod_t e_mod, +token_t *au_to_header32_tm(int rec_size, au_event_t e_type, au_emod_t e_mod, struct timeval tm); -token_t *au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod, - struct timeval tm); -#else +#if !defined(KERNEL) && !defined(_KERNEL) token_t *au_to_header(int rec_size, au_event_t e_type, au_emod_t e_mod); token_t *au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod); +token_t *au_to_header64(int rec_size, au_event_t e_type, au_emod_t e_mod); #endif -token_t *au_to_header64(int rec_size, au_event_t e_type, au_emod_t e_mod); token_t *au_to_me(void); token_t *au_to_arg(char n, char *text, uint32_t v); token_t *au_to_arg32(char n, char *text, uint32_t v); ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_audit.c#26 (text+ko) ==== @@ -30,7 +30,7 @@ * 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_audit.c#25 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_audit.c#26 $ */ #include ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#45 (text+ko) ==== @@ -30,7 +30,7 @@ * 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#44 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#45 $ */ #include @@ -1112,24 +1112,13 @@ * milliseconds of time 4 bytes/8 bytes (32-bit/64-bit value) */ token_t * -#if defined(KERNEL) || defined(_KERNEL) -au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod, +au_to_header32_tm(int rec_size, au_event_t e_type, au_emod_t e_mod, struct timeval tm) -#else -au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod) -#endif { token_t *t; u_char *dptr = NULL; u_int32_t timems; -#if !defined(KERNEL) && !defined(_KERNEL) - struct timeval tm; - struct timezone tzp; - if (gettimeofday(&tm, &tzp) == -1) - return (NULL); -#endif - GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int32_t) + sizeof(u_char) + 2 * sizeof(u_int16_t) + 2 * sizeof(u_int32_t)); if (t == NULL) @@ -1149,7 +1138,18 @@ return (t); } +#if !defined(KERNEL) && !defined(_KERNEL) token_t * +au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod) +{ + struct timeval tm; + + if (gettimeofday(&tm, NULL) == -1) + return (NULL); + return (au_to_header32_tm(rec_size, e_type, e_mod, tm)); +} + +token_t * au_to_header64(__unused int rec_size, __unused au_event_t e_type, __unused au_emod_t e_mod) { @@ -1164,6 +1164,7 @@ return (au_to_header32(rec_size, e_type, e_mod)); } +#endif /* * token ID 1 byte