summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e79e8af)
dbus-daemon allows this, the dbus specification doesn't explicitly say
anything about it, so let's follow dbus-daemon on this.
enum bus_match_node_type t;
unsigned j = 0;
size_t value_allocated = 0;
enum bus_match_node_type t;
unsigned j = 0;
size_t value_allocated = 0;
+ bool escaped = false, quoted;
uint8_t u;
eq = strchr(p, '=');
if (!eq)
return -EINVAL;
uint8_t u;
eq = strchr(p, '=');
if (!eq)
return -EINVAL;
- if (eq[1] != '\'')
- return -EINVAL;
-
t = bus_match_node_type_from_string(p, eq - p);
if (t < 0)
return -EINVAL;
t = bus_match_node_type_from_string(p, eq - p);
if (t < 0)
return -EINVAL;
- for (q = eq + 2;; q++) {
+ quoted = eq[1] == '\'';
+
+ for (q = eq + 1 + quoted;; q++) {
- r = -EINVAL;
- goto fail;
+
+ if (quoted) {
+ r = -EINVAL;
+ goto fail;
+ } else {
+ if (value)
+ value[j] = 0;
+ break;
+ }
escaped = true;
continue;
}
escaped = true;
continue;
}
- if (*q == '\'') {
- if (value)
- value[j] = 0;
- break;
+
+ if (quoted) {
+ if (*q == '\'') {
+ if (value)
+ value[j] = 0;
+ break;
+ }
+ } else {
+ if (*q == ',') {
+ if (value)
+ value[j] = 0;
+
+ break;
+ }
+ if (q[quoted] != ',') {
r = -EINVAL;
goto fail;
}
r = -EINVAL;
goto fail;
}
}
/* Order the whole thing, so that we always generate the same tree */
}
/* Order the whole thing, so that we always generate the same tree */
assert_se(match_add(&root, "path_namespace='/foo/quux'", 11) >= 0);
assert_se(match_add(&root, "arg1='two'", 12) >= 0);
assert_se(match_add(&root, "member='waldo',arg2path='/prefix/'", 13) >= 0);
assert_se(match_add(&root, "path_namespace='/foo/quux'", 11) >= 0);
assert_se(match_add(&root, "arg1='two'", 12) >= 0);
assert_se(match_add(&root, "member='waldo',arg2path='/prefix/'", 13) >= 0);
- assert_se(match_add(&root, "member='waldo',path='/foo/bar',arg3namespace='prefix'", 14) >= 0);
+ assert_se(match_add(&root, "member=waldo,path='/foo/bar',arg3namespace='prefix'", 14) >= 0);
bus_match_dump(&root, 0);
bus_match_dump(&root, 0);