diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/polkit.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/shared/polkit.c b/src/shared/polkit.c index 14e27cdc60..9ed6ff2717 100644 --- a/src/shared/polkit.c +++ b/src/shared/polkit.c @@ -46,6 +46,7 @@ int verify_polkit( DBusMessageIter iter_msg, iter_struct, iter_array, iter_dict, iter_variant; int r; dbus_bool_t authorized = FALSE, challenge = FALSE; + unsigned long ul; assert(c); assert(request); @@ -54,6 +55,14 @@ int verify_polkit( if (!sender) return -EINVAL; + ul = dbus_bus_get_unix_user(c, sender, error); + if (ul == (unsigned) -1) + return -EINVAL; + + /* Shortcut things for root, to avoid the PK roundtrip and dependency */ + if (ul == 0) + return 1; + pid_raw = bus_get_unix_process_id(c, sender, error); if (pid_raw == 0) return -EINVAL; @@ -144,7 +153,6 @@ int verify_polkit( r = -EPERM; finish: - if (m) dbus_message_unref(m); |