summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/test-bus-match.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-08-25 19:28:30 +0200
committerLennart Poettering <lennart@poettering.net>2015-08-25 19:28:30 +0200
commiteccd47c5beb72211ce33c9a33a1bb36366d43e22 (patch)
tree3efe52cf8e6cecdf358ae421752d70bb352165d4 /src/libsystemd/sd-bus/test-bus-match.c
parent33c1c9745ccc478c8eda72f8bae76945487076ae (diff)
sd-bus: introduce new match type "arg0has=" for matching arrays of strings
Previously, sd-bus inofficially already supported bus matches that tested a string against an array of strings ("as"). This was done via an enhanced way to interpret "arg0=" matches. This is problematic however, since clients have no way to determine if their respective implementation understood strv matches or not, thus allowing invalid matches to be installed without a way to detect that. This patch changes the logic to only allow such matches with a new "arg0has=" syntax. This has the benefit that non-conforming implementations will return a parse error and a client application may thus efficiently detect support for the match type. Matches of this type are useful for "udev"-like systems that "tag" objects with a number of strings, and clients need to be able to match against any of these "tags". The name "has" takes inspiration from Python's ".has_key()" construct.
Diffstat (limited to 'src/libsystemd/sd-bus/test-bus-match.c')
-rw-r--r--src/libsystemd/sd-bus/test-bus-match.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c
index f659ba3124..e29975db44 100644
--- a/src/libsystemd/sd-bus/test-bus-match.c
+++ b/src/libsystemd/sd-bus/test-bus-match.c
@@ -114,10 +114,10 @@ int main(int argc, char *argv[]) {
assert_se(match_add(slots, &root, "arg1='two'", 12) >= 0);
assert_se(match_add(slots, &root, "member='waldo',arg2path='/prefix/'", 13) >= 0);
assert_se(match_add(slots, &root, "member=waldo,path='/foo/bar',arg3namespace='prefix'", 14) >= 0);
- assert_se(match_add(slots, &root, "arg4='pi'", 15) >= 0);
- assert_se(match_add(slots, &root, "arg4='pa'", 16) >= 0);
- assert_se(match_add(slots, &root, "arg4='po'", 17) >= 0);
- assert_se(match_add(slots, &root, "arg4='pu'", 18) >= 0);
+ assert_se(match_add(slots, &root, "arg4has='pi'", 15) >= 0);
+ assert_se(match_add(slots, &root, "arg4has='pa'", 16) >= 0);
+ assert_se(match_add(slots, &root, "arg4has='po'", 17) >= 0);
+ assert_se(match_add(slots, &root, "arg4='pi'", 18) >= 0);
bus_match_dump(&root, 0);