bus_context_check_security_policy: for SELinux denials, share code to set errors
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 15 Mar 2011 14:02:06 +0000 (14:02 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 25 May 2011 17:16:29 +0000 (18:16 +0100)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35358
Reviewed-by: Colin Walters <walters@verbum.org>
bus/bus.c

index bf327248dd7b12b46a02c43a341ed2aa560447a2..19436f9a1bbd1d99ef4ca40767dceac93b1e4ab3 100644 (file)
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -1455,21 +1455,12 @@ bus_context_check_security_policy (BusContext     *context,
         {
           if (error != NULL && !dbus_error_is_set (error))
             {
-              sender_name = bus_connection_get_name (sender);
-
-              dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
-                              "An SELinux policy prevents this sender "
-                              "from sending this message to this recipient "
-                              "(rejected message had sender \"%s\" interface \"%s\" "
-                              "member \"%s\" error name \"%s\" destination \"%s\")",
-                              sender_name ? sender_name : "(unset)",
-                              dbus_message_get_interface (message) ?
-                              dbus_message_get_interface (message) : "(unset)",
-                              dbus_message_get_member (message) ?
-                              dbus_message_get_member (message) : "(unset)",
-                              dbus_message_get_error_name (message) ?
-                              dbus_message_get_error_name (message) : "(unset)",
-                              dest ? dest : DBUS_SERVICE_DBUS);
+              /* don't syslog this, just set the error: avc_has_perm should
+               * have already written to either the audit log or syslog */
+              complain_about_message (context,
+                  "An SELinux policy prevents this sender from sending this "
+                  "message to this recipient",
+                  0, message, sender, proposed_recipient, FALSE, FALSE, error);
               _dbus_verbose ("SELinux security check denying send to service\n");
             }