chiark / gitweb /
sd-bus: never augment creds when we are operating on remote connections (#6217)
[elogind.git] / src / libelogind / sd-bus / bus-control.c
index c6403d3bae2b4ce8cf05d63114c58ff35ab128f5..313a44b536709b465522172021ab5426bf035cd9 100644 (file)
@@ -1042,6 +1042,11 @@ _public_ int sd_bus_get_name_creds(
         if (!bus->bus_client)
                 return -EINVAL;
 
+        /* Turn off augmenting if this isn't a local connection. If the connection is not local, then /proc is not
+         * going to match. */
+        if (!bus->is_local)
+                mask &= ~SD_BUS_CREDS_AUGMENT;
+
         if (streq(name, "org.freedesktop.DBus.Local"))
                 return -EINVAL;
 
@@ -1168,6 +1173,9 @@ _public_ int sd_bus_get_owner_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **r
         if (!BUS_IS_OPEN(bus->state))
                 return -ENOTCONN;
 
+        if (!bus->is_local)
+                mask &= ~SD_BUS_CREDS_AUGMENT;
+
         if (bus->is_kernel)
                 return bus_get_owner_creds_kdbus(bus, mask, ret);
         else