summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/dbus.c2
-rw-r--r--src/home/homed-manager.c2
-rw-r--r--src/hostname/hostnamed.c2
-rw-r--r--src/import/importd.c2
-rw-r--r--src/locale/localed-util.c2
-rw-r--r--src/login/logind.c2
-rw-r--r--src/machine/machined.c2
-rw-r--r--src/network/networkd-manager.c3
-rw-r--r--src/oom/oomd-manager.c2
-rw-r--r--src/portable/portabled.c2
-rw-r--r--src/resolve/resolved-manager.c2
-rw-r--r--src/shared/bus-polkit.c21
-rw-r--r--src/shared/bus-polkit.h2
-rw-r--r--src/timedate/timedated.c2
-rw-r--r--src/timesync/timesyncd-manager.c2
15 files changed, 23 insertions, 27 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c
index f7d4a97096..e24c5bbc53 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -1073,7 +1073,7 @@ void bus_done(Manager *m) {
assert(!m->subscribed);
m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ m->polkit_registry = hashmap_free(m->polkit_registry);
}
int bus_fdset_add_all(Manager *m, FDSet *fds) {
diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c
index c4525310fc..94b2ea5181 100644
--- a/src/home/homed-manager.c
+++ b/src/home/homed-manager.c
@@ -268,7 +268,7 @@ Manager* manager_free(Manager *m) {
(void) home_wait_for_worker(h);
m->bus = sd_bus_flush_close_unref(m->bus);
- m->polkit_registry = bus_verify_polkit_async_registry_free(m->polkit_registry);
+ m->polkit_registry = hashmap_free(m->polkit_registry);
m->device_monitor = sd_device_monitor_unref(m->device_monitor);
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 893eb4cc0f..f0e643822a 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -91,7 +91,7 @@ static void context_destroy(Context *c) {
assert(c);
context_reset(c, UINT64_MAX);
- bus_verify_polkit_async_registry_free(c->polkit_registry);
+ hashmap_free(c->polkit_registry);
}
static void context_read_etc_hostname(Context *c) {
diff --git a/src/import/importd.c b/src/import/importd.c
index e9bbbb628d..8bc8a32866 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -527,7 +527,7 @@ static Manager *manager_unref(Manager *m) {
hashmap_free(m->transfers);
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ hashmap_free(m->polkit_registry);
m->bus = sd_bus_flush_close_unref(m->bus);
sd_event_unref(m->event);
diff --git a/src/locale/localed-util.c b/src/locale/localed-util.c
index e4e57a0f4a..0489df573b 100644
--- a/src/locale/localed-util.c
+++ b/src/locale/localed-util.c
@@ -304,7 +304,7 @@ void context_clear(Context *c) {
c->x11_cache = sd_bus_message_unref(c->x11_cache);
c->vc_cache = sd_bus_message_unref(c->vc_cache);
- c->polkit_registry = bus_verify_polkit_async_registry_free(c->polkit_registry);
+ c->polkit_registry = hashmap_free(c->polkit_registry);
};
X11Context *context_get_x11_context(Context *c) {
diff --git a/src/login/logind.c b/src/login/logind.c
index 965e2a4aef..e96ddf5ae4 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -154,7 +154,7 @@ static Manager* manager_free(Manager *m) {
if (m->unlink_nologin)
(void) unlink_or_warn("/run/nologin");
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ hashmap_free(m->polkit_registry);
sd_bus_flush_close_unref(m->bus);
sd_event_unref(m->event);
diff --git a/src/machine/machined.c b/src/machine/machined.c
index 58a407d451..4e830a4bc2 100644
--- a/src/machine/machined.c
+++ b/src/machine/machined.c
@@ -96,7 +96,7 @@ static Manager* manager_unref(Manager *m) {
sd_event_source_unref(m->nscd_cache_flush_event);
#endif
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ hashmap_free(m->polkit_registry);
manager_varlink_done(m);
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index e81905ad98..8933fc4977 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -638,8 +638,7 @@ Manager* manager_free(Manager *m) {
sd_device_monitor_unref(m->device_monitor);
manager_varlink_done(m);
-
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ hashmap_free(m->polkit_registry);
sd_bus_flush_close_unref(m->bus);
free(m->dynamic_timezone);
diff --git a/src/oom/oomd-manager.c b/src/oom/oomd-manager.c
index 6081254b3d..23c3ae64ab 100644
--- a/src/oom/oomd-manager.c
+++ b/src/oom/oomd-manager.c
@@ -642,7 +642,7 @@ Manager* manager_free(Manager *m) {
sd_event_source_unref(m->mem_pressure_context_event_source);
sd_event_unref(m->event);
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ hashmap_free(m->polkit_registry);
sd_bus_flush_close_unref(m->bus);
hashmap_free(m->monitored_swap_cgroup_contexts);
diff --git a/src/portable/portabled.c b/src/portable/portabled.c
index 136c5fa191..7c2ddd90ef 100644
--- a/src/portable/portabled.c
+++ b/src/portable/portabled.c
@@ -65,7 +65,7 @@ static Manager* manager_unref(Manager *m) {
sd_event_source_unref(m->image_cache_defer_event);
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ hashmap_free(m->polkit_registry);
sd_bus_flush_close_unref(m->bus);
sd_event_unref(m->event);
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 0295662b5b..a0251b4b97 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -731,7 +731,7 @@ Manager *manager_free(Manager *m) {
ordered_set_free(m->dns_extra_stub_listeners);
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ hashmap_free(m->polkit_registry);
sd_bus_flush_close_unref(m->bus);
diff --git a/src/shared/bus-polkit.c b/src/shared/bus-polkit.c
index 928b2c3d5b..fe9363aad4 100644
--- a/src/shared/bus-polkit.c
+++ b/src/shared/bus-polkit.c
@@ -236,6 +236,14 @@ static AsyncPolkitQuery *async_polkit_query_free(AsyncPolkitQuery *q) {
DEFINE_PRIVATE_TRIVIAL_REF_UNREF_FUNC(AsyncPolkitQuery, async_polkit_query, async_polkit_query_free);
DEFINE_TRIVIAL_CLEANUP_FUNC(AsyncPolkitQuery*, async_polkit_query_unref);
+DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
+ async_polkit_query_hash_ops,
+ void,
+ trivial_hash_func,
+ trivial_compare_func,
+ AsyncPolkitQuery,
+ async_polkit_query_unref);
+
static int async_polkit_defer(sd_event_source *s, void *userdata) {
AsyncPolkitQuery *q = ASSERT_PTR(userdata);
@@ -557,7 +565,7 @@ int bus_verify_polkit_async_full(
return -ENOMEM;
if (!q->registry) {
- r = hashmap_ensure_put(registry, /* hash_ops= */ NULL, call, q);
+ r = hashmap_ensure_put(registry, &async_polkit_query_hash_ops, call, q);
if (r < 0)
return r;
@@ -576,15 +584,6 @@ int bus_verify_polkit_async_full(
return -EACCES;
}
-Hashmap *bus_verify_polkit_async_registry_free(Hashmap *registry) {
-#if ENABLE_POLKIT
- return hashmap_free_with_destructor(registry, async_polkit_query_unref);
-#else
- assert(hashmap_isempty(registry));
- return hashmap_free(registry);
-#endif
-}
-
static int varlink_check_good_user(Varlink *link, uid_t good_user) {
int r;
@@ -795,7 +794,7 @@ int varlink_verify_polkit_async(
return -ENOMEM;
if (!q->registry) {
- r = hashmap_ensure_put(registry, /* hash_ops= */ NULL, link, q);
+ r = hashmap_ensure_put(registry, &async_polkit_query_hash_ops, link, q);
if (r < 0)
return r;
diff --git a/src/shared/bus-polkit.h b/src/shared/bus-polkit.h
index ac2a90c3c7..0fe3a4ca0e 100644
--- a/src/shared/bus-polkit.h
+++ b/src/shared/bus-polkit.h
@@ -14,8 +14,6 @@ static inline int bus_verify_polkit_async(sd_bus_message *call, const char *acti
return bus_verify_polkit_async_full(call, action, details, false, UID_INVALID, registry, ret_error);
}
-Hashmap *bus_verify_polkit_async_registry_free(Hashmap *registry);
-
int varlink_verify_polkit_async(Varlink *link, sd_bus *bus, const char *action, const char **details, uid_t good_user, Hashmap **registry);
/* A JsonDispatch initializer that makes sure the allowInteractiveAuthentication boolean field we want for
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 53c2a6fb71..b4a58fc692 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -119,7 +119,7 @@ static void context_clear(Context *c) {
assert(c);
free(c->zone);
- bus_verify_polkit_async_registry_free(c->polkit_registry);
+ hashmap_free(c->polkit_registry);
sd_bus_message_unref(c->cache);
sd_bus_slot_unref(c->slot_job_removed);
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index 1317bc0f76..6ed15aa402 100644
--- a/src/timesync/timesyncd-manager.c
+++ b/src/timesync/timesyncd-manager.c
@@ -962,7 +962,7 @@ Manager* manager_free(Manager *m) {
sd_bus_flush_close_unref(m->bus);
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ hashmap_free(m->polkit_registry);
return mfree(m);
}