[systemd-commits] 3 commits - TODO src/bus-proxyd src/core src/libsystemd-bus
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Dec 25 18:09:28 PST 2013
TODO | 1 +
src/bus-proxyd/bus-proxyd.c | 17 ++++++++++++-----
src/core/manager.c | 2 +-
src/libsystemd-bus/bus-internal.h | 1 +
src/libsystemd-bus/bus-kernel.c | 4 ++--
src/libsystemd-bus/bus-kernel.h | 4 +++-
src/libsystemd-bus/sd-bus.c | 3 +++
src/libsystemd-bus/test-bus-kernel-benchmark.c | 2 +-
src/libsystemd-bus/test-bus-kernel-bloom.c | 2 +-
src/libsystemd-bus/test-bus-kernel.c | 2 +-
src/libsystemd-bus/test-bus-zero-copy.c | 2 +-
11 files changed, 27 insertions(+), 13 deletions(-)
New commits:
commit 758bf0c755e045f7b1dd89869d3a10b9457e9bbe
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Dec 26 03:08:52 2013 +0100
bus: don't process Peer interface messages in the proxy
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c
index abc5014..27122a5 100644
--- a/src/bus-proxyd/bus-proxyd.c
+++ b/src/bus-proxyd/bus-proxyd.c
@@ -123,7 +123,7 @@ static int parse_argv(int argc, char *argv[]) {
return 1;
}
-static int rename_service(sd_bus *b) {
+static int rename_service(sd_bus *a, sd_bus *b) {
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
_cleanup_free_ char *p = NULL, *name = NULL;
const char *comm;
@@ -132,6 +132,7 @@ static int rename_service(sd_bus *b) {
pid_t pid;
int r;
+ assert(a);
assert(b);
r = sd_bus_get_peer_creds(b, SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_CMDLINE|SD_BUS_CREDS_COMM, &creds);
@@ -182,9 +183,11 @@ static int rename_service(sd_bus *b) {
memset(arg_command_line_buffer + w, 0, m - w);
}
- log_debug("Running on behalf of PID %lu (%s), UID %lu (%s).",
- (unsigned long) pid, p,
- (unsigned long) uid, name);
+ log_debug("Running on behalf of PID %lu (%s), UID %lu (%s), %s",
+ (unsigned long) pid, p,
+ (unsigned long) uid, name,
+ a->unique_name);
+ ;
return 0;
}
@@ -430,6 +433,8 @@ int main(int argc, char *argv[]) {
peersec = NULL;
}
+ a->manual_peer_interface = true;
+
r = sd_bus_start(a);
if (r < 0) {
log_error("Failed to start bus client: %s", strerror(-r));
@@ -472,13 +477,15 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ b->manual_peer_interface = true;
+
r = sd_bus_start(b);
if (r < 0) {
log_error("Failed to start bus client: %s", strerror(-r));
goto finish;
}
- r = rename_service(b);
+ r = rename_service(a, b);
if (r < 0)
log_debug("Failed to rename process: %s", strerror(-r));
diff --git a/src/libsystemd-bus/bus-internal.h b/src/libsystemd-bus/bus-internal.h
index 321070d..7c92293 100644
--- a/src/libsystemd-bus/bus-internal.h
+++ b/src/libsystemd-bus/bus-internal.h
@@ -163,6 +163,7 @@ struct sd_bus {
bool nodes_modified:1;
bool trusted:1;
bool fake_creds_valid:1;
+ bool manual_peer_interface:1;
int use_memfd;
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index fe2d329..43be1de 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -2072,6 +2072,9 @@ static int process_builtin(sd_bus *bus, sd_bus_message *m) {
assert(bus);
assert(m);
+ if (bus->manual_peer_interface)
+ return 0;
+
if (m->header->type != SD_BUS_MESSAGE_METHOD_CALL)
return 0;
commit 452de75e5b8b1cff207243848f4e5de68620554c
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Dec 26 03:08:35 2013 +0100
update TODO
diff --git a/TODO b/TODO
index 362591a..3005289 100644
--- a/TODO
+++ b/TODO
@@ -120,6 +120,7 @@ Features:
- longer term:
* priority queues
* priority inheritance
+ - check sender of response messages
- dbus spec updates:
- kdbus mapping
- NameLost/NameAcquired obsolete
commit f2769777c8e8ad32b0b19cd540d2f742bda4457f
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Dec 26 03:08:15 2013 +0100
bus: make system bus kdbus node world-accessible
diff --git a/src/core/manager.c b/src/core/manager.c
index c26dcaa..6b33c18 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -542,7 +542,7 @@ static int manager_setup_kdbus(Manager *m) {
if (m->running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS"))
return 0;
- m->kdbus_fd = bus_kernel_create_bus(m->running_as == SYSTEMD_SYSTEM ? "system" : "user", &p);
+ m->kdbus_fd = bus_kernel_create_bus(m->running_as == SYSTEMD_SYSTEM ? "system" : "user", m->running_as == SYSTEMD_SYSTEM, &p);
if (m->kdbus_fd < 0) {
log_debug("Failed to set up kdbus: %s", strerror(-m->kdbus_fd));
return m->kdbus_fd;
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index fadb683..d752d1f 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -1131,7 +1131,7 @@ int kdbus_translate_attach_flags(uint64_t mask, uint64_t *kdbus_mask) {
return 0;
}
-int bus_kernel_create_bus(const char *name, char **s) {
+int bus_kernel_create_bus(const char *name, bool world, char **s) {
struct kdbus_cmd_make *make;
struct kdbus_item *n;
int fd;
@@ -1163,7 +1163,7 @@ int bus_kernel_create_bus(const char *name, char **s) {
n->type = KDBUS_ITEM_MAKE_NAME;
make->size += ALIGN8(n->size);
- make->flags = KDBUS_MAKE_POLICY_OPEN;
+ make->flags = KDBUS_MAKE_POLICY_OPEN | (world ? KDBUS_MAKE_ACCESS_WORLD : 0);
if (ioctl(fd, KDBUS_CMD_BUS_MAKE, make) < 0) {
close_nointr_nofail(fd);
diff --git a/src/libsystemd-bus/bus-kernel.h b/src/libsystemd-bus/bus-kernel.h
index 67690f8..2aba0bb 100644
--- a/src/libsystemd-bus/bus-kernel.h
+++ b/src/libsystemd-bus/bus-kernel.h
@@ -21,6 +21,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <stdbool.h>
+
#include "sd-bus.h"
#define KDBUS_ITEM_NEXT(item) \
@@ -61,7 +63,7 @@ int bus_kernel_take_fd(sd_bus *b);
int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m);
int bus_kernel_read_message(sd_bus *bus);
-int bus_kernel_create_bus(const char *name, char **s);
+int bus_kernel_create_bus(const char *name, bool world, char **s);
int bus_kernel_create_namespace(const char *name, char **s);
int bus_kernel_create_starter(const char *bus, const char *name);
int bus_kernel_create_monitor(const char *bus);
diff --git a/src/libsystemd-bus/test-bus-kernel-benchmark.c b/src/libsystemd-bus/test-bus-kernel-benchmark.c
index 010a161..70f4fcd 100644
--- a/src/libsystemd-bus/test-bus-kernel-benchmark.c
+++ b/src/libsystemd-bus/test-bus-kernel-benchmark.c
@@ -239,7 +239,7 @@ int main(int argc, char *argv[]) {
assert_se(arg_loop_usec > 0);
- bus_ref = bus_kernel_create_bus("deine-mutter", &bus_name);
+ bus_ref = bus_kernel_create_bus("deine-mutter", false, &bus_name);
if (bus_ref == -ENOENT)
exit(EXIT_TEST_SKIP);
diff --git a/src/libsystemd-bus/test-bus-kernel-bloom.c b/src/libsystemd-bus/test-bus-kernel-bloom.c
index 62983ea..772831b 100644
--- a/src/libsystemd-bus/test-bus-kernel-bloom.c
+++ b/src/libsystemd-bus/test-bus-kernel-bloom.c
@@ -42,7 +42,7 @@ static void test_one(
sd_bus *a, *b;
int r;
- bus_ref = bus_kernel_create_bus("deine-mutter", &bus_name);
+ bus_ref = bus_kernel_create_bus("deine-mutter", false, &bus_name);
if (bus_ref == -ENOENT)
exit(EXIT_TEST_SKIP);
diff --git a/src/libsystemd-bus/test-bus-kernel.c b/src/libsystemd-bus/test-bus-kernel.c
index 8380b2c..c78c6d4 100644
--- a/src/libsystemd-bus/test-bus-kernel.c
+++ b/src/libsystemd-bus/test-bus-kernel.c
@@ -42,7 +42,7 @@ int main(int argc, char *argv[]) {
log_set_max_level(LOG_DEBUG);
- bus_ref = bus_kernel_create_bus("deine-mutter", &bus_name);
+ bus_ref = bus_kernel_create_bus("deine-mutter", false, &bus_name);
if (bus_ref == -ENOENT)
return EXIT_TEST_SKIP;
diff --git a/src/libsystemd-bus/test-bus-zero-copy.c b/src/libsystemd-bus/test-bus-zero-copy.c
index 054c4c7..dff3692 100644
--- a/src/libsystemd-bus/test-bus-zero-copy.c
+++ b/src/libsystemd-bus/test-bus-zero-copy.c
@@ -51,7 +51,7 @@ int main(int argc, char *argv[]) {
log_set_max_level(LOG_DEBUG);
- bus_ref = bus_kernel_create_bus("deine-mutter", &bus_name);
+ bus_ref = bus_kernel_create_bus("deine-mutter", false, &bus_name);
if (bus_ref == -ENOENT)
return EXIT_TEST_SKIP;
More information about the systemd-commits
mailing list