PERFORCE change 90312 for review
Wayne Salamon
wsalamon at FreeBSD.org
Wed Jan 25 00:55:13 GMT 2006
http://perforce.freebsd.org/chv.cgi?CH=90312
Change 90312 by wsalamon at gretsch on 2006/01/25 00:55:03
Fix up auditd to use the latest BSM API, where auditd is responsible
for memory management of the audit event record.
Affected files ...
.. //depot/projects/trustedbsd/audit3/contrib/audit_supt/auditd/auditd.c#13 edit
Differences ...
==== //depot/projects/trustedbsd/audit3/contrib/audit_supt/auditd/auditd.c#13 (text+ko) ====
@@ -564,7 +564,7 @@
*/
int config_audit_controls(long flags)
{
- au_event_ent_t *ev;
+ au_event_ent_t ev, *evp;
au_evclass_map_t evc_map;
au_mask_t aumask;
int ctr = 0;
@@ -578,23 +578,29 @@
* but should. We need a way to get a count of the events.
*/
- setauevent();
- while((ev = getauevent()) != NULL) {
- evc_map.ec_number = ev->ae_number;
- evc_map.ec_class = ev->ae_class;
+ ev.ae_name = (char *)malloc(AU_EVENT_NAME_MAX);
+ ev.ae_desc = (char *)malloc(AU_EVENT_DESC_MAX);
+ if ((ev.ae_name == NULL) || (ev.ae_desc == NULL)) {
+ syslog(LOG_ERR,
+ "Memory allocation error when configuring audit controls.");
+ return (-1);
+ }
+ evp = &ev;
+ while((evp = getauevent_r(evp)) != NULL) {
+ evc_map.ec_number = evp->ae_number;
+ evc_map.ec_class = evp->ae_class;
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);
+ evp->ae_name);
} else {
ctr++;
}
- free(ev->ae_name);
- free(ev->ae_desc);
- free(ev);
}
endauevent();
+ free(ev.ae_name);
+ free(ev.ae_desc);
if (ctr == 0)
syslog(LOG_ERR, "No events to class mappings registered.");
else
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list