From owner-p4-projects@FreeBSD.ORG Thu May 29 23:49:24 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DBB2B106566C; Thu, 29 May 2008 23:49:23 +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 A109D106564A for ; Thu, 29 May 2008 23:49:23 +0000 (UTC) (envelope-from snagg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8B8858FC0C for ; Thu, 29 May 2008 23:49:23 +0000 (UTC) (envelope-from snagg@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m4TNnNOH028168 for ; Thu, 29 May 2008 23:49:23 GMT (envelope-from snagg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m4TNnNg1028161 for perforce@freebsd.org; Thu, 29 May 2008 23:49:23 GMT (envelope-from snagg@FreeBSD.org) Date: Thu, 29 May 2008 23:49:23 GMT Message-Id: <200805292349.m4TNnNg1028161@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to snagg@FreeBSD.org using -f From: Vincenzo Iozzo To: Perforce Change Reviews Cc: Subject: PERFORCE change 142548 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, 29 May 2008 23:49:24 -0000 http://perforce.freebsd.org/chv.cgi?CH=142548 Change 142548 by snagg@snagg_macosx on 2008/05/29 23:48:40 Style fixes. A bug in the preselect_check was also fixed. Reviewed by: attilio Affected files ... .. //depot/projects/soc2008/snagg-audit/sys/security/audit/audit.c#3 edit .. //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_ioctl.h#15 edit .. //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_pipe.c#19 edit Differences ... ==== //depot/projects/soc2008/snagg-audit/sys/security/audit/audit.c#3 (text) ==== @@ -491,7 +491,8 @@ panic("audit_failing_stop: thread continued"); } td->td_ar = audit_new(event, td); - } else if (audit_pipe_preselect(auid, event, class, AU_PRS_BOTH, 0, td->td_proc->p_pid)) + } else if (audit_pipe_preselect(auid, event, class, AU_PRS_BOTH, 0, + td->td_proc->p_pid)) td->td_ar = audit_new(event, td); else td->td_ar = NULL; ==== //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_ioctl.h#15 (text) ==== @@ -61,8 +61,8 @@ */ #define AUDITPIPE_PRESELECT_MODE_TRAIL 1 /* Global audit trail. */ #define AUDITPIPE_PRESELECT_MODE_LOCAL 2 /* Local audit trail. */ -#define AUDITPIPE_PRESELECT_MODE_EVENT 3 /* Events-pid based audit trail */ -#define AUDITPIPE_PRESELECT_MODE_PID 4 /*Pid based audit trail*/ +#define AUDITPIPE_PRESELECT_MODE_EVENT 3 /* Events-pid based audit trail */ +#define AUDITPIPE_PRESELECT_MODE_PID 4 /*Pid based audit trail*/ /* * Ioctls to read and control the behavior of individual audit pipe devices. ==== //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_pipe.c#19 (text) ==== @@ -112,7 +112,7 @@ int app_event_len; TAILQ_ENTRY(audit_pipe_preselect) app_list; }; - + /* * Description of an individual audit_pipe. Consists largely of a bounded * length queue. @@ -246,7 +246,8 @@ } /* - * Find an audit pipe preselection specification for an event and flag, if any. + * Find an audit pipe preselection specification for an event and flag, + * if any. */ static struct audit_pipe_preselect * audit_pipe_preselect_find_event(struct audit_pipe *ap, int app_event, @@ -261,6 +262,7 @@ ev_a.app_flag = event_flag; TAILQ_FOREACH(app, &ap->ap_preselect_list, app_list) { if(app->app_pid == app_pid) { + /* Just skip if we are interested only in the pid. */ if(app_event != -1) { event = bsearch(&ev_a, (app->app_auevents), app->app_event_len, @@ -309,7 +311,9 @@ mtx_lock(&audit_pipe_mtx); app = audit_pipe_preselect_find_event(ap, -1, app_pid, -1); if (app != NULL) - error = copyout(app->app_auevents, app_events, sizeof(struct audit_pipe_preselect_event)*((app_len > app->app_event_len) ? app->app_event_len : app_len)); + error = copyout(app->app_auevents, app_events, + sizeof(struct audit_pipe_preselect_event)* + ((app_len > app->app_event_len) ? app->app_event_len : app_len)); else error = ENOENT; mtx_unlock(&audit_pipe_mtx); @@ -570,7 +574,8 @@ */ static int audit_pipe_preselect_check(struct audit_pipe *ap, au_id_t auid, - au_event_t event, au_class_t class, int sorf, int trail_preselect, pid_t app_pid) + au_event_t event, au_class_t class, int sorf, int trail_preselect, + pid_t app_pid) { struct audit_pipe_preselect *app; @@ -597,11 +602,15 @@ app = audit_pipe_preselect_find_event(ap, event, app_pid, sorf); if(app != NULL) return (1); + else + break; case AUDITPIPE_PRESELECT_MODE_PID: app = audit_pipe_preselect_find_event(ap, -1, app_pid, -1); if(app != NULL) return (1); + else + break; default: panic("audit_pipe_preselect_check: mode %d", @@ -1053,7 +1062,8 @@ case AUDITPIPE_GET_PRESELECT_EVENT_LIST: aip = (struct auditpipe_ioctl_preselect *)data; error = audit_pipe_preselect_get_events_list(ap, aip->app_pid, - (struct audit_pipe_preselect_event *)aip->app_auevents, aip->app_event_len); + (struct audit_pipe_preselect_event *)aip->app_auevents, + aip->app_event_len); break; case AUDITPIPE_SET_PRESELECT_EVENTS: