summaryrefslogtreecommitdiff
path: root/bus/bus.c
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2008-01-15 14:20:43 -0500
committerJohn (J5) Palmieri <johnp@redhat.com>2008-01-15 14:20:43 -0500
commit9db435926fb82409caa2b5a7139781a95f105a63 (patch)
tree66d90fdc0a098214cb29cdffd56538c45806c08d /bus/bus.c
parentc18415e2c6e151b773a90e66188714124ee8b867 (diff)
rewrite selinux error handling to not abort due to a NULL read
2008-01-15 John (J5) Palmieri <johnp@redhat.com> * bus/bus.c (bus_context_check_security_policy): rewrite selinux error handling to not abort due to a NULL read and to set the error only if it is not already set (Based off of FDO Bug #12430)
Diffstat (limited to 'bus/bus.c')
-rw-r--r--bus/bus.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/bus/bus.c b/bus/bus.c
index 99e48569..864e48ba 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -1180,27 +1180,23 @@ bus_context_check_security_policy (BusContext *context,
dbus_message_get_error_name (message),
dest ? dest : DBUS_SERVICE_DBUS, error))
{
+ if (error != NULL && !dbus_error_is_set (error))
+ {
+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+ "An SELinux policy prevents this sender "
+ "from sending this message to this recipient "
+ "(rejected message had interface \"%s\" "
+ "member \"%s\" error name \"%s\" destination \"%s\")",
+ 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);
+ _dbus_verbose ("SELinux security check denying send to service\n");
+ }
- if (dbus_error_is_set (error) &&
- dbus_error_has_name (error, DBUS_ERROR_NO_MEMORY))
- {
- return FALSE;
- }
-
-
- dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
- "An SELinux policy prevents this sender "
- "from sending this message to this recipient "
- "(rejected message had interface \"%s\" "
- "member \"%s\" error name \"%s\" destination \"%s\")",
- 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);
- _dbus_verbose ("SELinux security check denying send to service\n");
return FALSE;
}