about using privileged (KAuth) helpers: system dbus daemon on OS X?

Thiago Macieira thiago at kde.org
Tue Sep 20 16:35:57 UTC 2016


On terça-feira, 20 de setembro de 2016 18:01:05 PDT René J.V. Bertin wrote:
> In the meantime I think I understand where the connection process aborts on
> OS X: in init_connections_unlocked() (called from internal_bus_get()) when
> there is no address for neither DBUS_BUS_STARTER nor for DBUS_BUS_SESSION.
> This is considered an error by internal_bus_get() even if it is asked to
> get the DBUS_BUS_SYSTEM.
> 
> Would this be an acceptable modification to internal_bus_get()?
> 
> + #ifdef DBUS_ENABLE_LAUNCHD
> +       // on Mac we will typically not have all 3 bus addresses; as long
> +       // as we have the requested one we should be fine.
> +   if (!init_connections_unlocked () && bus_connection_addresses[type] ==
> NULL) 
> + #else
>    if (!init_connections_unlocked ())
> + #endif
>      {
>        _DBUS_SET_OOM (error);
>        goto out;
>      }

I don't see how. If I ask for A but B exists, how does that change my 
predicament?

You should probably change init_connections_unlocked instead and add a 
function like init_sessionaddress.

> >I'm not going to read its source, sorry.
> 
> 1- the service exec's main hands over control to
> KAuth::HelperSupport::helperMain() which creates a
> QCoreApplication(argc,argv) instance and then calls
> KAuth::BackendsManager::helperProxy()->initHelper(QString(<service ID>))

Nothing with D-Bus.

> 2- KAuth::BackendsManager::helperProxy() returns a KAuth::DBusHelperProxy
> instance; its ctor initialises a member variable
> m_busConnection=QDBusConnection::systemBus() . So the service exec is
> indeed supposed to connect to the system dbus, explicitly.

Right, QDBusConnection::systemBus() returns a connected QDBusConnection.

> 3- KAuth::BackendsManager::helperProxy()->initHelper() creates a new
> Kf5authAdaptor() which inherits QDBusAbstractAdaptor and sets
> autoRelaySignals=true .

Ok.

> 4- KAuth::BackendsManager::helperProxy()->initHelper() calls
> m_busConnection.registerService() with the service ID.

That only works if you've dropped a root-owned file in /etc/dbus-1/system.d

> Am I right that qdbus and qdbusViewer also use QDBusConnection::systemBus()
> to connect to the system bus? I've traced the flow down from that function
> to a call q_dbus_bus_get_private(DBUS_BUS_SYSTEM, error) which led me into
> init_connections_unlocked() as described above.

Correct.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center



More information about the dbus mailing list