When "activating" systemd, handle its special case better
authorChengwei Yang <chengwei.yang@intel.com>
Wed, 29 May 2013 12:50:21 +0000 (20:50 +0800)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 5 Jun 2013 15:33:59 +0000 (16:33 +0100)
commit8b3681e35d1a4496c5e465caeddb520e6bb797be
tree012cbe568899185c90f79d47056ea9924dd73f23
parentd35f64339e401a7a47c1b088ef26e3dcb202cb9d
When "activating" systemd, handle its special case better

When dbus-daemon receives a request to activate a systemd service before
systemd has connected to it, it enqueues a fake request to "activate"
systemd itself (as a way to get a BusPendingActivationEntry to track the
process of waiting for systemd). When systemd later joins the bus,
dbus-daemon sends the actual activation message; any future activation
messages are sent directly to systemd.

In the "pending" code path, the activation messages are currently
dispatched as though they had been sent by the same process that sent
the original activation request, which is wrong: the bus security
policy probably doesn't allow that process to talk to systemd directly.
They should be dispatched as though they had been sent by the
dbus-daemon itself (connection == NULL), the same as in the non-pending
code path.

In the worst case, if the attempt to activate systemd timed out, the
dbus-daemon would crash with a (fatal) warning, because in this special
case, activation_message is a signal with no serial number, whereas the
code to send an error reply is expecting a method call with a serial
number.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=50199
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Tested-by: Ma Yu <yu.ma@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
bus/activation.c