[systemd-commits] 2 commits - TODO src/libsystemd-bus

Lennart Poettering lennart at kemper.freedesktop.org
Wed Jan 8 02:11:21 PST 2014


 TODO                                |    2 +
 src/libsystemd-bus/bus-match.c      |   42 ++++++++++++++++++++++++------------
 src/libsystemd-bus/test-bus-match.c |    2 -
 3 files changed, 32 insertions(+), 14 deletions(-)

New commits:
commit bc6422cbd1dfc258fb2b4909a2a25ad356e63400
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jan 8 18:09:25 2014 +0800

    bus: allow omitting quotes for values in match strings
    
    dbus-daemon allows this, the dbus specification doesn't explicitly say
    anything about it, so let's follow dbus-daemon on this.

diff --git a/src/libsystemd-bus/bus-match.c b/src/libsystemd-bus/bus-match.c
index 34488d8..ffc9756 100644
--- a/src/libsystemd-bus/bus-match.c
+++ b/src/libsystemd-bus/bus-match.c
@@ -726,25 +726,31 @@ int bus_match_parse(
                 enum bus_match_node_type t;
                 unsigned j = 0;
                 size_t value_allocated = 0;
-                bool escaped = false;
+                bool escaped = false, quoted;
                 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;
 
-                for (q = eq + 2;; q++) {
+                quoted = eq[1] == '\'';
+
+                for (q = eq + 1 + quoted;; q++) {
 
                         if (*q == 0) {
-                                r = -EINVAL;
-                                goto fail;
+
+                                if (quoted) {
+                                        r = -EINVAL;
+                                        goto fail;
+                                } else {
+                                        if (value)
+                                                value[j] = 0;
+                                        break;
+                                }
                         }
 
                         if (!escaped) {
@@ -752,10 +758,20 @@ int bus_match_parse(
                                         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;
+                                        }
                                 }
                         }
 
@@ -801,12 +817,12 @@ int bus_match_parse(
                 if (q[1] == 0)
                         break;
 
-                if (q[1] != ',') {
+                if (q[quoted] != ',') {
                         r = -EINVAL;
                         goto fail;
                 }
 
-                p = q + 2;
+                p = q + 1 + quoted;
         }
 
         /* Order the whole thing, so that we always generate the same tree */
diff --git a/src/libsystemd-bus/test-bus-match.c b/src/libsystemd-bus/test-bus-match.c
index 25d2b92..7227e25 100644
--- a/src/libsystemd-bus/test-bus-match.c
+++ b/src/libsystemd-bus/test-bus-match.c
@@ -107,7 +107,7 @@ int main(int argc, char *argv[]) {
         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);
 

commit e79e8afd62bdec28a88d52fa0761aff9ce145b77
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jan 8 18:09:05 2014 +0800

    update TODO

diff --git a/TODO b/TODO
index ed62803..09ccbbe 100644
--- a/TODO
+++ b/TODO
@@ -30,6 +30,8 @@ External:
 
 Features:
 
+* Introduce PrivateDevices=yes/no which works like PrivateTmp= but for /dev setting up a tmpfs for it that only includes /dev/null, /dev/zero, /dev/random, /dev/urandom, but nothing else.
+
 * libsystemd-journal returns the object created as first param in sd_journal_new(), sd_bus_new() and suchlike as last...
 
 * cgroups:



More information about the systemd-commits mailing list