3
votes

I'm using gio, and this DBus implementation to register some internal object of a daemon. I did all my test with a SESSION wide Dbus and everythings worked fine, but I tried to use the systemwide registration, and since my name registration failed.

I'm using g_bus_own_name to acquire the name, and my error case respond the the bus_acquired_handler then name_lost_handler scenario.

any ideas, how can I solve this issue, or how can I get more information about the error ?

GIO : https://developer.gnome.org/gio/2.38/gio-Owning-Bus-Names.html#g-bus-own-name

This is the dbus-monitor trace :

signal sender=org.freedesktop.DBus -> dest=:1.96 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.96"


signal sender=:1.95 -> dest=(null destination) serial=3 path=/org/ast/AstCore; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.ast.AstCore"
array [
dict entry(
string "state"
variant int32 3
)
]
array [
]


signal sender=:1.95 -> dest=(null destination) serial=5 path=/org/ast/AstCore; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.ast.AstCore"
array [
dict entry(
string "state"
variant int32 4
)
]
array [
]


signal sender=org.freedesktop.DBus -> dest=(null destination) serial=173 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.95"
string ":1.95"
string ""


signal sender=org.freedesktop.DBus -> dest=(null destination) serial=174 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.97"
string ""
string ":1.97"


2
The security settings of the bus are probably preventing it - Check the files in /etc/dbus-1/system.xml and /etc/dbus-1/system.d/rm5248

2 Answers

7
votes

As mentioned in /etc/dbus-1/system.conf

<!-- Holes must be punched in service configuration files for
     name ownership and sending method calls -->
<deny own="*"/>
...

Add your own configuration file (e.g astcore.conf) in /etc/dbus-1/system.d/ to allow your app to own the specific bus name.

1
votes

Never use a null destination with GDBus, it is not implemented.

I filed some patches a few weeks ago, but it seems like NULL interface calls will be purged from the DBus specification quite soonish.

https://bugzilla.gnome.org/show_bug.cgi?id=706675


Note that the dbus daemon will filter NULL interface messages out of the stream and just drop them (last 2 posts) - after all NULL interfaces are a potential security thread and could bypass filtering of the global dbus-daemon:

https://bugs.freedesktop.org/show_bug.cgi?id=68597