From owner-p4-projects@FreeBSD.ORG Thu Feb 12 16:40:51 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3EF03106566C; Thu, 12 Feb 2009 16:40:51 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1D75106564A for ; Thu, 12 Feb 2009 16:40:50 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E086D8FC08 for ; Thu, 12 Feb 2009 16:40:50 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n1CGeoZR068685 for ; Thu, 12 Feb 2009 16:40:50 GMT (envelope-from sson@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n1CGeo8r068683 for perforce@freebsd.org; Thu, 12 Feb 2009 16:40:50 GMT (envelope-from sson@FreeBSD.org) Date: Thu, 12 Feb 2009 16:40:50 GMT Message-Id: <200902121640.n1CGeo8r068683@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sson@FreeBSD.org using -f From: Stacey Son To: Perforce Change Reviews Cc: Subject: PERFORCE change 157598 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2009 16:40:52 -0000 http://perforce.freebsd.org/chv.cgi?CH=157598 Change 157598 by sson@sson_amd64 on 2009/02/12 16:40:16 On Mac OS X use setaudit_addr() instead of setaudit(). Affected files ... .. //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#5 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#5 (text+ko) ==== @@ -26,7 +26,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/libauditd/auditd_lib.c#4 $ + * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#5 $ */ #include @@ -814,9 +814,31 @@ * ADE_NOERR on success, * ADE_SETAUDIT if setaudit(2) fails. */ +#ifdef __APPLE__ int auditd_prevent_audit(void) { + auditinfo_addr_t aia; + + /* + * To prevent event feedback cycles and avoid audit becoming stalled if + * auditing is suspended we mask this processes events from being + * audited. We allow the uid, tid, and mask fields to be implicitly + * set to zero, but do set the audit session ID to the PID. + * + * XXXRW: Is there more to it than this? + */ + bzero(&aia, sizeof(aia)); + aia.ai_asid = AU_ASSIGN_ASID; + aia.ai_termid.at_type = AU_IPv4; + if (setaudit_addr(&aia, sizeof(aia)) != 0) + return (ADE_SETAUDIT); + return (ADE_NOERR); +} +#else +int +auditd_prevent_audit(void) +{ auditinfo_t ai; /* @@ -833,6 +855,7 @@ return (ADE_SETAUDIT); return (ADE_NOERR); } +#endif /* __APPLE__ */ /* * Generate and submit audit record for audit startup or shutdown. The event