chiark / gitweb /
bus: let magic ":no-sender" pass the validation
authorKay Sievers <kay@vrfy.org>
Fri, 8 Nov 2013 23:58:11 +0000 (00:58 +0100)
committerKay Sievers <kay@vrfy.org>
Fri, 8 Nov 2013 23:58:11 +0000 (00:58 +0100)
TODO
src/libsystemd-bus/bus-internal.c
src/libsystemd-bus/bus-internal.h
src/libsystemd-bus/bus-message.c

diff --git a/TODO b/TODO
index 38246f6..b5ffbb2 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,5 @@
 Bugfixes:
+* check :no-sender logic after PID conversion
 
 * enabling an instance unit creates a pointless link, and
   the unit will be started with getty@getty.service:
index 0bea8ca..f0a28c6 100644 (file)
@@ -166,6 +166,16 @@ bool service_name_is_valid(const char *p) {
         return true;
 }
 
+bool sender_name_is_valid(const char *p) {
+        if (isempty(p))
+                return false;
+
+        if (streq(p, ":no-sender"))
+                return true;
+
+        return service_name_is_valid(p);
+}
+
 bool member_name_is_valid(const char *p) {
         const char *q;
 
index 5fc3a24..cd9f37e 100644 (file)
@@ -271,6 +271,7 @@ struct sd_bus {
 
 bool interface_name_is_valid(const char *p);
 bool service_name_is_valid(const char *p);
+bool sender_name_is_valid(const char *p);
 bool member_name_is_valid(const char *p);
 bool object_path_is_valid(const char *p);
 char *object_path_startswith(const char *a, const char *b);
index 42c764c..2c2e69e 100644 (file)
@@ -3928,7 +3928,7 @@ int bus_message_parse_fields(sd_bus_message *m) {
                         if (!streq(signature, "s"))
                                 return -EBADMSG;
 
-                        r = message_peek_field_string(m, service_name_is_valid, &ri, &m->destination);
+                        r = message_peek_field_string(m, sender_name_is_valid, &ri, &m->destination);
                         break;
 
                 case SD_BUS_MESSAGE_HEADER_SENDER:
@@ -3939,7 +3939,7 @@ int bus_message_parse_fields(sd_bus_message *m) {
                         if (!streq(signature, "s"))
                                 return -EBADMSG;
 
-                        r = message_peek_field_string(m, service_name_is_valid, &ri, &m->sender);
+                        r = message_peek_field_string(m, sender_name_is_valid, &ri, &m->sender);
                         break;