From owner-p4-projects@FreeBSD.ORG Sun Jun 19 13:49:31 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BD8C816A420; Sun, 19 Jun 2005 13:49:30 +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 998FA16A41C for ; Sun, 19 Jun 2005 13:49:30 +0000 (GMT) (envelope-from wsalamon@computer.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6B68843D1F for ; Sun, 19 Jun 2005 13:49:30 +0000 (GMT) (envelope-from wsalamon@computer.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j5JDnUHI039020 for ; Sun, 19 Jun 2005 13:49:30 GMT (envelope-from wsalamon@computer.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j5JDnU0Y039017 for perforce@freebsd.org; Sun, 19 Jun 2005 13:49:30 GMT (envelope-from wsalamon@computer.org) Date: Sun, 19 Jun 2005 13:49:30 GMT Message-Id: <200506191349.j5JDnU0Y039017@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to wsalamon@computer.org using -f From: Wayne Salamon To: Perforce Change Reviews Cc: Subject: PERFORCE change 78719 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: Sun, 19 Jun 2005 13:49:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=78719 Change 78719 by wsalamon@rickenbacker on 2005/06/19 13:48:50 Update auditd and audit command to use the new triggering facility in auditon() syscall. Affected files ... .. //depot/projects/trustedbsd/audit3/contrib/audit_supt/audit/audit.c#5 edit .. //depot/projects/trustedbsd/audit3/contrib/audit_supt/auditd/auditd.c#11 edit Differences ... ==== //depot/projects/trustedbsd/audit3/contrib/audit_supt/audit/audit.c#5 (text+ko) ==== @@ -6,13 +6,16 @@ * */ +#include +#include +#include + +#include + #include +#include #include -#include #include -#include -#include -#include void usage() { @@ -35,15 +38,15 @@ switch(ch) { case 'n': - trigger = AUDITD_TRIGGER_OPEN_NEW; + trigger = AUDIT_TRIGGER_OPEN_NEW; break; case 's': - trigger = AUDITD_TRIGGER_READ_FILE; + trigger = AUDIT_TRIGGER_READ_FILE; break; case 't': - trigger = AUDITD_TRIGGER_CLOSE_AND_DIE; + trigger = AUDIT_TRIGGER_CLOSE_AND_DIE; break; case '?': @@ -52,7 +55,7 @@ break; } } - if (auditctl(AC_SENDTRIGGER, &trigger, sizeof(trigger)) < 0) { + if (auditon(A_SENDTRIGGER, &trigger, sizeof(trigger)) < 0) { perror("Error sending trigger"); exit(-1); } else { ==== //depot/projects/trustedbsd/audit3/contrib/audit_supt/auditd/auditd.c#11 (text+ko) ==== @@ -29,19 +29,19 @@ #include #include +#include +#include +#include + +#include #include -#include #include #include +#include #include -#include -#include #include #include - -#include -#include -#include +#include #include "auditd.h" #define NA_EVENT_STR_SIZE 25 @@ -186,7 +186,7 @@ if (open(fn, O_RDONLY | O_CREAT, S_IRUSR | S_IRGRP) < 0) { perror("File open"); } - else if (auditctl(AC_SETLOGFILE, &fn, sizeof(fn)) != 0) { + else if (auditctl(fn) != 0) { syslog(LOG_ERR, "auditctl failed setting log file! : %s\n", strerror(errno)); @@ -288,6 +288,7 @@ char TS[POSTFIX_LEN]; int aufd; token_t *tok; + long cond; /* Generate an audit record */ if((aufd = au_open()) == -1) { @@ -304,9 +305,10 @@ } /* flush contents */ - err_ret = auditctl(AC_SHUTDOWN, NULL, 0); + cond = AUC_DISABLED; + err_ret = auditon(A_SETCOND, &cond, sizeof(cond)); if (err_ret != 0) { - syslog(LOG_ERR, "auditctl failed! : %s\n", + syslog(LOG_ERR, "Disabling audit failed! : %s\n", strerror(errno)); err_ret = 1; }