diff options
Diffstat (limited to 'src/shared/bus-polkit.c')
-rw-r--r-- | src/shared/bus-polkit.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/shared/bus-polkit.c b/src/shared/bus-polkit.c index 00c55463c8..ed884c3001 100644 --- a/src/shared/bus-polkit.c +++ b/src/shared/bus-polkit.c @@ -7,6 +7,7 @@ #include "process-util.h" #include "strv.h" #include "user-util.h" +#include "varlink-util.h" static int bus_message_check_good_user(sd_bus_message *m, uid_t good_user) { _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL; @@ -190,7 +191,7 @@ typedef struct AsyncPolkitQuery { sd_bus *bus; sd_bus_message *request; /* the original bus method call that triggered the polkit auth, NULL in case of varlink */ sd_bus_slot *slot; - Varlink *link; /* the original varlink method call that triggered the polkit auth, NULL in case of bus */ + sd_varlink *link; /* the original varlink method call that triggered the polkit auth, NULL in case of bus */ Hashmap *registry; sd_event_source *defer_event_source; @@ -218,7 +219,7 @@ static AsyncPolkitQuery *async_polkit_query_free(AsyncPolkitQuery *q) { sd_bus_message_unref(q->request); sd_bus_unref(q->bus); - varlink_unref(q->link); + sd_varlink_unref(q->link); async_polkit_query_action_free(q->action); @@ -374,7 +375,7 @@ static int async_polkit_process_reply(sd_bus_message *reply, AsyncPolkitQuery *q } if (q->link) { - r = varlink_dispatch_again(q->link); + r = sd_varlink_dispatch_again(q->link); if (r < 0) return r; } @@ -394,7 +395,7 @@ static int async_polkit_callback(sd_bus_message *reply, void *userdata, sd_bus_e if (q->request) (void) sd_bus_reply_method_errno(q->request, r, NULL); if (q->link) - (void) varlink_error_errno(q->link, r); + (void) sd_varlink_error_errno(q->link, r); async_polkit_query_unref(q); } return r; @@ -625,7 +626,7 @@ int bus_verify_polkit_async_full( #endif } -static int varlink_check_good_user(Varlink *link, uid_t good_user) { +static int varlink_check_good_user(sd_varlink *link, uid_t good_user) { int r; assert(link); @@ -634,20 +635,20 @@ static int varlink_check_good_user(Varlink *link, uid_t good_user) { return false; uid_t peer_uid; - r = varlink_get_peer_uid(link, &peer_uid); + r = sd_varlink_get_peer_uid(link, &peer_uid); if (r < 0) return r; return good_user == peer_uid; } -static int varlink_check_peer_privilege(Varlink *link) { +static int varlink_check_peer_privilege(sd_varlink *link) { int r; assert(link); uid_t peer_uid; - r = varlink_get_peer_uid(link, &peer_uid); + r = sd_varlink_get_peer_uid(link, &peer_uid); if (r < 0) return r; @@ -659,7 +660,7 @@ static int varlink_check_peer_privilege(Varlink *link) { #if ENABLE_POLKIT static int bus_message_new_polkit_auth_call_for_varlink( sd_bus *bus, - Varlink *link, + sd_varlink *link, const char *action, const char **details, bool interactive, @@ -681,7 +682,7 @@ static int bus_message_new_polkit_auth_call_for_varlink( return log_debug_errno(SYNTHETIC_ERRNO(EPERM), "Failed to get peer pidfd, cannot securely authenticate."); uid_t uid; - r = varlink_get_peer_uid(link, &uid); + r = sd_varlink_get_peer_uid(link, &uid); if (r < 0) return r; @@ -717,7 +718,7 @@ static int bus_message_new_polkit_auth_call_for_varlink( return 0; } -static bool varlink_allow_interactive_authentication(Varlink *link) { +static bool varlink_allow_interactive_authentication(sd_varlink *link) { _cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL; int r; @@ -726,7 +727,7 @@ static bool varlink_allow_interactive_authentication(Varlink *link) { /* We look for the allowInteractiveAuthentication field in the message currently being dispatched, * always under the same name. */ - r = varlink_get_current_parameters(link, &v); + r = sd_varlink_get_current_parameters(link, &v); if (r < 0) { log_debug_errno(r, "Unable to query current parameters: %m"); return false; @@ -746,7 +747,7 @@ static bool varlink_allow_interactive_authentication(Varlink *link) { #endif int varlink_verify_polkit_async_full( - Varlink *link, + sd_varlink *link, sd_bus *bus, const char *action, const char **details, @@ -789,9 +790,9 @@ int varlink_verify_polkit_async_full( if (!FLAGS_SET(flags, POLKIT_DONT_REPLY)) { /* Reply with a nice error */ if (sd_bus_error_has_name(&error, SD_BUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED)) - (void) varlink_error(link, VARLINK_ERROR_INTERACTIVE_AUTHENTICATION_REQUIRED, NULL); + (void) sd_varlink_error(link, SD_VARLINK_ERROR_INTERACTIVE_AUTHENTICATION_REQUIRED, NULL); else if (ERRNO_IS_NEG_PRIVILEGE(r)) - (void) varlink_error(link, VARLINK_ERROR_PERMISSION_DENIED, NULL); + (void) sd_varlink_error(link, SD_VARLINK_ERROR_PERMISSION_DENIED, NULL); } return r; @@ -806,7 +807,7 @@ int varlink_verify_polkit_async_full( if (r < 0) return r; - r = sd_bus_attach_event(mybus, varlink_get_event(link), 0); + r = sd_bus_attach_event(mybus, sd_varlink_get_event(link), 0); if (r < 0) return r; @@ -829,7 +830,7 @@ int varlink_verify_polkit_async_full( *q = (AsyncPolkitQuery) { .n_ref = 1, - .link = varlink_ref(link), + .link = sd_varlink_ref(link), .bus = sd_bus_ref(bus), }; } @@ -866,7 +867,7 @@ int varlink_verify_polkit_async_full( #endif } -bool varlink_has_polkit_action(Varlink *link, const char *action, const char **details, Hashmap **registry) { +bool varlink_has_polkit_action(sd_varlink *link, const char *action, const char **details, Hashmap **registry) { assert(link); assert(action); assert(registry); |