dbus.user-session.upstart could avoid mktemp
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dbus (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
While investigating a separate bug I happened to look at dbus.user-
> pre-start script
> DBUS_SESSION_
> initctl set-env DBUS_SESSION_
> end script
>
>
> exec dbus-daemon --fork --session --address=
One obvious simplification you could use here would be to ask dbus-daemon to listen on an arbitrarily selected abstract AF_UNIX address and tell you which one it used. In principle libdbus could have a retry loop to try multiple possibilities if the one it selects first is in use (which this use of mktemp obviously won't do); at the moment it doesn't, because the probability of a successful DoS by creating lots of abstract sockets is low (approximately n in 3e15, where n is the number of sockets created by an attacker), but I'd review a patch to dbus/dbus-
That would look something like this (please interpret this as pseudocode rather than a proposed patch, I don't actually know Upstart syntax):
exec script
# the default listening address is equivalent to --address=
dbus-daemon --fork --session --print-address=5 5>"$XDG_
end script
post-start script
initctl set-env --global DBUS_SESSION_
initctl notify-dbus-address "$DBUS_
end script
which is already somewhat simpler. This would also have the advantage that the advertised address would contain the bus's GUID like it does with traditional dbus-launch, meaning that dbus_connection
However, since the current script only seems to support one dbus-daemon per $XDG_RUNTIME_DIR anyway, there's little point in using mktemp or unix:tmpdir: the job could instead force a specific address, like the systemd unit in dbus-user-session does. Modern libdbus (1.10+) and GDBus (2.45.3+) will try $XDG_RUNTIME_
exec dbus-daemon --fork --session --address=
post-start initctl set-env --global DBUS_SESSION_
post-start initctl notify-dbus-address "unix:path=
(This could be combined with --print-address if you want to know the full address with the guid.)
Or, if the intention is to support multiple login sessions per user-session (see <https:/