e = sd_bus_message_get_error(reply);
- if (bus_error_is_unknown_service(e))
- /* Treat no PK available as access denied */
+ if (bus_error_is_unknown_service(e) ||
+ sd_bus_error_has_names(
+ e,
+ "org.freedesktop.PolicyKit1.Error.Failed",
+ "org.freedesktop.PolicyKit1.Error.Cancelled",
+ "org.freedesktop.PolicyKit1.Error.NotAuthorized"))
+ /* Treat no PK available as access denied. Also treat some of the well-known PK errors as such. */
q->denied_action = TAKE_PTR(a);
else {
/* Save error from polkit reply, so it can be returned when the same authorization