summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-07-31 11:12:52 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-07-31 13:28:21 +0200
commite3c57a86f6ede89651e600d168389be4a78c1b33 (patch)
treea38d9a7ad5047d17be8f4eb2d78af6040f33b03d
parent6189e043d41b5d5eaec11d6a5ab06b5f35c0ddf7 (diff)
bus-proxy: fix NameAcquired and NameLost to be directed
The NameAcquired and NameLost signals are _directed_ signals. Make sure we properly set the destination correctly, and verify it in our proxy-test.
-rw-r--r--src/bus-proxyd/proxy.c4
-rw-r--r--src/bus-proxyd/synthesize.c4
-rw-r--r--src/libsystemd/sd-bus/test-bus-proxy.c17
3 files changed, 21 insertions, 4 deletions
diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index c37b09b9c0..425af65873 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -644,6 +644,10 @@ static int process_hello(Proxy *p, sd_bus_message *m) {
if (r < 0)
return log_error_errno(r, "Failed to append sender to NameAcquired message: %m");
+ r = sd_bus_message_set_destination(n, p->destination_bus->unique_name);
+ if (r < 0)
+ return log_error_errno(r, "Failed to set destination for NameAcquired message: %m");
+
r = bus_seal_synthetic_message(p->local_bus, n);
if (r < 0)
return log_error_errno(r, "Failed to seal NameAcquired message: %m");
diff --git a/src/bus-proxyd/synthesize.c b/src/bus-proxyd/synthesize.c
index 3ecedfd575..c26de9af6a 100644
--- a/src/bus-proxyd/synthesize.c
+++ b/src/bus-proxyd/synthesize.c
@@ -214,6 +214,10 @@ int synthesize_name_acquired(Proxy *p, sd_bus *a, sd_bus *b, sd_bus_message *m)
if (r < 0)
return r;
+ r = sd_bus_message_set_destination(n, a->unique_name);
+ if (r < 0)
+ return r;
+
r = bus_seal_synthetic_message(b, n);
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/test-bus-proxy.c b/src/libsystemd/sd-bus/test-bus-proxy.c
index 369c2f331c..aef768dc18 100644
--- a/src/libsystemd/sd-bus/test-bus-proxy.c
+++ b/src/libsystemd/sd-bus/test-bus-proxy.c
@@ -53,7 +53,9 @@ static int test_proxy_acquired(sd_bus_message *m, void *userdata, sd_bus_error *
static void test_proxy_matched(void) {
_cleanup_bus_flush_close_unref_ sd_bus *a = NULL;
+ _cleanup_free_ char *matchstr = NULL;
TestProxyMatch match = {};
+ const char *me;
int r;
/* open bus 'a' */
@@ -70,10 +72,17 @@ static void test_proxy_matched(void) {
r = sd_bus_start(a);
assert_se(r >= 0);
- r = sd_bus_add_match(a, NULL,
- "type='signal',"
- "member='NameAcquired'",
- test_proxy_acquired, &match);
+ r = sd_bus_get_unique_name(a, &me);
+ assert_se(r >= 0);
+
+ matchstr = strjoin("type='signal',"
+ "member='NameAcquired',"
+ "destination='",
+ me,
+ "'",
+ NULL);
+ assert_se(matchstr);
+ r = sd_bus_add_match(a, NULL, matchstr, test_proxy_acquired, &match);
assert_se(r >= 0);
r = sd_bus_get_unique_name(a, &match.sender);