Let me suggest that a library function be added to auparse that
identifies the version of the library to its clients. This is helpful
for generating good debugging messages, but also eases the task of
associating a version number with the output of a log analysis
program. Knowing the version number may be important as
auparse/interpret.c may interpret more fields in the future, and
analysis programs may be sensitive to the changes.
To apply, use -p2, not the usual -p1.
John
diff -urN a/audit-1.5.6/auparse/auparse.c b/audit-1.5.6/auparse/auparse.c
--- a/audit-1.5.6/auparse/auparse.c 2007-06-18 16:48:53.000000000 -0400
+++ b/audit-1.5.6/auparse/auparse.c 2007-07-27 08:00:58.000000000 -0400
@@ -29,6 +29,12 @@
#include <string.h>
#include <unistd.h>
+/* provide version information for this library to clients */
+const char *
+auparse_version(void)
+{
+ return VERSION;
+}
static int debug = 0;
diff -urN a/audit-1.5.6/auparse/auparse.h b/audit-1.5.6/auparse/auparse.h
--- a/audit-1.5.6/auparse/auparse.h 2007-05-30 16:37:40.000000000 -0400
+++ b/audit-1.5.6/auparse/auparse.h 2007-07-27 07:53:33.000000000 -0400
@@ -89,6 +89,8 @@
int auparse_get_field_int(auparse_state_t *au);
const char *auparse_interpret_field(auparse_state_t *au);
+/* Identify library version */
+const char *auparse_version(void);
#ifdef __cplusplus
}
diff -urN a/audit-1.5.6/docs/auparse_version.3 b/audit-1.5.6/docs/auparse_version.3
--- a/audit-1.5.6/docs/auparse_version.3 1969-12-31 19:00:00.000000000 -0500
+++ b/audit-1.5.6/docs/auparse_version.3 2007-07-27 07:58:42.000000000 -0400
@@ -0,0 +1,18 @@
+.TH "AUPARSE_VERSION" "3" "July 2007" "Red Hat"
"Linux Audit API"
+.SH NAME
+auparse_version \- version number of library
+.SH "SYNOPSIS"
+.B #include <auparse.h>
+.sp
+const char *auparse_version (void);
+
+.SH "DESCRIPTION"
+
+auparse_version returns the version number of the library.
+
+.SH "RETURN VALUE"
+
+A string containing the version number.
+
+.SH AUTHOR
+John D. Ramsdell
diff -urN a/audit-1.5.6/docs/Makefile.am b/audit-1.5.6/docs/Makefile.am
--- a/audit-1.5.6/docs/Makefile.am 2007-05-30 16:37:40.000000000 -0400
+++ b/audit-1.5.6/docs/Makefile.am 2007-07-27 07:55:57.000000000 -0400
@@ -43,5 +43,5 @@
auparse_next_field.3 auparse_next_record.3 auparse_reset.3 \
auparse_timestamp_compare.3 aureport.8 ausearch.8 ausearch_add_item.3 \
ausearch_clear.3 ausearch_next_event.3 ausearch_set_stop.3 autrace.8 \
-get_auditfail_action.3 set_aumessage_mode.3
+get_auditfail_action.3 set_aumessage_mode.3 auparse_version.3
diff -urN a/audit-1.5.6/docs/Makefile.in b/audit-1.5.6/docs/Makefile.in
--- a/audit-1.5.6/docs/Makefile.in 2007-07-27 07:28:33.000000000 -0400
+++ b/audit-1.5.6/docs/Makefile.in 2007-07-27 08:02:39.000000000 -0400
@@ -214,7 +214,7 @@
auparse_next_field.3 auparse_next_record.3 auparse_reset.3 \
auparse_timestamp_compare.3 aureport.8 ausearch.8 ausearch_add_item.3 \
ausearch_clear.3 ausearch_next_event.3 ausearch_set_stop.3 autrace.8 \
-get_auditfail_action.3 set_aumessage_mode.3
+get_auditfail_action.3 set_aumessage_mode.3 auparse_version.3
all: all-am