mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 09:58:07 +02:00
Improve diagnostics when UpdateActivationEnvironment calls are rejected
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88812 Reviewed-by: Colin Walters <walters@verbum.org> [smcv: rebased to not require the extra code initially on that bug]
This commit is contained in:
parent
e488588501
commit
49d67163da
1 changed files with 15 additions and 2 deletions
17
bus/driver.c
17
bus/driver.c
|
|
@ -43,6 +43,13 @@
|
|||
#include <dbus/dbus-marshal-validate.h>
|
||||
#include <string.h>
|
||||
|
||||
static inline const char *
|
||||
nonnull (const char *maybe_null,
|
||||
const char *if_null)
|
||||
{
|
||||
return (maybe_null ? maybe_null : if_null);
|
||||
}
|
||||
|
||||
static DBusConnection *
|
||||
bus_driver_get_owner_of_name (DBusConnection *connection,
|
||||
const char *name)
|
||||
|
|
@ -121,7 +128,10 @@ bus_driver_check_caller_is_privileged (DBusConnection *connection,
|
|||
|
||||
bus_context_log_and_set_error (bus_transaction_get_context (transaction),
|
||||
DBUS_SYSTEM_LOG_SECURITY, error, DBUS_ERROR_ACCESS_DENIED,
|
||||
"rejected attempt to call %s by unknown uid", method);
|
||||
"rejected attempt to call %s by connection %s (%s) with "
|
||||
"unknown uid", method,
|
||||
nonnull (bus_connection_get_name (connection), "(inactive)"),
|
||||
bus_connection_get_loginfo (connection));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +152,10 @@ bus_driver_check_caller_is_privileged (DBusConnection *connection,
|
|||
|
||||
bus_context_log_and_set_error (bus_transaction_get_context (transaction),
|
||||
DBUS_SYSTEM_LOG_SECURITY, error, DBUS_ERROR_ACCESS_DENIED,
|
||||
"rejected attempt to call %s by uid %lu", method, uid);
|
||||
"rejected attempt to call %s by connection %s (%s) with "
|
||||
"uid %lu", method,
|
||||
nonnull (bus_connection_get_name (connection), "(inactive)"),
|
||||
bus_connection_get_loginfo (connection), uid);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue