From 827162cedc70dc79d04eef412e2a8573a2c850ca Mon Sep 17 00:00:00 2001 From: Tyler Hicks Date: Sun, 8 Feb 2015 23:02:38 -0600 Subject: [FIX FOR 05/13] fix: make bus_apparmor_full_init() able to raise a DBusError Pass a DBusError pointer to bus_apparmor_full_init() so that it can raise an error. Signed-off-by: Tyler Hicks --- bus/apparmor.c | 5 +++-- bus/apparmor.h | 2 +- bus/bus.c | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bus/apparmor.c b/bus/apparmor.c index 4562ad2..94366f0 100644 --- a/bus/apparmor.c +++ b/bus/apparmor.c @@ -172,7 +172,7 @@ bus_apparmor_set_mode_from_config (const char *mode, DBusError *error) * confinement context. */ dbus_bool_t -bus_apparmor_full_init (void) +bus_apparmor_full_init (DBusError *error) { #ifdef HAVE_APPARMOR if (apparmor_enabled) @@ -187,7 +187,8 @@ bus_apparmor_full_init (void) { if (apparmor_config_mode == APPARMOR_REQUIRED) { - _dbus_warn ("AppArmor mediation required but not present\n"); + dbus_set_error (error, DBUS_ERROR_FAILED, + "AppArmor mediation required but not present\n"); return FALSE; } else if (apparmor_config_mode == APPARMOR_ENABLED) diff --git a/bus/apparmor.h b/bus/apparmor.h index bf8f94f..66a77c0 100644 --- a/bus/apparmor.h +++ b/bus/apparmor.h @@ -32,7 +32,7 @@ void bus_apparmor_audit_init (void); dbus_bool_t bus_apparmor_pre_init (void); dbus_bool_t bus_apparmor_set_mode_from_config (const char *mode, DBusError *error); -dbus_bool_t bus_apparmor_full_init (void); +dbus_bool_t bus_apparmor_full_init (DBusError *error); void bus_apparmor_shutdown (void); dbus_bool_t bus_apparmor_enabled (void); diff --git a/bus/bus.c b/bus/bus.c index 4cafddf..2c2c564 100644 --- a/bus/bus.c +++ b/bus/bus.c @@ -934,10 +934,9 @@ bus_context_new (const DBusString *config_file, bus_context_log (context, DBUS_SYSTEM_LOG_FATAL, "SELinux enabled but D-Bus initialization failed; check system log\n"); } - if (!bus_apparmor_full_init ()) + if (!bus_apparmor_full_init (error)) { - dbus_set_error (error, DBUS_ERROR_FAILED, - "AppArmor enabled but full initialization failed; check system log\n"); + _DBUS_ASSERT_ERROR_IS_SET (error); goto failed; } -- 2.1.0