bus: move shared libaudit code to a new audit.[ch]
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 19 Feb 2015 12:04:26 +0000 (12:04 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 6 Aug 2015 16:12:36 +0000 (17:12 +0100)
commit327a52e4eb90c94dc47579b7890974b65f2f9e53
treecc652814cd42332f56ba8fded32a388f6ed7393c
parentd0e9d8e7bad9280f03e9389eef220d219f84dd16
bus: move shared libaudit code to a new audit.[ch]

This fixes various duplicated libaudit interactions in both
SELinux and AppArmor code paths, including opening two audit sockets
if both SELinux and AppArmor were enabled at compile time.
In particular, audit.c is now the only user of libcap-ng.

This commit is not intended to introduce any functional changes,
except for the de-duplication.

The actual audit_log_user_avc_message() call is still duplicated,
because the SELinux and AppArmor code paths use different mechanisms
to compose the audit message: the SELinux path uses a statically-sized
buffer on the stack which might be subject to truncation, whereas
the AppArmor path uses malloc() (via DBusString) and falls back to
using syslog on a memory allocation failure.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225
Reviewed-by: Colin Walters <walters@verbum.org>
[smcv: minor issues raised during review are subsequently fixed]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
bus/Makefile.am
bus/apparmor.c
bus/apparmor.h
bus/audit.c [new file with mode: 0644]
bus/audit.h [new file with mode: 0644]
bus/bus.c
bus/main.c
bus/selinux.c
bus/selinux.h
cmake/bus/CMakeLists.txt