libink: a broker peer is not an ordinary client

libink was written peer to peer, where one connection is one client
and one principal.  Attaching to a message bus breaks both halves of
that, and two things followed from it.

Signals never reached the system bus.  Fan-out is gated on the peer
having sent AddMatch, but a broker subscribes for its own clients and
never sends us one, so every ServiceStateChanged was dropped on the
floor.  A connection attached with LINK_ATTACH_BROKER gets them all.

Hello, AddMatch and RemoveMatch write per-connection state.  Shared by
every caller behind a broker, that lets one sender exhaust the match
cap or drop another's rule, so we leave all three to the bus, whose
job they are.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-08-13 10:14:48 +02:00
parent abab0e0fd4
commit c71ccce742
6 changed files with 38 additions and 9 deletions
+2 -1
View File
@@ -1280,7 +1280,8 @@ static int try_attach_system_bus(uev_ctx_t *ctx)
/* link_server_attach owns the fd from this point on whether it
* succeeds or fails, so the steal-then-attach pair has no leak
* window. */
conn = link_server_attach(server, link_client_steal_fd(c), (uid_t)-1);
conn = link_server_attach(server, link_client_steal_fd(c), (uid_t)-1,
LINK_ATTACH_BROKER);
if (!conn)
return -1;