chiark / gitweb /
bus: fix bloom_add_prefixes() to add all required data
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 10 Jun 2015 16:26:16 +0000 (18:26 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:01:49 +0000 (10:01 +0100)
Lets look at an example where we add arg0="/foo/bar/waldo" to a
bloom-filter. The following strings are added:
  "arg0:/foo/bar/waldo"
  "arg0-slash-prefix:/foo/bar"
  "arg0-slash-prefix:/foo"

Two problems arise:

1) If we match on "arg0path=/foo/bar/waldo", the dbus-spec explicitly
states that equal strings are also considered prefixes. However, in the
bloom-match, we can only provide a single match-filter. Therefore, we have
to add "arg0-slash-prefix:/foo/bar/waldo" there, but this never occured in
the bloom-mask of the message.
Hence, this patch makes sure bloom_add_prefixes() adds the full path as
prefix, too.

2) If we match on "arg0path=/foo/", the dbus-spec states that arg0path
does prefix-matching with the trailing slash _included_, unlike
path_namespace= matches, which does *not* include them. This is
inconsistent, but we have to support the specs. Therefore, we must add
prefixes with _and_ without trailing separators.
Hence, this patch makes sure bloom_add_prefixes() adds all prefixes with
the trailing slash included.

The final set of strings added therefore is:
  "arg0:/foo/bar/waldo"
  "arg0-slash-prefix:/foo/bar/waldo"
  "arg0-slash-prefix:/foo/bar/"
  "arg0-slash-prefix:/foo/bar"
  "arg0-slash-prefix:/foo/"
  "arg0-slash-prefix:/foo"
  "arg0-slash-prefix:/"


No differences found