[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: Need to know client/caller pid on the server side
From:       Havoc Pennington <hp () redhat ! com>
Date:       2007-10-25 22:42:04
Message-ID: 47211BBC.2070503 () redhat ! com
[Download RAW message or body]

Hi,

masala north wrote:
> We are developing a security frame work sitting on top of dbus. Is it 
> possible to get the pid of the calling/client process?
> 

If you are talking to another program directly (no bus daemon) you would 
use dbus_connection_get_unix_process_id / dbus_connection_get_unix_user

If you are using the bus daemon, you need to ask the bus daemon to call 
those functions for you.

To see the methods on the bus daemon type this command:
  dbus-send --print-reply --dest=org.freedesktop.DBus 
org.freedesktop.DBus.Introspectable.Introspect

In this case you want GetConnectionUnixUser and GetConnectionUnixProcessID.

There is a convenience function dbus_bus_get_unix_user() that calls 
GetConnectionUnixUser, but the convenience function makes a blocking 
call. There's no convenience function for the process ID one.

To get the name of the client use dbus_message_get_sender()

Havoc


_______________________________________________
dbus mailing list
dbus@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dbus
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic