Commit bbbc6023 authored by Simon McVittie's avatar Simon McVittie

config-parser: Fail on impossible send_broadcast/send_destination pair

If we add a rule like

    <allow send_destination="com.example" send_broadcast="true"/>

then it cannot possibly match anything, because to be a broadcast, the
message would have to have no destination. The only value of
send_destination that can be combined with send_broadcast="true" is
the wildcard "*", but by this point in the function we already
replaced "*" with NULL.

Adapted from an earlier implementation of send_broadcast by
Alban Crequy.
Signed-off-by: Simon McVittie's avatarSimon McVittie <>
Bug: Philip Withnall's avatarPhilip Withnall <>
parent 8f9022e8
......@@ -1554,6 +1554,19 @@ append_rule_from_element (BusConfigParser *parser,
return FALSE;
if (send_destination != NULL &&
send_broadcast != NULL &&
strcmp (send_broadcast, "true") == 0)
/* Broadcast messages have no destination, so this cannot
* possibly match */
dbus_set_error (error, DBUS_ERROR_FAILED,
"Rule with send_broadcast=\"true\" and "
"send_destination=\"%s\" cannot match anything",
return FALSE;
if (send_requested_reply &&
!(strcmp (send_requested_reply, "true") == 0 ||
strcmp (send_requested_reply, "false") == 0))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment