mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
libink: take the match keys clients send without asking
A rule carrying sender, destination, or eavesdrop was refused whole, and a peer whose AddMatch fails gets no signals at all. That is a poor trade for keys clients attach as a matter of course: better a filter wider than asked for than a subscription that never happened. They are accepted and ignored rather than honoured. Widening costs nothing here since Finit is the only sender on this bus, and what it emits through the match table is state any peer that got this far may already read. argN and argNpath still take the whole rule down. Honouring them means parsing message bodies, and nothing asks for them yet. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -54,6 +54,26 @@ case "$(cat /tmp/dbus-match.out)" in
|
||||
*) fail "Unexpected reply: $(cat /tmp/dbus-match.out)" ;;
|
||||
esac
|
||||
|
||||
# A client that sends these must still get its signals: refusing the
|
||||
# rule would leave it with none at all. The sender here is deliberately
|
||||
# wrong, so a delivered signal proves the key was ignored and not
|
||||
# quietly honoured.
|
||||
say "AddMatch accepts, and ignores, sender/destination/eavesdrop"
|
||||
rm -f /tmp/dbus-ignored.out
|
||||
( texec "$CLIENT" monitor-signal "$BUS" \
|
||||
"type='signal',sender='org.freedesktop.DBus',destination=':1.99',eavesdrop='false',interface='org.finit.Cond1',member='ConditionChanged'" \
|
||||
5000 > /tmp/dbus-ignored.out 2>&1 ) &
|
||||
ign_pid=$!
|
||||
sleep 0.5
|
||||
texec "$CLIENT" call-s "$BUS" /org/finit/cond \
|
||||
org.finit.Cond1 Set "dbus-ignored-keys" >/dev/null \
|
||||
|| fail "Cond1.Set returned non-zero"
|
||||
set +e
|
||||
wait "$ign_pid"
|
||||
ign_rc=$?
|
||||
set -e
|
||||
assert "Signal still delivered through the wider rule (rc=$ign_rc)" "$ign_rc" -eq 0
|
||||
|
||||
say "Unknown method on a Finit interface gets an org.freedesktop.DBus.Error.* reply"
|
||||
set +e
|
||||
texec "$CLIENT" unknown "$BUS"
|
||||
|
||||
Reference in New Issue
Block a user