]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/bus-polkit.h
Merge pull request #30739 from poettering/pam-util-many
[thirdparty/systemd.git] / src / shared / bus-polkit.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "sd-bus.h"
5
6 #include "hashmap.h"
7 #include "user-util.h"
8 #include "varlink.h"
9
10 int bus_test_polkit(sd_bus_message *call, const char *action, const char **details, uid_t good_user, bool *_challenge, sd_bus_error *e);
11
12 int bus_verify_polkit_async_full(sd_bus_message *call, const char *action, const char **details, bool interactive, uid_t good_user, Hashmap **registry, sd_bus_error *error);
13 static inline int bus_verify_polkit_async(sd_bus_message *call, const char *action, const char **details, Hashmap **registry, sd_bus_error *ret_error) {
14 return bus_verify_polkit_async_full(call, action, details, false, UID_INVALID, registry, ret_error);
15 }
16
17 int varlink_verify_polkit_async(Varlink *link, sd_bus *bus, const char *action, const char **details, uid_t good_user, Hashmap **registry);
18
19 /* A JsonDispatch initializer that makes sure the allowInteractiveAuthentication boolean field we want for
20 * polkit support in Varlink calls is ignored while regular dispatching (and does not result in errors
21 * regarding unexpected fields) */
22 #define VARLINK_DISPATCH_POLKIT_FIELD { \
23 .name = "allowInteractiveAuthentication", \
24 .type = JSON_VARIANT_BOOLEAN, \
25 }