From 868a41d4a8e9047cac9bee675fe49bc7c4592b80 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 16 Apr 2018 19:12:23 +0100 Subject: [PATCH 14/44] fixup! activation: Refuse to load activatable services with invalid names * Add TestSuiteNoName test case * Add more comments --- bus/activation.c | 6 ++++++ bus/dispatch.c | 5 +++++ test/Makefile.am | 1 + .../org.freedesktop.DBus.TestSuiteNoName.service | 3 +++ 4 files changed, 15 insertions(+) create mode 100644 test/data/invalid-service-files/org.freedesktop.DBus.TestSuiteNoName.service diff --git a/bus/activation.c b/bus/activation.c index 4e785319..1d4c7ba6 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -2810,6 +2810,12 @@ out: return ret; } +/* + * The real implementation of bus_dispatch_test_bad_services(), called + * by bus_context_new_test(). This asserts that various invalid service + * files in the configured by + * bus_dispatch_test_bad_services() didn't get loaded into self->entries. + */ void bus_activation_check_services (BusActivation *self) { diff --git a/bus/dispatch.c b/bus/dispatch.c index 3c4c031b..4f7eff64 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -5017,6 +5017,11 @@ bus_dispatch_test_conf (const DBusString *test_data_dir, return TRUE; } +/* + * Check that various invalid service files listed in a + * configured by filename didn't get loaded. This currently tests + * invalid values for Name. + */ static dbus_bool_t bus_dispatch_test_bad_services (const DBusString *test_data_dir, const char *filename) diff --git a/test/Makefile.am b/test/Makefile.am index 41575ffb..e4007a50 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -512,6 +512,7 @@ static_data = \ data/invalid-messages/boolean-has-no-value.message-raw \ data/invalid-service-files/org.freedesktop.DBus.service \ data/invalid-service-files/org.freedesktop.DBus.TestSuiteHasUniqueName.service \ + data/invalid-service-files/org.freedesktop.DBus.TestSuiteNoName.service \ data/invalid-service-files/org.freedesktop.DBus.TestSuiteNotValidName.service \ data/sha-1/Readme.txt \ data/sha-1/bit-hashes.sha1 \ diff --git a/test/data/invalid-service-files/org.freedesktop.DBus.TestSuiteNoName.service b/test/data/invalid-service-files/org.freedesktop.DBus.TestSuiteNoName.service new file mode 100644 index 00000000..50b2cc8a --- /dev/null +++ b/test/data/invalid-service-files/org.freedesktop.DBus.TestSuiteNoName.service @@ -0,0 +1,3 @@ +[D-BUS Service] +Name= +Exec=/bin/true TestSuiteNoName -- 2.18.0.rc2