dbus getting Originator ID in C

Tom Cocagne tom.cocagne at gmail.com
Mon Feb 11 13:38:59 PST 2013

_get_sender() returns the unique DBus connection ID associated with
the caller. The DBus daemon provides the
"org.freedesktop.DBus.GetConnectionUnixUser" function to determine
which user id is associated with a unique connection id. From there,
you can obtain the human-readable username via the glibc's  getpwuid()

I'm not very familiar with the DBus interface you're using but the
basic steps are:

1. conid = _get_sender()
2. userid = dbus_daemon.GetConnectionUnixUser(conid)
3. pwent = getpwuid(userid)
4. return pwent->pw_name


On Mon, Feb 11, 2013 at 2:29 PM, Richard <tuxbox.guru at gmail.com> wrote:
> Hi All,
> Pardon the intrusion but I am on the quest for some information as I
> am stuck. I tried searching but I am at a loss what to search for, but
> here goes.
> I am implementing a dbus based client and server and would like to
> know how to get the common name of sender of the message.
> Client                          Server
> dvb.ingres.client --->     dvb.settings.server
> I can receive all the messages at the server but would like to know
> WHO sent the message.   _get_sender() returns a chaging number,
> get_server_id returns a large number that I dont know where it comes
> from.
> Is there a way to get the human readable name of the message
> originator? (who the client is)
> Any help would be kindly appreciated.
> Richard
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus

More information about the dbus mailing list