DBus connection peer PID

Valentin Rusu kde at rusu.info
Sun Oct 3 13:09:15 PDT 2010


> 
> To get the pid of a client you would use the
> GetConnectionUnixProcessID method on the bus. There doesn't seem to be
> a convenience wrapper in dbus-bus.h but you can call it by hand with
> whatever dbus binding you are using or by building a DBusMessage. Copy
> the code from dbus_bus_get_unix_user() and just change the name of the
> method used.

Ok, Havoc, thanks for the hint. I'll try that.

> 
> Note that you MUST use the unique bus name (starts with ":") anytime
> you care about pid or user or something, otherwise there's a race
> condition where the name owner can change between getting credentials
> and using them.
> 
> Havoc

Valentin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20101003/0a52957f/attachment.pgp>


More information about the dbus mailing list