Date: Thu, 29 May 2008 23:49:23 GMT From: Vincenzo Iozzo <snagg@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 142548 for review Message-ID: <200805292349.m4TNnNg1028161@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805292349.m4TNnNg1028161>