chiark / gitweb /
bus-util: print RestrictNamespaces= as a string
[elogind.git] / src / shared / bus-util.c
index d22a613af56c9b4e794726fd6f461c0d1850fbc4..2d1b3b9654061bbc7fda308ffb0f880b987840de 100644 (file)
@@ -679,7 +679,7 @@ int bus_connect_user_systemd(sd_bus **_bus) {
         if (r < 0)
                 return r;
 
-        bus->address = strjoin("unix:path=", ee, "/systemd/private", NULL);
+        bus->address = strjoin("unix:path=", ee, "/systemd/private");
         if (!bus->address)
                 return -ENOMEM;
 
@@ -773,6 +773,23 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b
                         char timespan[FORMAT_TIMESPAN_MAX];
 
                         print_property(name, "%s", format_timespan(timespan, sizeof(timespan), u, 0));
+                } else if (streq(name, "RestrictNamespaces")) {
+                        _cleanup_free_ char *s = NULL;
+                        const char *result = NULL;
+
+                        if ((u & NAMESPACE_FLAGS_ALL) == 0)
+                                result = "yes";
+                        else if ((u & NAMESPACE_FLAGS_ALL) == NAMESPACE_FLAGS_ALL)
+                                result = "no";
+                        else {
+                                r = namespace_flag_to_string_many(u, &s);
+                                if (r < 0)
+                                        return r;
+
+                                result = s;
+                        }
+
+                        print_property(name, "%s", result);
                 } else
                         print_property(name, "%"PRIu64, u);
 
@@ -1334,6 +1351,7 @@ int bus_property_get_bool(
         return sd_bus_message_append_basic(reply, 'b', &b);
 }
 
+#if 0 /// UNNEEDED by elogind
 int bus_property_get_id128(
                 sd_bus *bus,
                 const char *path,
@@ -1350,6 +1368,7 @@ int bus_property_get_id128(
         else
                 return sd_bus_message_append_array(reply, 'y', id->bytes, 16);
 }
+#endif // 0
 
 #if __SIZEOF_SIZE_T__ != 8
 int bus_property_get_size(
@@ -1473,7 +1492,7 @@ int bus_path_encode_unique(sd_bus *b, const char *prefix, const char *sender_id,
         if (!external_label)
                 return -ENOMEM;
 
-        p = strjoin(prefix, "/", sender_label, "/", external_label, NULL);
+        p = strjoin(prefix, "/", sender_label, "/", external_label);
         if (!p)
                 return -ENOMEM;