[systemd-devel] [PATCH 3/3] journal: include user space audit types in the list

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Tue Apr 14 18:58:34 PDT 2015


---
 Makefile.am              | 6 +++++-
 configure.ac             | 1 +
 src/journal/audit-type.c | 3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git Makefile.am Makefile.am
index 2d82fd12c1..b8cb9cbfd2 100644
--- Makefile.am
+++ Makefile.am
@@ -1311,10 +1311,14 @@ src/shared/cap-from-name.gperf: src/shared/cap-list.txt
 src/shared/cap-from-name.h: src/shared/cap-from-name.gperf
 	$(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_capability -H hash_capability_name -p -C <$< >$@
 
+audit_list_includes = -include linux/audit.h
+if HAVE_AUDIT
+audit_list_includes += -include libaudit.h
+endif
 
 src/journal/audit_type-list.txt:
 	$(AM_V_at)$(MKDIR_P) $(dir $@)
-	$(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include linux/audit.h - </dev/null | grep -vE 'AUDIT_(FIRST|LAST)_.*MSG' | $(SED) -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | sort -k2 >$@
+	$(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM $(audit_list_includes) - </dev/null | grep -vE 'AUDIT_.*(FIRST|LAST)_' | $(SED) -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | sort -k2 >$@
 
 src/journal/audit_type-to-name.h: src/journal/audit_type-list.txt
 	$(AM_V_GEN)$(AWK) 'BEGIN{ print "const char *audit_type_to_string(int type) {\n\tswitch(type) {" } {printf "        case AUDIT_%s: return \"%s\";\n", $$1, $$1 } END{ print "        default: return NULL;\n\t}\n}\n" }' <$< >$@
diff --git configure.ac configure.ac
index 4ff70950f2..dad3428f11 100644
--- configure.ac
+++ configure.ac
@@ -781,6 +781,7 @@ else
         AUDIT_LIBS=
 fi
 AC_SUBST(AUDIT_LIBS)
+AM_CONDITIONAL([HAVE_AUDIT], [test "x$have_audit" != xno])
 
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([elfutils],
diff --git src/journal/audit-type.c src/journal/audit-type.c
index 03830c94f1..5f2a898746 100644
--- src/journal/audit-type.c
+++ src/journal/audit-type.c
@@ -21,6 +21,9 @@
 
 #include <stdio.h>
 #include <linux/audit.h>
+#ifdef HAVE_AUDIT
+#  include <libaudit.h>
+#endif
 
 #include "audit-type.h"
 
-- 
2.3.5



More information about the systemd-devel mailing list