summaryrefslogtreecommitdiffstats
path: root/contrib/openbsm/bin/praudit/praudit.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-04-16 15:37:10 +0000
committerrwatson <rwatson@FreeBSD.org>2007-04-16 15:37:10 +0000
commit9d9ec51b2c47983a8f8c8d48ed2fca487c2b272a (patch)
tree103f2ad3fab79dfe5e3b4ca02ebf1d9c1e2e4e82 /contrib/openbsm/bin/praudit/praudit.c
parent6b46b736cc84f6697b21608e304026e847ac155d (diff)
downloadFreeBSD-src-9d9ec51b2c47983a8f8c8d48ed2fca487c2b272a.zip
FreeBSD-src-9d9ec51b2c47983a8f8c8d48ed2fca487c2b272a.tar.gz
Vendor import TrustedBSD OpenBSM 1.0 alpha 14, with the following change
history notes since the last import: OpenBSM 1.0 alpha 14 - Fix endian issues when processing IPv6 addresses for extended subject and process tokens. - gcc41 warnings clean. - Teach audit_submit(3) about getaudit_addr(2). - Add support for zonename tokens. OpenBSM 1.0 alpha 13 - compat/clock_gettime.h now provides a compatibility implementation of clock_gettime(), which fixes building on Mac OS X. - Countless man page improvements, markup fixes, content fixs, etc. - XML printing support via "praudit -x". - audit.log.5 expanded to include additional BSM token types. - Added encoding and decoding routines for process64_ex, process32_ex, subject32_ex, header64, and attr64 tokens. - Additional audit event identifiers for listen, mlockall/munlockall, getpath, POSIX message queues, and mandatory access control. Approved by: re (bmah) MFC after: 3 weeks Obtained from: TrustedBSD Project
Diffstat (limited to 'contrib/openbsm/bin/praudit/praudit.c')
-rw-r--r--contrib/openbsm/bin/praudit/praudit.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/contrib/openbsm/bin/praudit/praudit.c b/contrib/openbsm/bin/praudit/praudit.c
index e812f98..bf36806 100644
--- a/contrib/openbsm/bin/praudit/praudit.c
+++ b/contrib/openbsm/bin/praudit/praudit.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2004 Apple Computer, Inc.
+ * Copyright (c) 2006 Martin Voros
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,7 +27,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/bin/praudit/praudit.c#9 $
+ * $P4: //depot/projects/trustedbsd/openbsm/bin/praudit/praudit.c#11 $
*/
/*
@@ -34,7 +35,7 @@
*/
/*
- * praudit [-lrs] [-ddel] [filenames]
+ * praudit [-lpx] [-r | -s] [-d del] [file ...]
*/
#include <bsm/libbsm.h>
@@ -51,12 +52,14 @@ static int oneline = 0;
static int raw = 0;
static int shortfrm = 0;
static int partial = 0;
+static int xml = 0;
static void
-usage()
+usage(void)
{
- fprintf(stderr, "Usage: praudit [-lrs] [-ddel] [filenames]\n");
+ fprintf(stderr, "usage: praudit [-lpx] [-r | -s] [-d del] "
+ "[file ...]\n");
exit(1);
}
@@ -88,11 +91,17 @@ print_tokens(FILE *fp)
if (-1 == au_fetch_tok(&tok, buf + bytesread,
reclen - bytesread))
break;
- au_print_tok(stdout, &tok, del, raw, shortfrm);
- bytesread += tok.len;
- if (oneline)
- printf("%s", del);
+ if (xml)
+ au_print_tok_xml(stdout, &tok, del, raw,
+ shortfrm);
else
+ au_print_tok(stdout, &tok, del, raw,
+ shortfrm);
+ bytesread += tok.len;
+ if (oneline) {
+ if (!xml)
+ printf("%s", del);
+ } else
printf("\n");
}
free(buf);
@@ -109,12 +118,20 @@ main(int argc, char **argv)
int i;
FILE *fp;
- while ((ch = getopt(argc, argv, "lprsd:")) != -1) {
+ while ((ch = getopt(argc, argv, "d:lprsx")) != -1) {
switch(ch) {
+ case 'd':
+ del = optarg;
+ break;
+
case 'l':
oneline = 1;
break;
+ case 'p':
+ partial = 1;
+ break;
+
case 'r':
if (shortfrm)
usage(); /* Exclusive from shortfrm. */
@@ -127,12 +144,8 @@ main(int argc, char **argv)
shortfrm = 1;
break;
- case 'd':
- del = optarg;
- break;
-
- case 'p':
- partial = 1;
+ case 'x':
+ xml = 1;
break;
case '?':
@@ -141,6 +154,9 @@ main(int argc, char **argv)
}
}
+ if (xml)
+ au_print_xml_header(stdout);
+
/* For each of the files passed as arguments dump the contents. */
if (optind == argc) {
print_tokens(stdin);
@@ -153,5 +169,9 @@ main(int argc, char **argv)
if (fp != NULL)
fclose(fp);
}
+
+ if (xml)
+ au_print_xml_footer(stdout);
+
return (1);
}
OpenPOWER on IntegriCloud