#include "bpf-firewall.h"
#include "bpf-foreign.h"
#include "bus-get-properties.h"
+#include "bus-util.h"
#include "cgroup-util.h"
#include "cgroup.h"
#include "core-varlink.h"
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
- int r;
+
CGroupContext *c = ASSERT_PTR(userdata);
- char *iface;
+ int r;
assert(bus);
assert(reply);
if (r < 0)
return r;
- r = sd_bus_message_open_container(reply, 'a', "s");
- if (r < 0)
- return r;
-
- SET_FOREACH(iface, c->restrict_network_interfaces) {
- r = sd_bus_message_append(reply, "s", iface);
- if (r < 0)
- return r;
- }
-
- r = sd_bus_message_close_container(reply);
+ r = bus_message_append_string_set(reply, c->restrict_network_interfaces);
if (r < 0)
return r;
#include "af-list.h"
#include "alloc-util.h"
#include "bus-get-properties.h"
+#include "bus-util.h"
#include "cap-list.h"
#include "capability-util.h"
#include "cpu-set-util.h"
sd_bus_error *error) {
ExecContext *c = ASSERT_PTR(userdata);
- const char *s;
- int r;
assert(bus);
assert(property);
assert(reply);
- r = sd_bus_message_open_container(reply, 'a', "s");
- if (r < 0)
- return r;
-
- SET_FOREACH(s, c->import_credentials) {
- r = sd_bus_message_append(reply, "s", s);
- if (r < 0)
- return r;
- }
-
- return sd_bus_message_close_container(reply);
+ return bus_message_append_string_set(reply, c->import_credentials);
}
static int property_get_root_hash(
sd_bus_error *error) {
Manager *m = ASSERT_PTR(userdata);
- const char *domain;
- int r;
assert(reply);
- r = sd_bus_message_open_container(reply, 'a', "s");
- if (r < 0)
- return r;
-
- SET_FOREACH(domain, m->trust_anchor.negative_by_name) {
- r = sd_bus_message_append(reply, "s", domain);
- if (r < 0)
- return r;
- }
-
- return sd_bus_message_close_container(reply);
+ return bus_message_append_string_set(reply, m->trust_anchor.negative_by_name);
}
static BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_dns_stub_listener_mode, dns_stub_listener_mode, DnsStubListenerMode);
sd_bus_error *error) {
Link *l = ASSERT_PTR(userdata);
- const char *name;
- int r;
assert(reply);
- r = sd_bus_message_open_container(reply, 'a', "s");
- if (r < 0)
- return r;
-
- SET_FOREACH(name, l->dnssec_negative_trust_anchors) {
- r = sd_bus_message_append(reply, "s", name);
- if (r < 0)
- return r;
- }
-
- return sd_bus_message_close_container(reply);
+ return bus_message_append_string_set(reply, l->dnssec_negative_trust_anchors);
}
static int verify_unmanaged_link(Link *l, sd_bus_error *error) {
.compare = trivial_compare_func,
.free_value = bus_message_unref_wrapper,
};
+
+int bus_message_append_string_set(sd_bus_message *m, Set *set) {
+ const char *s;
+ int r;
+
+ assert(m);
+
+ r = sd_bus_message_open_container(m, 'a', "s");
+ if (r < 0)
+ return r;
+
+ SET_FOREACH(s, set) {
+ r = sd_bus_message_append(m, "s", s);
+ if (r < 0)
+ return r;
+ }
+
+ return sd_bus_message_close_container(m);
+}
#include "errno-util.h"
#include "macro.h"
#include "runtime-scope.h"
+#include "set.h"
#include "string-util.h"
#include "time-util.h"
int bus_register_malloc_status(sd_bus *bus, const char *destination);
extern const struct hash_ops bus_message_hash_ops;
+
+int bus_message_append_string_set(sd_bus_message *m, Set *s);