X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-bus%2Fbus-match.c;h=61b8a5cd8878570b034b52b8df33b97e8d33e89a;hb=30374ebe5e9f0b37e99dcbdc965c00fcf542f89d;hp=1411167a7f4af4eb34368c36e458c639609f840f;hpb=2a0e0692565f0435657c93498e09cbb2d3517152;p=elogind.git diff --git a/src/libsystemd-bus/bus-match.c b/src/libsystemd-bus/bus-match.c index 1411167a7..61b8a5cd8 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 && value_str[0] == ':') + return true; + + return false; + case BUS_MATCH_INTERFACE: case BUS_MATCH_MEMBER: case BUS_MATCH_PATH: @@ -768,7 +784,7 @@ int bus_match_parse( } /* Order the whole thing, so that we always generate the same tree */ - qsort(components, n_components, sizeof(struct bus_match_component), match_component_compare); + qsort_safe(components, n_components, sizeof(struct bus_match_component), match_component_compare); /* Check for duplicates */ for (i = 0; i+1 < n_components; i++)