From 45a3473f4e839979f5266b2be31ba60ac06555fc Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 28 Jul 2017 07:46:25 +0100 Subject: [PATCH 10/12] config-parser: Fail on impossible send_broadcast/send_destination pair If we add a rule like 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 --- bus/config-parser.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bus/config-parser.c b/bus/config-parser.c index 52576e9d..4d14c33f 100644 --- a/bus/config-parser.c +++ b/bus/config-parser.c @@ -1509,6 +1509,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", + send_destination); + return FALSE; + } + if (send_requested_reply && !(strcmp (send_requested_reply, "true") == 0 || strcmp (send_requested_reply, "false") == 0)) -- 2.13.3