PERFORCE change 167014 for review
Stacey Son
sson at FreeBSD.org
Wed Aug 5 01:16:50 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=167014
Change 167014 by sson at sson_amd64 on 2009/08/05 01:15:48
Add '-n' option to 'praudit'.
The '-n' option keeps the user and group IDs in their numeric
forms which is useful when examing a audit trail on a different
system that has different symbolic names.
Affected files ...
.. //depot/projects/trustedbsd/openbsm/bin/praudit/praudit.1#14 edit
.. //depot/projects/trustedbsd/openbsm/bin/praudit/praudit.c#15 edit
.. //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#48 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/au_io.3#8 edit
Differences ...
==== //depot/projects/trustedbsd/openbsm/bin/praudit/praudit.1#14 (text+ko) ====
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2004 Apple Inc.
+.\" Copyright (c) 2004-2009 Apple Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -25,9 +25,9 @@
.\" 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.1#13 $
+.\" $P4: //depot/projects/trustedbsd/openbsm/bin/praudit/praudit.1#14 $
.\"
-.Dd November 5, 2006
+.Dd August 4, 2009
.Dt PRAUDIT 1
.Os
.Sh NAME
@@ -35,7 +35,7 @@
.Nd "print the contents of audit trail files"
.Sh SYNOPSIS
.Nm
-.Op Fl lpx
+.Op Fl lnpx
.Op Fl r | s
.Op Fl d Ar del
.Op Ar
@@ -58,6 +58,9 @@
Prints the entire record on the same line.
If this option is not specified,
every token is displayed on a different line.
+.It Fl n
+Do not convert user and group IDs to their names but leave in their
+numeric forms.
.It Fl p
Specify this option if input to
.Nm
==== //depot/projects/trustedbsd/openbsm/bin/praudit/praudit.c#15 (text+ko) ====
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2004-2008 Apple Inc.
+ * Copyright (c) 2004-2009 Apple Inc.
* Copyright (c) 2006 Martin Voros
* All rights reserved.
*
@@ -27,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#14 $
+ * $P4: //depot/projects/trustedbsd/openbsm/bin/praudit/praudit.c#15 $
*/
/*
@@ -35,7 +35,7 @@
*/
/*
- * praudit [-lpx] [-r | -s] [-d del] [file ...]
+ * praudit [-lnpx] [-r | -s] [-d del] [file ...]
*/
#include <bsm/libbsm.h>
@@ -49,16 +49,14 @@
static char *del = ","; /* Default delimiter. */
static int oneline = 0;
-static int raw = 0;
-static int shortfrm = 0;
static int partial = 0;
-static int xml = 0;
+static int oflags = AU_OFLAG_NONE;
static void
usage(void)
{
- fprintf(stderr, "usage: praudit [-lpx] [-r | -s] [-d del] "
+ fprintf(stderr, "usage: praudit [-lnpx] [-r | -s] [-d del] "
"[file ...]\n");
exit(1);
}
@@ -91,15 +89,10 @@
if (-1 == au_fetch_tok(&tok, buf + bytesread,
reclen - bytesread))
break;
- if (xml)
- au_print_tok_xml(stdout, &tok, del, raw,
- shortfrm);
- else
- au_print_tok(stdout, &tok, del, raw,
- shortfrm);
+ au_print_flags_tok(stdout, &tok, del, oflags);
bytesread += tok.len;
if (oneline) {
- if (!xml)
+ if (!(oflags & AU_OFLAG_XML))
printf("%s", del);
} else
printf("\n");
@@ -119,7 +112,7 @@
int i;
FILE *fp;
- while ((ch = getopt(argc, argv, "d:lprsx")) != -1) {
+ while ((ch = getopt(argc, argv, "d:lnprsx")) != -1) {
switch(ch) {
case 'd':
del = optarg;
@@ -129,24 +122,28 @@
oneline = 1;
break;
+ case 'n':
+ oflags |= AU_OFLAG_NORESOLVE;
+ break;
+
case 'p':
partial = 1;
break;
case 'r':
- if (shortfrm)
+ if (oflags & AU_OFLAG_SHORT)
usage(); /* Exclusive from shortfrm. */
- raw = 1;
+ oflags |= AU_OFLAG_RAW;
break;
case 's':
- if (raw)
+ if (oflags & AU_OFLAG_RAW)
usage(); /* Exclusive from raw. */
- shortfrm = 1;
+ oflags |= AU_OFLAG_SHORT;
break;
case 'x':
- xml = 1;
+ oflags |= AU_OFLAG_XML;
break;
case '?':
@@ -155,7 +152,7 @@
}
}
- if (xml)
+ if (oflags & AU_OFLAG_XML)
au_print_xml_header(stdout);
/* For each of the files passed as arguments dump the contents. */
@@ -171,7 +168,7 @@
fclose(fp);
}
- if (xml)
+ if (oflags & AU_OFLAG_XML)
au_print_xml_footer(stdout);
return (1);
==== //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#48 (text+ko) ====
@@ -26,7 +26,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/bsm/libbsm.h#47 $
+ * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#48 $
*/
#ifndef _LIBBSM_H_
@@ -107,6 +107,7 @@
#define AU_OFLAG_RAW 0x0001 /* Raw, numeric form. */
#define AU_OFLAG_SHORT 0x0002 /* Short form. */
#define AU_OFLAG_XML 0x0004 /* XML form. */
+#define AU_OFLAG_NORESOLVE 0x0008 /* No user/group name resolution. */
__BEGIN_DECLS
struct au_event_ent {
==== //depot/projects/trustedbsd/openbsm/libbsm/au_io.3#8 (text+ko) ====
@@ -1,4 +1,5 @@
.\"-
+.\" Copyright (c) 2009 Apple, Inc.
.\" Copyright (c) 2005 Robert N. M. Watson
.\" All rights reserved.
.\"
@@ -23,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $P4: //depot/projects/trustedbsd/openbsm/libbsm/au_io.3#7 $
+.\" $P4: //depot/projects/trustedbsd/openbsm/libbsm/au_io.3#8 $
.\"
.Dd August 4, 2009
.Dt AU_IO 3
@@ -87,9 +88,11 @@
controls how the output should be formatted and is specified by
or'ing the following flags:
.Pp
-.Bl -tag -width AU_OFLAG_SHORT -compact -offset indent
+.Bl -tag -width AU_OFLAG_NORESOLVE -compact -offset indent
.It Li AU_OFLAG_NONE
Use the default form.
+.It Li AU_OFLAG_NORESOLVE
+Leave user and group IDs in their numeric form.
.It Li AU_OFLAG_RAW
Use the raw, numeric form.
.It Li AU_OFLAG_SHORT
More information about the p4-projects
mailing list