From owner-p4-projects@FreeBSD.ORG Thu Nov 4 22:36:38 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9B92E16A4D0; Thu, 4 Nov 2004 22:36:38 +0000 (GMT) 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 609C216A4CF for ; Thu, 4 Nov 2004 22:36:38 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 385EC43D5D for ; Thu, 4 Nov 2004 22:36:38 +0000 (GMT) (envelope-from arr@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id iA4Mac30042042 for ; Thu, 4 Nov 2004 22:36:38 GMT (envelope-from arr@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id iA4Mabsh042039 for perforce@freebsd.org; Thu, 4 Nov 2004 22:36:37 GMT (envelope-from arr@freebsd.org) Date: Thu, 4 Nov 2004 22:36:37 GMT Message-Id: <200411042236.iA4Mabsh042039@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to arr@freebsd.org using -f From: "Andrew R. Reiter" To: Perforce Change Reviews Subject: PERFORCE change 64266 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2004 22:36:39 -0000 http://perforce.freebsd.org/chv.cgi?CH=64266 Change 64266 by arr@arr_audit3_d400laptop on 2004/11/04 22:36:02 - Roll back auditon.c change to use Audit API instead of syscall(2) hack. Robert pointed out that the stubs are auto- generated. - Modify auditd code to use the Audit API instead of syscall(2). Affected files ... .. //depot/projects/trustedbsd/audit3/contrib/audit_supt/auditd/auditd.c#7 edit .. //depot/projects/trustedbsd/audit3/usr.sbin/auditon/auditon.c#3 edit Differences ... ==== //depot/projects/trustedbsd/audit3/contrib/audit_supt/auditd/auditd.c#7 (text+ko) ==== @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -187,8 +186,7 @@ if (open(fn, O_RDONLY | O_CREAT, S_IRUSR | S_IRGRP) < 0) { perror("File open"); } - /* else if (auditctl(AC_SETLOGFILE, fn)) != 0) { */ - else if (syscall(SYS_auditctl, AC_SETLOGFILE, fn) != 0) { + else if (auditctl(AC_SETLOGFILE, fn) != 0) { syslog(LOG_ERR, "auditctl failed setting log file! : %s\n", strerror(errno)); @@ -265,15 +263,13 @@ syslog(LOG_INFO, "min free = %d\n", minval); - /* if (auditon(A_GETQCTRL, &qctrl, sizeof(qctrl)) != 0) { */ - if (syscall(SYS_auditon, A_GETQCTRL, &qctrl, sizeof(qctrl)) != 0) { + if (auditon(A_GETQCTRL, &qctrl, sizeof(qctrl)) != 0) { syslog(LOG_ERR, "could not get audit queue settings\n"); return -1; } qctrl.aq_minfree = minval; - /* if (auditon(A_SETQCTRL, &qctrl, sizeof(qctrl)) != 0) { */ - if (syscall(SYS_auditon, A_SETQCTRL, &qctrl, sizeof(qctrl)) != 0) { + if (auditon(A_SETQCTRL, &qctrl, sizeof(qctrl)) != 0) { syslog(LOG_ERR, "could not set audit queue settings\n"); return -1; @@ -308,8 +304,7 @@ } /* flush contents */ - /* err_ret = auditctl(NULL); */ - err_ret = syscall(SYS_auditctl, AC_SETLOGFILE, NULL); + err_ret = auditctl(AC_SETLOGFILE, NULL); if (err_ret != 0) { syslog(LOG_ERR, "auditctl failed! : %s\n", strerror(errno)); @@ -563,9 +558,8 @@ while((ev = getauevent()) != NULL) { evc_map.ec_number = ev->ae_number; evc_map.ec_class = ev->ae_class; - /* if (auditon(A_SETCLASS, &evc_map, sizeof(au_evclass_map_t)) != 0) { */ - if (syscall(SYS_auditon, A_SETCLASS, &evc_map, - sizeof(au_evclass_map_t)) != 0) { + if (auditon(A_SETCLASS, &evc_map, + sizeof(au_evclass_map_t)) != 0) { syslog(LOG_ERR, "Failed to register class mapping for event %s", ev->ae_name); @@ -588,8 +582,7 @@ if ((getacna(naeventstr, NA_EVENT_STR_SIZE) == 0) && ( getauditflagsbin(naeventstr, &aumask) == 0)) { - /* if (auditon(A_SETKMASK, &aumask, sizeof(au_mask_t))){ */ - if (syscall(SYS_auditon,A_SETKMASK, &aumask, sizeof(au_mask_t))){ + if (auditon(A_SETKMASK, &aumask, sizeof(au_mask_t))){ syslog(LOG_ERR, "Failed to register non-attributable event mask."); } else { @@ -603,8 +596,7 @@ /* * Set the audit policy flags based on passed in parameter values. */ - /* if (auditon(A_SETPOLICY, &flags, sizeof(flags))) { */ - if (syscall(SYS_auditon,A_SETPOLICY, &flags, sizeof(flags))) { + if (auditon(A_SETPOLICY, &flags, sizeof(flags))) { syslog(LOG_ERR, "Failed to set audit policy."); } @@ -660,8 +652,7 @@ return -1; } /* Tell the kernel the name of the auditd control file */ - /*if (auditctl(AC_SETCTLFILE, fn) != 0) { */ - if (syscall(SYS_auditctl, AC_SETCTLFILE, AUDITD_CTL_FILE) != 0) { + if (auditctl(AC_SETCTLFILE, AUDITD_CTL_FILE) != 0) { syslog(LOG_ERR, "config_auditd_ipc() : failed sending control file " "name to the kernel: %s\n", ==== //depot/projects/trustedbsd/audit3/usr.sbin/auditon/auditon.c#3 (text+ko) ==== @@ -38,8 +38,6 @@ #include #include #include -#include -#include static void usage(void) @@ -61,8 +59,7 @@ path = NULL; else path = argv[1]; - /* if (auditctl(AC_SETLOGFILE, path) == -1) */ - if (syscall(SYS_auditctl, AC_SETLOGFILE, path) == -1) + if (auditctl(AC_SETLOGFILE, path) == -1) errx(-1, "%s: %s", path, strerror(errno)); exit(0); }