Deleted Added
full compact
audit_bsm.c (168688) audit_bsm.c (170196)
1/*
2 * Copyright (c) 1999-2005 Apple Computer, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
1/*
2 * Copyright (c) 1999-2005 Apple Computer, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/security/audit/audit_bsm.c 168688 2007-04-13 14:55:19Z csjp $
29 * $FreeBSD: head/sys/security/audit/audit_bsm.c 170196 2007-06-01 21:58:59Z rwatson $
30 */
31
32#include <sys/param.h>
33#include <sys/vnode.h>
34#include <sys/ipc.h>
35#include <sys/lock.h>
36#include <sys/malloc.h>
37#include <sys/mutex.h>

--- 76 unchanged lines hidden (view full) ---

114{
115 u_char *dptr;
116 size_t tot_rec_size;
117 token_t *cur, *hdr, *trail;
118 struct timeval tm;
119
120 tot_rec_size = rec->len + AUDIT_HEADER_SIZE + AUDIT_TRAILER_SIZE;
121 rec->data = malloc(tot_rec_size, M_AUDITBSM, M_WAITOK | M_ZERO);
30 */
31
32#include <sys/param.h>
33#include <sys/vnode.h>
34#include <sys/ipc.h>
35#include <sys/lock.h>
36#include <sys/malloc.h>
37#include <sys/mutex.h>

--- 76 unchanged lines hidden (view full) ---

114{
115 u_char *dptr;
116 size_t tot_rec_size;
117 token_t *cur, *hdr, *trail;
118 struct timeval tm;
119
120 tot_rec_size = rec->len + AUDIT_HEADER_SIZE + AUDIT_TRAILER_SIZE;
121 rec->data = malloc(tot_rec_size, M_AUDITBSM, M_WAITOK | M_ZERO);
122 /* Create the header token */
122
123 tm.tv_usec = ctime->tv_nsec / 1000;
124 tm.tv_sec = ctime->tv_sec;
125 hdr = au_to_header32_tm(tot_rec_size, event, 0, tm);
126 TAILQ_INSERT_HEAD(&rec->token_q, hdr, tokens);
127
128 trail = au_to_trailer(tot_rec_size);
129 TAILQ_INSERT_TAIL(&rec->token_q, trail, tokens);
130
123 tm.tv_usec = ctime->tv_nsec / 1000;
124 tm.tv_sec = ctime->tv_sec;
125 hdr = au_to_header32_tm(tot_rec_size, event, 0, tm);
126 TAILQ_INSERT_HEAD(&rec->token_q, hdr, tokens);
127
128 trail = au_to_trailer(tot_rec_size);
129 TAILQ_INSERT_TAIL(&rec->token_q, trail, tokens);
130
131 /* Serialize token data to the record. */
132 rec->len = tot_rec_size;
133 dptr = rec->data;
134 TAILQ_FOREACH(cur, &rec->token_q, tokens) {
135 memcpy(dptr, cur->t_data, cur->len);
136 dptr += cur->len;
137 }
138}
139

--- 15 unchanged lines hidden (view full) ---

155
156 rec->used = 0;
157 rec->len = 0;
158 free(rec->data, M_AUDITBSM);
159 free(rec, M_AUDITBSM);
160}
161
162/*
131 rec->len = tot_rec_size;
132 dptr = rec->data;
133 TAILQ_FOREACH(cur, &rec->token_q, tokens) {
134 memcpy(dptr, cur->t_data, cur->len);
135 dptr += cur->len;
136 }
137}
138

--- 15 unchanged lines hidden (view full) ---

154
155 rec->used = 0;
156 rec->len = 0;
157 free(rec->data, M_AUDITBSM);
158 free(rec, M_AUDITBSM);
159}
160
161/*
163 * XXX May want turn some (or all) of these macros into functions in order
162 * XXX: May want turn some (or all) of these macros into functions in order
164 * to reduce the generated code sized.
165 *
166 * XXXAUDIT: These macros assume that 'kar', 'ar', 'rec', and 'tok' in the
167 * caller are OK with this.
168 */
169#define UPATH1_TOKENS do { \
170 if (ARG_IS_VALID(kar, ARG_UPATH1)) { \
171 tok = au_to_path(ar->ar_arg_upath1); \

--- 1247 unchanged lines hidden ---
163 * to reduce the generated code sized.
164 *
165 * XXXAUDIT: These macros assume that 'kar', 'ar', 'rec', and 'tok' in the
166 * caller are OK with this.
167 */
168#define UPATH1_TOKENS do { \
169 if (ARG_IS_VALID(kar, ARG_UPATH1)) { \
170 tok = au_to_path(ar->ar_arg_upath1); \

--- 1247 unchanged lines hidden ---