PERFORCE change 142468 for review
Vincenzo Iozzo
snagg at FreeBSD.org
Wed May 28 19:25:06 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=142468
Change 142468 by snagg at 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:
More information about the p4-projects
mailing list