Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Who called my DBus API in Linux system

Tags:

linux

sender

dbus

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!

like image 985
tao Avatar asked May 04 '11 14:05

tao


1 Answers

/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).

like image 100
rkhayrov Avatar answered Oct 13 '22 11:10

rkhayrov