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

Lennart Poettering lennart at kemper.freedesktop.org
Mon Dec 23 18:06:45 PST 2013


 TODO                             |    1 -
 src/libsystemd-bus/bus-message.c |   26 ++++++++++++--------------
 src/libsystemd-bus/bus-message.h |    2 ++
 3 files changed, 14 insertions(+), 15 deletions(-)

New commits:
commit 3798fd4c30150984d6e9eb63e8e94f5410ba5996
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Dec 24 03:02:49 2013 +0100

    bus: allow peeking signatures recusively inside of containers
    
    Previously we invalidated the peeked signature as soon as the caller
    would recurse into a container, making stack based handling difficult.
    With this change we will keep the peeked signature around until the user
    advances to the next field.

diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 9092a66..f09f0d6 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -151,7 +151,7 @@ static void message_free(sd_bus_message *m) {
         free(m->root_container.signature);
         free(m->root_container.offsets);
 
-        free(m->peeked_signature);
+        free(m->root_container.peeked_signature);
 
         bus_creds_done(&m->creds);
         free(m);
@@ -3916,6 +3916,7 @@ _public_ int sd_bus_message_enter_container(sd_bus_message *m,
         w = m->containers + m->n_containers++;
         w->enclosing = type;
         w->signature = signature;
+        w->peeked_signature = NULL;
         w->index = 0;
 
         w->before = before;
@@ -3960,6 +3961,7 @@ _public_ int sd_bus_message_exit_container(sd_bus_message *m) {
         }
 
         free(c->signature);
+        free(c->peeked_signature);
         free(c->offsets);
         m->n_containers--;
 
@@ -4037,10 +4039,8 @@ _public_ int sd_bus_message_peek_type(sd_bus_message *m, char *type, const char
                         if (!sig)
                                 return -ENOMEM;
 
-                        free(m->peeked_signature);
-                        m->peeked_signature = sig;
-
-                        *contents = sig;
+                        free(c->peeked_signature);
+                        *contents = c->peeked_signature = sig;
                 }
 
                 if (type)
@@ -4065,10 +4065,8 @@ _public_ int sd_bus_message_peek_type(sd_bus_message *m, char *type, const char
                         if (!sig)
                                 return -ENOMEM;
 
-                        free(m->peeked_signature);
-                        m->peeked_signature = sig;
-
-                        *contents = sig;
+                        free(c->peeked_signature);
+                        *contents = c->peeked_signature = sig;
                 }
 
                 if (type)
@@ -4108,15 +4106,15 @@ _public_ int sd_bus_message_peek_type(sd_bus_message *m, char *type, const char
                                 if (k > c->item_size)
                                         return -EBADMSG;
 
-                                free(m->peeked_signature);
-                                m->peeked_signature = strndup((char*) q + 1, k - 1);
-                                if (!m->peeked_signature)
+                                free(c->peeked_signature);
+                                c->peeked_signature = strndup((char*) q + 1, k - 1);
+                                if (!c->peeked_signature)
                                         return -ENOMEM;
 
-                                if (!signature_is_valid(m->peeked_signature, true))
+                                if (!signature_is_valid(c->peeked_signature, true))
                                         return -EBADMSG;
 
-                                *contents = m->peeked_signature;
+                                *contents = c->peeked_signature;
                         } else {
                                 size_t rindex, l;
 
diff --git a/src/libsystemd-bus/bus-message.h b/src/libsystemd-bus/bus-message.h
index 589c819..a973e9f 100644
--- a/src/libsystemd-bus/bus-message.h
+++ b/src/libsystemd-bus/bus-message.h
@@ -48,6 +48,8 @@ struct bus_container {
         /* gvariant: list of offsets to end of children if this is struct/dict entry/array */
         size_t *offsets, n_offsets, offsets_allocated, offset_index;
         size_t item_size;
+
+        char *peeked_signature;
 };
 
 struct bus_header {

commit eab07b4b23544d38ff0006fa4da9217c61d94749
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Dec 24 02:57:17 2013 +0100

    update TODO

diff --git a/TODO b/TODO
index 49e47ae..362591a 100644
--- a/TODO
+++ b/TODO
@@ -114,7 +114,6 @@ Features:
   - see if we can drop more message validation on the sending side
   - add API to clone sd_bus_message objects
   - SD_BUS_COMMENT() macro for inclusion in vtables, syntax inspired by gdbus
-  - systemd-bus-proxyd needs to synthesize NameLost/NameAcquired
   - systemd-bus-proxyd needs to enforce good old XML policy
   - upload minimal kdbus policy into the kernel at boot
   - kdbus: matches against source or destination pids for an "strace -p"-like feel. Problem: The PID info needs to be available in userspace too...



More information about the systemd-commits mailing list