From owner-p4-projects@FreeBSD.ORG Wed May 28 19:25:06 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 768221065673; Wed, 28 May 2008 19:25:06 +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 38A141065671 for ; Wed, 28 May 2008 19:25:06 +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 DA9748FC25 for ; Wed, 28 May 2008 19:25:05 +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 m4SJP5fx087227 for ; Wed, 28 May 2008 19:25:05 GMT (envelope-from snagg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m4SJP53A087225 for perforce@freebsd.org; Wed, 28 May 2008 19:25:05 GMT (envelope-from snagg@FreeBSD.org) Date: Wed, 28 May 2008 19:25:05 GMT Message-Id: <200805281925.m4SJP53A087225@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 142468 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: Wed, 28 May 2008 19:25:06 -0000 http://perforce.freebsd.org/chv.cgi?CH=142468 Change 142468 by snagg@snagg_macosx on 2008/05/28 19:24:43 Bug Fixes in the whole code. Now it should work fine Affected files ... .. //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_ioctl.h#13 edit .. //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_pipe.c#18 edit Differences ... ==== //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_ioctl.h#13 (text) ==== ==== //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_pipe.c#18 (text) ==== @@ -273,6 +273,7 @@ } else app = NULL; } + break; } } return (app); @@ -300,17 +301,16 @@ */ static int audit_pipe_preselect_get_events_list(struct audit_pipe *ap, - pid_t app_pid, struct audit_pipe_preselect_event *app_events) + pid_t app_pid, struct audit_pipe_preselect_event *app_events, int app_len) { struct audit_pipe_preselect *app; int error; mtx_lock(&audit_pipe_mtx); app = audit_pipe_preselect_find_event(ap, -1, app_pid, -1); - if (app != NULL) { - app_events = app->app_auevents; - error = 0; - } else + 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)); + else error = ENOENT; mtx_unlock(&audit_pipe_mtx); return (error); @@ -471,8 +471,8 @@ if (app != NULL) { TAILQ_REMOVE(&ap->ap_preselect_list, app, app_list); mtx_unlock(&audit_pipe_mtx); - for(i = 0; i < app->app_event_len; i++) - free((app->app_auevents + i), M_AUDIT_PIPE_PRESELECT_EVENT); + if(app->app_auevents != NULL) + free(app->app_auevents, M_AUDIT_PIPE_PRESELECT_EVENT); free(app, M_AUDIT_PIPE_PRESELECT); return (0); } else @@ -517,8 +517,8 @@ while ((app = TAILQ_FIRST(&ap->ap_preselect_list)) != NULL) { TAILQ_REMOVE(&ap->ap_preselect_list, app, app_list); if (app != NULL) { - for(i = 0; i < app->app_event_len; i++) - free((app->app_auevents + i), M_AUDIT_PIPE_PRESELECT_EVENT); + if(app->app_auevents != NULL) + free(app->app_auevents , M_AUDIT_PIPE_PRESELECT_EVENT); free(app, M_AUDIT_PIPE_PRESELECT); } } @@ -1053,7 +1053,7 @@ 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); + (struct audit_pipe_preselect_event *)aip->app_auevents, aip->app_event_len); break; case AUDITPIPE_SET_PRESELECT_EVENTS: