PERFORCE change 85505 for review
Robert Watson
rwatson at FreeBSD.org
Tue Oct 18 15:12:59 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=85505
Change 85505 by rwatson at rwatson_fledge on 2005/10/18 15:12:32
Teach OpenBSM about AUT_HEADER64_EX. Same specification bug as
AUT_HEADER32_EX in the Solaris man pages: 4 byte address type,
not 1.
Affected files ...
.. //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#4 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#18 edit
Differences ...
==== //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#4 (text+ko) ====
@@ -337,7 +337,7 @@
* version # 1 byte [2]
* event type 2 bytes
* event modifier 2 bytes
- * address type/length 1 byte
+ * address type/length 1 byte (XXX: actually, 4 bytes)
* machine address 4 bytes/16 bytes (IPv4/IPv6 address)
* seconds of time 4 bytes/8 bytes (32/64-bits)
* nanoseconds of time 4 bytes/8 bytes (32/64-bits)
@@ -366,6 +366,19 @@
} au_header64_t;
+typedef struct {
+
+ u_int32_t size;
+ u_char version;
+ u_int16_t e_type;
+ u_int16_t e_mod;
+ u_int32_t ad_type;
+ u_int32_t addr[4];
+ u_int64_t s;
+ u_int64_t ms;
+
+} au_header64_ex_t;
+
/*
* internet address 4 bytes
@@ -765,6 +778,7 @@
au_header32_t hdr32;
au_header32_ex_t hdr32_ex;
au_header64_t hdr64;
+ au_header64_ex_t hdr64_ex;
au_inaddr_t inaddr;
au_inaddr_ex_t inaddr_ex;
au_ip_t ip;
==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#18 (text+ko) ====
@@ -642,6 +642,92 @@
print_delim(fp, del);
print_msec64(fp, tok->tt.hdr64.ms, raw);
}
+/*
+ * record byte count 4 bytes
+ * version # 1 byte [2]
+ * event type 2 bytes
+ * event modifier 2 bytes
+ * address type/length 4 bytes
+ * [ Solaris man page: address type/length 1 byte]
+ * machine address 4 bytes/16 bytes (IPv4/IPv6 address)
+ * seconds of time 4 bytes/8 bytes (32/64-bits)
+ * nanoseconds of time 4 bytes/8 bytes (32/64-bits)
+ *
+ * XXXAUDIT: See comment by fetch_header32_ex_tok() for details on the
+ * accuracy of the BSM spec.
+ */
+static int
+fetch_header64_ex_tok(tokenstr_t *tok, char *buf, int len)
+{
+ int err = 0;
+
+ READ_TOKEN_U_INT32(buf, len, tok->tt.hdr64_ex.size, tok->len, err);
+ if (err)
+ return (-1);
+
+ READ_TOKEN_U_CHAR(buf, len, tok->tt.hdr64_ex.version, tok->len, err);
+ if (err)
+ return (-1);
+
+ READ_TOKEN_U_INT16(buf, len, tok->tt.hdr64_ex.e_type, tok->len, err);
+ if (err)
+ return (-1);
+
+ READ_TOKEN_U_INT16(buf, len, tok->tt.hdr64_ex.e_mod, tok->len, err);
+ if (err)
+ return (-1);
+
+ READ_TOKEN_U_INT32(buf, len, tok->tt.hdr64_ex.ad_type, tok->len, err);
+ if (err)
+ return (-1);
+
+ bzero(tok->tt.hdr64_ex.addr, sizeof(tok->tt.hdr64_ex.addr));
+ switch (tok->tt.hdr64_ex.ad_type) {
+ case AU_IPv4:
+ READ_TOKEN_BYTES(buf, len, &tok->tt.hdr64_ex.addr[0],
+ sizeof(tok->tt.hdr64_ex.addr[0]), tok->len, err);
+ if (err)
+ return (-1);
+ break;
+
+ case AU_IPv6:
+ READ_TOKEN_BYTES(buf, len, &tok->tt.hdr64_ex.addr,
+ sizeof(tok->tt.hdr64_ex.addr), tok->len, err);
+ break;
+ }
+
+ READ_TOKEN_U_INT64(buf, len, tok->tt.hdr64_ex.s, tok->len, err);
+ if (err)
+ return (-1);
+
+ READ_TOKEN_U_INT64(buf, len, tok->tt.hdr64_ex.ms, tok->len, err);
+ if (err)
+ return (-1);
+
+ return (0);
+}
+
+static void
+print_header64_ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+{
+
+ print_tok_type(fp, tok->id, "header_ex", raw);
+ print_delim(fp, del);
+ print_4_bytes(fp, tok->tt.hdr64_ex.size, "%u");
+ print_delim(fp, del);
+ print_1_byte(fp, tok->tt.hdr64_ex.version, "%u");
+ print_delim(fp, del);
+ print_event(fp, tok->tt.hdr64_ex.e_type, raw, sfrm);
+ print_delim(fp, del);
+ print_evmod(fp, tok->tt.hdr64_ex.e_mod, raw);
+ print_delim(fp, del);
+ print_ip_ex_address(fp, tok->tt.hdr64_ex.ad_type,
+ tok->tt.hdr64_ex.addr);
+ print_delim(fp, del);
+ print_sec64(fp, tok->tt.hdr64_ex.s, raw);
+ print_delim(fp, del);
+ print_msec64(fp, tok->tt.hdr64_ex.ms, raw);
+}
/*
* trailer magic 2 bytes
@@ -2328,6 +2414,9 @@
case AUT_HEADER64:
return (fetch_header64_tok(tok, buf, len));
+ case AUT_HEADER64_EX:
+ return (fetch_header64_ex_tok(tok, buf, len));
+
case AUT_TRAILER:
return (fetch_trailer_tok(tok, buf, len));
@@ -2446,6 +2535,9 @@
case AUT_HEADER64:
return (print_header64_tok(outfp, tok, del, raw, sfrm));
+ case AUT_HEADER64_EX:
+ return (print_header64_ex_tok(outfp, tok, del, raw, sfrm));
+
case AUT_TRAILER:
return (print_trailer_tok(outfp, tok, del, raw, sfrm));
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