On Wednesday 23 December 2015 00:59:30 Nesuan Taiso wrote:
> Suppose I have registered a QDBusAbstractAdaptor object on the D-Bus.
> 
> When one of the slots is called, how do I identify the calling user (uid
> or sid)?

Get the sender's unique connection ID from QDBusContext (message().service()) 
then call GetConnectionUnixUser on the main bus interface (see 
QDBusConnectionInterface for a wrapper, which you can get with 
connection().interface()).

As in:
        QString sender = message().service();
        QDBusReply<uint> uid = connection().interface()->serviceUid(sender);

There's a function on Windows for obtaining the SID, but there's no C++ 
wrapper for it on QDBusConnectionInterface. You'll need to do 
call("GetConnectionCredentials", sender).


-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to