diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-08-18 17:44:17 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-18 17:49:53 +0200 |
commit | f38857914ab5c9cc55aac05795e1886963a5fd04 (patch) | |
tree | e03443f7f0f673a2fcd604df5ea7b603f7c1e589 /src/locale | |
parent | caa829849d6ac9f6e173f585f732054358311ae1 (diff) |
bus-util: simplify bus_verify_polkit_async() a bit
First, let's drop the "bus" argument, we can determine it from the
message anyway.
Secondly, determine the right callback/userdata pair automatically from
what is currently is being dispatched. This should simplify things a lot
for us, since it makes it unnecessary to pass pointers through the
original handlers through all functions when we process messages, which
might require authentication.
Diffstat (limited to 'src/locale')
-rw-r--r-- | src/locale/localed.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/locale/localed.c b/src/locale/localed.c index 5c0bc2c84e..508a00079e 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -877,9 +877,7 @@ static int method_set_locale(sd_bus *bus, sd_bus_message *m, void *userdata, sd_ } if (modified) { - r = bus_verify_polkit_async(bus, &c->polkit_registry, m, CAP_SYS_ADMIN, - "org.freedesktop.locale1.set-locale", interactive, - error, method_set_locale, c); + r = bus_verify_polkit_async(m, CAP_SYS_ADMIN, "org.freedesktop.locale1.set-locale", interactive, &c->polkit_registry, error); if (r < 0) return r; if (r == 0) @@ -955,9 +953,7 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata (keymap_toggle && (!filename_is_safe(keymap_toggle) || !string_is_safe(keymap_toggle)))) return sd_bus_error_set_errnof(error, -EINVAL, "Received invalid keymap data"); - r = bus_verify_polkit_async(bus, &c->polkit_registry, m, CAP_SYS_ADMIN, - "org.freedesktop.locale1.set-keyboard", - interactive, error, method_set_vc_keyboard, c); + r = bus_verify_polkit_async(m, CAP_SYS_ADMIN, "org.freedesktop.locale1.set-keyboard", interactive, &c->polkit_registry, error); if (r < 0) return r; if (r == 0) @@ -1027,9 +1023,7 @@ static int method_set_x11_keyboard(sd_bus *bus, sd_bus_message *m, void *userdat (options && !string_is_safe(options))) return sd_bus_error_set_errnof(error, -EINVAL, "Received invalid keyboard data"); - r = bus_verify_polkit_async(bus, &c->polkit_registry, m, CAP_SYS_ADMIN, - "org.freedesktop.locale1.set-keyboard", - interactive, error, method_set_x11_keyboard, c); + r = bus_verify_polkit_async(m, CAP_SYS_ADMIN, "org.freedesktop.locale1.set-keyboard", interactive, &c->polkit_registry, error); if (r < 0) return r; if (r == 0) |