diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-30 02:05:38 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-30 02:08:57 +0100 |
commit | ae7bed3f2d1823e82984e757872b3b753d5c869b (patch) | |
tree | 07ccf1c39ff706c36cae1ec48a67ba4daaeec0ae /src/libsystemd-bus | |
parent | 0fc6e1ed00ee1af4282e46d40ceb07b3afedebef (diff) |
bus: make sure we can match well-known names
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r-- | src/libsystemd-bus/bus-match.c | 18 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-match.h | 2 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/libsystemd-bus/bus-match.c b/src/libsystemd-bus/bus-match.c index 916682aa62..49fc6335c2 100644 --- a/src/libsystemd-bus/bus-match.c +++ b/src/libsystemd-bus/bus-match.c @@ -60,7 +60,7 @@ */ static inline bool BUS_MATCH_IS_COMPARE(enum bus_match_node_type t) { - return t >= BUS_MATCH_MESSAGE_TYPE && t <= BUS_MATCH_ARG_NAMESPACE_LAST; + return t >= BUS_MATCH_SENDER && t <= BUS_MATCH_ARG_NAMESPACE_LAST; } static inline bool BUS_MATCH_CAN_HASH(enum bus_match_node_type t) { @@ -142,6 +142,22 @@ static bool value_node_test( case BUS_MATCH_SENDER: case BUS_MATCH_DESTINATION: + if (streq_ptr(node->value.str, value_str)) + return true; + + /* FIXME: So here's an ugliness: if the match is for a + * well-known name then we cannot actually check this + * correctly here. This doesn't matter much for dbus1 + * where no false positives exist, hence we just + * ignore this case here. For kdbus the messages + * should contain all well-known names of the sender, + * hence we can fix things there correctly. */ + + if (node->value.str[0] != ':' && value_str[0] == ':') + return true; + + return false; + case BUS_MATCH_INTERFACE: case BUS_MATCH_MEMBER: case BUS_MATCH_PATH: diff --git a/src/libsystemd-bus/bus-match.h b/src/libsystemd-bus/bus-match.h index d24aeec43d..1d38126600 100644 --- a/src/libsystemd-bus/bus-match.h +++ b/src/libsystemd-bus/bus-match.h @@ -31,8 +31,8 @@ enum bus_match_node_type { BUS_MATCH_LEAF, /* The following are all different kinds of compare nodes */ - BUS_MATCH_MESSAGE_TYPE, BUS_MATCH_SENDER, + BUS_MATCH_MESSAGE_TYPE, BUS_MATCH_DESTINATION, BUS_MATCH_INTERFACE, BUS_MATCH_MEMBER, |