[patch] gobject sender and pid

David Zeuthen david at fubar.dk
Mon Mar 13 14:24:40 PST 2006


On Mon, 2006-03-13 at 17:13 +0000, Robert McQueen wrote:
> Ross Burton wrote:
> > If you server-side methods are async, then you can call:
> > 
> > gchar* dbus_g_method_get_sender (DBusGMethodInvocation *context);

So how exactly do I do this? The Telepathy sources leads me to using
something called gengobject.py but it seems this is not part of D-BUS
and I couldn't find it anywhere though my Google skillz may be weak this
time of year. Oh, well, so, lazy as I am, I simply tried adding an
annotation

    <method name="InitiatePrivilegeGrant">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="user"            type="s" direction="in"/>
      <arg name="privilege"       type="s" direction="in"/>
      <arg name="resource"        type="s" direction="in"/>
      <arg name="session_objpath" type="o" direction="out"/>
    </method>

but still no dice with dbus-binding-tool. 

I really want to use the D-BUS glib bindings for PolicyKit but I'm
finding it rather difficult. And it's really a showstopper if I can't
get the sender (or the object path which you conveniently as another
gobject data item :-)...

> Note also that it's perfectly acceptable to mark your method as async
> and make a call to dbus_g_method_return or error from within the
> function (ie behaving synchronously). I far prefer this to the idea of
> adding a magic racy qdata value!

Sure, my patch was experimental but it should really be possible to get
the sender for sync calls too. To write a secure system bus service, you
really need to know who the caller is.

Thanks,
David




More information about the dbus mailing list