tao
tao

Reputation: 261

Who called my DBus API in Linux system

The scenario is like this:

In a Linux based handheld device I have a C app which has dbus APIs ready to be called by 3rd party apps. The DBus APIs are called during booting time.

Is there any system API I can use to in my functions to print the caller's ID and save it to syslog?

Thanks in advance!

Upvotes: 9

Views: 1237

Answers (1)

rkhayrov
rkhayrov

Reputation: 10260

/org/freedesktop/DBus object on the org.freedesktop.DBus bus has two methods belonging to the org.freedesktop.DBus interface (oh, well): GetConnectionUnixUser and GetConnectionUnixProcessID. Both accept a string—unique connection name which can be obtained by calling dbus_message_get_sender (or whatever method your high-level API wrapper offers).

Upvotes: 5

Related Questions