mirror of
https://github.com/troglobit/finit.git
synced 2026-10-26 12:14:37 +00:00
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:
1 parent
abab0e0fd4
commit
c71ccce742
6 files changed
+38
-9
No files matched your search
@@ -459,6 +459,20 @@ static int handle_remove_match(link_connection_t *conn, const struct link_msg *m
|
||||
|
||||
int __handle_builtin(link_connection_t *conn, const struct link_msg *m)
|
||||
{
|
||||
/* Hello and AddMatch/RemoveMatch are per-connection state, and on
|
||||
* a broker link the connection is shared by every caller: one
|
||||
* sender could exhaust the match cap or drop another's rule.
|
||||
* Naming and subscription belong to the broker for its own
|
||||
* clients, so we do not answer these there. */
|
||||
if (conn->broker && m->member &&
|
||||
(!strcmp(m->member, "Hello") ||
|
||||
!strcmp(m->member, "AddMatch") ||
|
||||
!strcmp(m->member, "RemoveMatch"))) {
|
||||
return __send_error(conn, m,
|
||||
"org.freedesktop.DBus.Error.AccessDenied",
|
||||
"Handled by the message bus, not by this peer");
|
||||
}
|
||||
|
||||
if (member_is(m, "org.freedesktop.DBus", "Hello") &&
|
||||
m->path && strcmp(m->path, "/org/freedesktop/DBus") == 0)
|
||||
return handle_hello(conn, m);
|
||||
|
||||
Reference in new issue
Block a user