sd_bus_message *m,
const char *action,
const char **details,
- bool interactive,
+ PolkitFlags flags,
sd_bus_message **ret) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *c = NULL;
if (r < 0)
return r;
- r = sd_bus_message_append(c, "us", interactive, NULL);
+ r = sd_bus_message_append(c, "us", (uint32_t) (flags & _POLKIT_MASK_PUBLIC), NULL);
if (r < 0)
return r;
}
#if ENABLE_POLKIT
- bool interactive = FLAGS_SET(flags, POLKIT_ALLOW_INTERACTIVE);
-
int c = sd_bus_message_get_allow_interactive_authorization(call);
if (c < 0)
return c;
if (c > 0)
- interactive = true;
+ flags |= POLKIT_ALLOW_INTERACTIVE;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *pk = NULL;
- r = bus_message_new_polkit_auth_call_for_bus(call, action, details, interactive, &pk);
+ r = bus_message_new_polkit_auth_call_for_bus(call, action, details, flags, &pk);
if (r < 0)
return r;
sd_varlink *link,
const char *action,
const char **details,
- bool interactive,
+ PolkitFlags flags,
sd_bus_message **ret) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *c = NULL;
if (r < 0)
return r;
- r = sd_bus_message_append(c, "us", interactive, NULL);
+ r = sd_bus_message_append(c, "us", (uint32_t) (flags & _POLKIT_MASK_PUBLIC), NULL);
if (r < 0)
return r;
bus = mybus;
}
- bool interactive =
- FLAGS_SET(flags, POLKIT_ALLOW_INTERACTIVE) ||
- varlink_allow_interactive_authentication(link);
+ if (varlink_allow_interactive_authentication(link))
+ flags |= POLKIT_ALLOW_INTERACTIVE;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *pk = NULL;
- r = bus_message_new_polkit_auth_call_for_varlink(bus, link, action, details, interactive, &pk);
+ r = bus_message_new_polkit_auth_call_for_varlink(bus, link, action, details, flags, &pk);
if (r < 0)
return r;
POLKIT_ALWAYS_QUERY = 1 << 1, /* Query polkit even if client is privileged */
POLKIT_DEFAULT_ALLOW = 1 << 2, /* If polkit is not around, assume "allow" rather than the usual "deny" */
POLKIT_DONT_REPLY = 1 << 3, /* Varlink: don't immediately propagate polkit error to the Varlink client */
+ _POLKIT_MASK_PUBLIC = POLKIT_ALLOW_INTERACTIVE | POLKIT_ALWAYS_QUERY, /* polkit accepts these flags verbatim */
} PolkitFlags;
int bus_test_polkit(sd_bus_message *call, const char *action, const char **details, uid_t good_user, bool *_challenge, sd_bus_error *e);