summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-11-09 00:58:11 +0100
committerKay Sievers <kay@vrfy.org>2013-11-09 00:58:11 +0100
commitdbb642afae6aa825594fb1c57dff632b013666a3 (patch)
tree95e61ef5c72ddb2bfb2e43531c8ca8a89551a3f7
parent8159d91a9c92aaee66d450ab0daff88f6e1a42b3 (diff)
bus: let magic ":no-sender" pass the validation
-rw-r--r--TODO1
-rw-r--r--src/libsystemd-bus/bus-internal.c10
-rw-r--r--src/libsystemd-bus/bus-internal.h1
-rw-r--r--src/libsystemd-bus/bus-message.c4
4 files changed, 14 insertions, 2 deletions
diff --git a/TODO b/TODO
index 38246f6567..b5ffbb2944 100644
--- 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:
diff --git a/src/libsystemd-bus/bus-internal.c b/src/libsystemd-bus/bus-internal.c
index 0bea8cac49..f0a28c623c 100644
--- a/src/libsystemd-bus/bus-internal.c
+++ b/src/libsystemd-bus/bus-internal.c
@@ -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;
diff --git a/src/libsystemd-bus/bus-internal.h b/src/libsystemd-bus/bus-internal.h
index 5fc3a2472e..cd9f37edd7 100644
--- a/src/libsystemd-bus/bus-internal.h
+++ b/src/libsystemd-bus/bus-internal.h
@@ -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);
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 42c764c62a..2c2e69e393 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -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;