/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stdlib.h>
#include <string.h>
#include <bsm/audit_record.h>
#include <synch.h>
#include <adt_xlate.h> /* adt_write_syslog */
/*
* Open an audit record = find a free descriptor and pass it back.
* The descriptors are in a "fixed" length array which is extended
* whenever it gets full.
*
* Since the expected frequency of copies is expected to be low,
* and since realloc loses data if it fails to expand the buffer,
* calloc() is used rather than realloc().
*/
/*
* AU_TABLE_MAX must be a integer multiple of AU_TABLE_LENGTH
*/
int
au_open(void)
{
int d; /* descriptor */
(void) mutex_lock(&mutex_au_d);
if (au_d_required_length > au_d_length) {
(void) mutex_unlock(&mutex_au_d);
return (-1);
}
if (au_d_length > 0) {
sizeof (au_d));
}
}
}
for (d = 0; d < au_d_length; d++) {
(void) mutex_unlock(&mutex_au_d);
return (d);
}
}
/*
* table full; make more room.
* AU_TABLE_MAX limits recursion.
* Logic here expects AU_TABLE_MAX to be multiple of AU_TABLE_LENGTH
*/
if (au_d_length >= AU_TABLE_MAX) {
(void) mutex_unlock(&mutex_au_d);
return (-1);
}
(void) mutex_unlock(&mutex_au_d);
return (au_open());
}
/*
* Write to an audit descriptor.
* Add the mbuf to the descriptor chain and free the chain passed in.
*/
int
{
if (m == NULL) {
return (-1);
}
if (d < 0) {
/* free token */
free(m);
return (-1);
}
(void) mutex_lock(&mutex_au_d);
(void) mutex_unlock(&mutex_au_d);
/* free token */
free(m);
return (-1);
au_d[d] = m;
(void) mutex_unlock(&mutex_au_d);
return (0);
}
continue;
}
(void) mutex_unlock(&mutex_au_d);
return (0);
}
/*
* Close an audit descriptor.
* Use the second parameter to indicate if it should be written or not.
*/
int
{
int v;
(void) mutex_lock(&mutex_au_d);
if (d < 0 || d >= au_d_length ||
(void) mutex_unlock(&mutex_au_d);
return (-1);
}
(void) mutex_unlock(&mutex_au_d);
return (0);
}
/*
* If not to be written toss the record
*/
if (right != AU_TO_WRITE) {
}
(void) mutex_unlock(&mutex_au_d);
return (0);
}
/*
* Count up the bytes used in the record.
*/
}
#ifdef _LP64
#else
#endif
/* Use the extended headed if our host address can be determined. */
sizeof (audit_info)) == 0) {
int have_valid_addr;
else
if (have_valid_addr) {
}
}
/*
* Build the header
*/
/* free the token chain */
}
(void) mutex_unlock(&mutex_au_d);
return (-1);
}
if (data_header == HEADER_ID_EX) {
}
#ifdef _LP64
#else
#endif
/*
* Tack on the data, and free the tokens.
* We're not supposed to know how adr works, but ...
*/
}
/*
* Send it down to the system
*/
(void) mutex_unlock(&mutex_au_d);
return (v);
}