Commit 7dc49177 authored by Laurent Bigonville's avatar Laurent Bigonville
Browse files

Set a DBusError in all failing paths of bus_selinux_check()

Bug: dbus/dbus#198
parent 79bb1b4b
Pipeline #68074 passed with stage
in 14 minutes and 45 seconds
......@@ -423,13 +423,16 @@ bus_selinux_check (BusSELinuxID *sender_sid,
switch (errno)
{
case EACCES:
_dbus_verbose ("SELinux denying due to security policy.\n");
dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
"SELinux denying due to security policy.");
return FALSE;
case EINVAL:
_dbus_verbose ("SELinux denying due to invalid security context.\n");
dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
"SELinux denying due to invalid security context.");
return FALSE;
default:
_dbus_verbose ("SELinux denying due to: %s\n", _dbus_strerror (errno));
dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
"SELinux denying due to: %s", _dbus_strerror (errno));
return FALSE;
}
}
......
......@@ -445,20 +445,13 @@ bus_registry_acquire_service (BusRegistry *registry,
if (!bus_selinux_allows_acquire_service (connection, sid,
_dbus_string_get_const_data (service_name), error))
{
if (dbus_error_is_set (error) &&
dbus_error_has_name (error, DBUS_ERROR_NO_MEMORY))
{
goto out;
}
dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
"Connection \"%s\" is not allowed to own the service \"%s\" due "
"to SELinux policy",
_dbus_verbose ( "Connection \"%s\" is not allowed to own the service \"%s\" due "
"to SELinux policy: \"%s\"\n",
bus_connection_is_active (connection) ?
bus_connection_get_name (connection) :
"(inactive)",
_dbus_string_get_const_data (service_name));
_dbus_string_get_const_data (service_name),
error->message);
goto out;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment