Get the client PID in a server request

Luca Ferrari luka4e at gmail.com
Mon Oct 20 08:33:24 PDT 2008


Thank you for your reply....


> If this is a direct connection, there's dbus_connection_get_unix_user.
>
> If you're receiving this message through the bus, call the
> org.freedesktop.DBus.GetConnectionUnixUser on the bus.  Example Python:
>
> python -c "import dbus;
> bus=dbus.SystemBus().get_object('org.freedesktop.DBus',
> '/org/freedesktop/DBus'); print dbus.Interface(bus,
> 'org.freedesktop.DBus').GetConnectionUnixUser(':1.11')"
>

I don't know how I can use that method.... What is ":1.11"?

if I have the SERVER's METHOD declared in this way in the (SERVER class):


@dbus.service.method("org.my.blabla")
def METHOD(self):
    client_pid = ?????????
    if client_pid in myarray:
         #........................................


and the client would like to run that method in this way:

bus=dbus.SystemBus().get_object('org.my.blabla', '/org/my/BlaBla');
dbus.Interface(bus, 'org.my.blabla').METHOD()


how can I get the client_pid ?

Thank you very much, this is very important to me!

Luca


More information about the dbus mailing list