chiark / gitweb /
bus: always pass valid timeout to kdbus
[elogind.git] / src / libsystemd-bus / bus-introspect.c
index 1965364cd0ae26a62350922c532724c2ed7fe433..504fab1b4b3b9b08861bc9e5985aa27d245bb2f7 100644 (file)
@@ -24,6 +24,7 @@
 #include "bus-introspect.h"
 #include "bus-signature.h"
 #include "bus-internal.h"
+#include "bus-protocol.h"
 
 int introspect_begin(struct introspect *i) {
         assert(i);
@@ -34,7 +35,7 @@ int introspect_begin(struct introspect *i) {
         if (!i->f)
                 return -ENOMEM;
 
-        fputs(SD_BUS_INTROSPECT_DOCTYPE
+        fputs(BUS_INTROSPECT_DOCTYPE
               "<node>\n", i->f);
 
         return 0;
@@ -43,12 +44,12 @@ int introspect_begin(struct introspect *i) {
 int introspect_write_default_interfaces(struct introspect *i, bool object_manager) {
         assert(i);
 
-        fputs(SD_BUS_INTROSPECT_INTERFACE_PEER
-              SD_BUS_INTROSPECT_INTERFACE_INTROSPECTABLE
-              SD_BUS_INTROSPECT_INTERFACE_PROPERTIES, i->f);
+        fputs(BUS_INTROSPECT_INTERFACE_PEER
+              BUS_INTROSPECT_INTERFACE_INTROSPECTABLE
+              BUS_INTROSPECT_INTERFACE_PROPERTIES, i->f);
 
         if (object_manager)
-                fputs(SD_BUS_INTROSPECT_INTERFACE_OBJECT_MANAGER, i->f);
+                fputs(BUS_INTROSPECT_INTERFACE_OBJECT_MANAGER, i->f);
 
         return 0;
 }
@@ -76,7 +77,7 @@ static void introspect_write_flags(struct introspect *i, int type, int flags) {
         if (flags & SD_BUS_VTABLE_DEPRECATED)
                 fputs("   <annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n", i->f);
 
-        if (type == _SD_BUS_VTABLE_METHOD && flags & SD_BUS_VTABLE_METHOD_NO_REPLY)
+        if (type == _SD_BUS_VTABLE_METHOD && (flags & SD_BUS_VTABLE_METHOD_NO_REPLY))
                 fputs("   <annotation name=\"org.freedesktop.DBus.Method.NoReply\" value=\"true\"/>\n", i->f);
 
         if (type == _SD_BUS_VTABLE_PROPERTY || type == _SD_BUS_VTABLE_WRITABLE_PROPERTY) {
@@ -85,6 +86,9 @@ static void introspect_write_flags(struct introspect *i, int type, int flags) {
                 else if (flags & SD_BUS_VTABLE_PROPERTY_INVALIDATE_ONLY)
                         fputs("   <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"invalidates\"/>\n", i->f);
         }
+
+        if ((type == _SD_BUS_VTABLE_METHOD || type == _SD_BUS_VTABLE_WRITABLE_PROPERTY) && (flags & SD_BUS_VTABLE_UNPRIVILEGED))
+                fputs("   <annotation name=\"org.freedesktop.systemd1.Unprivileged\" value=\"true\"/>\n", i->f);
 }
 
 static int introspect_write_arguments(struct introspect *i, const char *signature, const char *direction) {
@@ -117,6 +121,9 @@ int introspect_write_interface(struct introspect *i, const sd_bus_vtable *v) {
 
         for (; v->type != _SD_BUS_VTABLE_END; v++) {
 
+                if (v->type != _SD_BUS_VTABLE_START && (v->flags & SD_BUS_VTABLE_HIDDEN))
+                        continue;
+
                 switch (v->type) {
 
                 case _SD_BUS_VTABLE_START: