[systemd-commits] 4 commits - TODO src/bus-driverd src/bus-proxyd src/nspawn
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Jan 29 16:52:31 PST 2014
TODO | 7 ------
src/bus-driverd/bus-driverd.c | 44 +++++++++++++++++++++++++++++++-----------
src/bus-proxyd/bus-proxyd.c | 32 ++++++++++++++++++++++++++++++
src/nspawn/nspawn.c | 12 +++++------
4 files changed, 71 insertions(+), 24 deletions(-)
New commits:
commit 084f83586e53384f76b5c71b73c9d7d6517923fe
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jan 29 21:10:41 2014 +0100
update TODO
diff --git a/TODO b/TODO
index ad21b03..e6e2a87 100644
--- a/TODO
+++ b/TODO
@@ -56,8 +56,6 @@ Features:
* machinectl bash completion is missing
* busctl bash and zsh completions are outdated
-* Introduce PrivateDevices=yes/no which works like PrivateTmp= but for /dev setting up a tmpfs for it that only includes /dev/null, /dev/zero, /dev/random, /dev/urandom, but nothing else.
-
* libsystemd-journal returns the object created as first param in sd_journal_new(), sd_bus_new() and suchlike as last...
* cgroups:
@@ -82,8 +80,6 @@ Features:
* when we detect low battery and no AC on boot, show pretty splash and refuse boot
-* move libasyncns into systemd as libsystemd-asyncns
-
* machined, localed: when we try to kill an empty cgroup, generate an ESRCH error over the bus
* libsystemd-journal, libsystemd-login, libudev: add calls to easily attach these objects to sd-event event loops
@@ -153,10 +149,7 @@ Features:
- GVariant
- "const" properties (posted)
- port exit-on-idle logic to byebye ioctl
- - bus proxy: override unique id sender for messages from driver to match the well-known name
- - bus driver: GetNameOwner() for "org.freedesktop.DBus" should return "org.freedesktop.DBus"
- update systemd.special(7) to mention that dbus.socket is only about the compatibility socket now
- - bus proxy should fake seclabel when connecting to kdbus
- allow updating attach flags during runtime
- pid1: peek into activating message when activating a service
- test bloom filter generation indexes
commit 7b217f41d2e31330b47aeaadbd3bf93c9eb1ce46
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jan 29 21:23:41 2014 +0100
bus: when proxying messages from the bus driver patch the driver's well-known name into the sender
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c
index b038459..ab9b836 100644
--- a/src/bus-proxyd/bus-proxyd.c
+++ b/src/bus-proxyd/bus-proxyd.c
@@ -395,6 +395,36 @@ static int process_hello(sd_bus *a, sd_bus *b, sd_bus_message *m, bool *got_hell
return 1;
}
+static int patch_sender(sd_bus *a, sd_bus_message *m) {
+ char **well_known = NULL;
+ sd_bus_creds *c;
+ int r;
+
+ assert(a);
+ assert(m);
+
+ if (!a->is_kernel)
+ return 0;
+
+ /* We will change the sender of messages from the bus driver
+ * so that they originate from the bus driver. This is a
+ * speciality originating from dbus1, where the bus driver did
+ * not have a unique id, but only the well-known name. */
+
+ c = sd_bus_message_get_creds(m);
+ if (!c)
+ return 0;
+
+ r = sd_bus_creds_get_well_known_names(c, &well_known);
+ if (r < 0)
+ return r;
+
+ if (strv_contains(well_known, "org.freedesktop.DBus"))
+ m->sender = "org.freedesktop.DBus";
+
+ return 0;
+}
+
int main(int argc, char *argv[]) {
_cleanup_bus_unref_ sd_bus *a = NULL, *b = NULL;
@@ -612,6 +642,8 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ patch_sender(a, m);
+
k = sd_bus_send(b, m, NULL);
if (k < 0) {
if (k == -ECONNRESET)
commit e7b251913e8a2189de14778b6e92c08764ab2012
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jan 29 21:07:50 2014 +0100
bus: the owner of the bus driver name as reported by the driver's
GetNameOwner() bus call is the bus driver name itself, for compatibility
with dbus1
diff --git a/src/bus-driverd/bus-driverd.c b/src/bus-driverd/bus-driverd.c
index acb5e6b..b972066 100644
--- a/src/bus-driverd/bus-driverd.c
+++ b/src/bus-driverd/bus-driverd.c
@@ -365,19 +365,14 @@ finish:
return r;
}
-static int get_creds(sd_bus *bus, sd_bus_message *m, uint64_t mask, sd_bus_creds **_creds, sd_bus_error *error) {
+static int get_creds_by_name(sd_bus *bus, const char *name, uint64_t mask, sd_bus_creds **_creds, sd_bus_error *error) {
_cleanup_bus_creds_unref_ sd_bus_creds *c = NULL;
- const char *name;
int r;
assert(bus);
- assert(m);
+ assert(name);
assert(_creds);
- r = sd_bus_message_read(m, "s", &name);
- if (r < 0)
- return r;
-
assert_return(service_name_is_valid(name), -EINVAL);
r = sd_bus_get_owner(bus, name, mask, &c);
@@ -395,12 +390,28 @@ static int get_creds(sd_bus *bus, sd_bus_message *m, uint64_t mask, sd_bus_creds
return 0;
}
+
+static int get_creds_by_message(sd_bus *bus, sd_bus_message *m, uint64_t mask, sd_bus_creds **_creds, sd_bus_error *error) {
+ const char *name;
+ int r;
+
+ assert(bus);
+ assert(m);
+ assert(_creds);
+
+ r = sd_bus_message_read(m, "s", &name);
+ if (r < 0)
+ return r;
+
+ return get_creds_by_name(bus, name, mask, _creds, error);
+}
+
static int driver_get_security_context(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
int r;
- r = get_creds(bus, m, SD_BUS_CREDS_SELINUX_CONTEXT, &creds, error);
+ r = get_creds_by_message(bus, m, SD_BUS_CREDS_SELINUX_CONTEXT, &creds, error);
if (r < 0)
return r;
@@ -419,7 +430,7 @@ static int driver_get_pid(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
int r;
- r = get_creds(bus, m, SD_BUS_CREDS_PID, &creds, error);
+ r = get_creds_by_message(bus, m, SD_BUS_CREDS_PID, &creds, error);
if (r < 0)
return r;
@@ -430,7 +441,7 @@ static int driver_get_user(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
int r;
- r = get_creds(bus, m, SD_BUS_CREDS_UID, &creds, error);
+ r = get_creds_by_message(bus, m, SD_BUS_CREDS_UID, &creds, error);
if (r < 0)
return r;
@@ -439,9 +450,20 @@ static int driver_get_user(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu
static int driver_get_name_owner(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) {
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
+ const char *name;
int r;
- r = get_creds(bus, m, SD_BUS_CREDS_UNIQUE_NAME, &creds, error);
+ r = sd_bus_message_read(m, "s", &name);
+ if (r < 0)
+ return r;
+
+ /* Here's a special exception for compatibility with dbus1:
+ * the bus name of the driver is owned by itself, not by a
+ * unique ID. */
+ if (streq(name, "org.freedesktop.DBus"))
+ return sd_bus_reply_method_return(m, "s", "org.freedesktop.DBus");
+
+ r = get_creds_by_name(bus, name, SD_BUS_CREDS_UNIQUE_NAME, &creds, error);
if (r < 0)
return r;
commit 40ddbdf85b592add401a0fbc963cec93559def54
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jan 29 20:58:50 2014 +0100
nspawn: fix reboot event fd reuse
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 38ec89b..5352b95 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1206,12 +1206,6 @@ int main(int argc, char *argv[]) {
goto finish;
}
- sync_fd = eventfd(0, EFD_CLOEXEC);
- if (sync_fd < 0) {
- log_error("Failed to create event fd: %m");
- goto finish;
- }
-
sd_notify(0, "READY=1");
assert_se(sigemptyset(&mask) == 0);
@@ -1221,6 +1215,12 @@ int main(int argc, char *argv[]) {
for (;;) {
siginfo_t status;
+ sync_fd = eventfd(0, EFD_CLOEXEC);
+ if (sync_fd < 0) {
+ log_error("Failed to create event fd: %m");
+ goto finish;
+ }
+
pid = syscall(__NR_clone, SIGCHLD|CLONE_NEWIPC|CLONE_NEWNS|CLONE_NEWPID|CLONE_NEWUTS|(arg_private_network ? CLONE_NEWNET : 0), NULL);
if (pid < 0) {
if (errno == EINVAL)
More information about the systemd-commits
mailing list