A way to get sender's PID ?

Thiago Macieira thiago at kde.org
Fri Nov 10 06:25:40 PST 2006


Thorsten Koch wrote:
>I was not sure whether GetConnectionUnixProcessID() does the right think
> for my purpose. I thought that it would only be able to get the PID of
> a connection between two parties if there's a PID. Sorry, but I didn't
> find any documents which describe what's going on behind the scene of
> DBUS. 

Since the D-Bus server daemon works using Unix sockets, it's possible to 
use the SO_PEERCRED getsockopt() call to retrieve the peer's identity, 
including UID and PID.

But note that this only works on Unix sockets. If your D-Bus daemon is 
offering access via any other protocol (like TCP/IP), you may get an 
unreliable behaviour, since the daemon cannot determine the PID of the 
caller.

> But if I can get with that method the PID of the caller of a 
> remote method than it will be fine.
>
>To your question:
>What I wanna do is to map the caller to the callee - means their PIDs in
> order to establish a calltree.

Well, the callee is you. Why do you want to have such a calltree?

Or is this an external process that is eavesdropping and trying to provide 
timing & profiling for D-Bus calls?

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20061110/0487352e/attachment.pgp


More information about the dbus mailing list