X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flibsystemd-bus%2Fbus-match.c;h=f7fca5f573de962ec250927bff15a84d648b6a3a;hp=916682aa62ba7642a1cd32ad26743ff32bd4cd12;hb=c1b9d935725103e95901f347b8981647ce4dd546;hpb=7ff7394d9e4e9189c30fd018235e6b1728c6f2d0 diff --git a/src/libsystemd-bus/bus-match.c b/src/libsystemd-bus/bus-match.c index 916682aa6..f7fca5f57 100644 --- a/src/libsystemd-bus/bus-match.c +++ b/src/libsystemd-bus/bus-match.c @@ -22,6 +22,8 @@ #include "bus-internal.h" #include "bus-message.h" #include "bus-match.h" +#include "bus-error.h" +#include "bus-util.h" /* Example: * @@ -60,7 +62,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 +144,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: @@ -256,7 +274,10 @@ int bus_match_run( /* Run the callback. And then invoke siblings. */ if (node->leaf.callback) { - r = node->leaf.callback(bus, m, node->leaf.userdata); + _cleanup_bus_error_free_ sd_bus_error error_buffer = SD_BUS_ERROR_NULL; + + r = node->leaf.callback(bus, m, node->leaf.userdata, &error_buffer); + r = bus_maybe_reply_error(m, r, &error_buffer); if (r != 0) return r; }