FreeBSD/contrib/openbsm/libbsm/bsm_audit.c
/*
 * Add the header token, identify any missing tokens.  Write out the tokens to
 * the record memory and finally, call audit.
 */
Add the header token, identify any missing tokens.  Write out the tokens to
the record memory and finally, call audit.
Add the header token identify any missing tokens . Write out the tokens to the record memory and finally call audit .
int
au_close(int d, int keep, short event)
{
	au_record_t *rec;
	size_t tot_rec_size;
	int retval = 0;
	rec = open_desc_table[d];
	if ((rec == NULL) || (rec->used == 0)) {
		errno = EINVAL;
		return (-1); 
	}
	if (keep == AU_TO_NO_WRITE) {
		retval = 0;
		goto cleanup;
	}
	tot_rec_size = rec->len + MAX_AUDIT_HEADER_SIZE + AUDIT_TRAILER_SIZE;
	if (tot_rec_size > MAX_AUDIT_RECORD_SIZE) {
		fprintf(stderr, "au_close failed");
		errno = ENOMEM;
		retval = -1;
		goto cleanup;
	}
	if (au_assemble(rec, event) < 0) {
		retval = -1;
		goto cleanup;
	}
	retval = audit(rec->data, rec->len);
cleanup:
	au_teardown(rec);
	return (retval);
}
int au_close ( int d , int keep , short event ) { au_record_t * rec ; size_t tot_rec_size ; int retval = 0 ; rec = open_desc_table [ d ] ; if ( ( rec == NULL ) || ( rec -> used == 0 ) ) { errno = EINVAL ; return ( -1 ) ; } if ( keep == AU_TO_NO_WRITE ) { retval = 0 ; goto cleanup ; } tot_rec_size = rec -> len + MAX_AUDIT_HEADER_SIZE + AUDIT_TRAILER_SIZE ; if ( tot_rec_size > MAX_AUDIT_RECORD_SIZE ) { fprintf ( stderr , " " ) ; errno = ENOMEM ; retval = -1 ; goto cleanup ; } if ( au_assemble ( rec , event ) < 0 ) { retval = -1 ; goto cleanup ; } retval = audit ( rec -> data , rec -> len ) ; cleanup : au_teardown ( rec ) ; return ( retval ) ; }
Add the header token, identify any missing tokens.
Add the header token identify any missing tokens .
/* Invalid descriptor */ /*
		 * XXXRW: Since au_write() is supposed to prevent this, spew
		 * an error here.
		 */ /*
		 * XXXRW: This is also not supposed to happen, but might if we
		 * are unable to allocate header and trailer memory.
		 */ /* Call the kernel interface to audit */ /* CLEANUP */