diff options
author | Steffen Kieß <Steffen.Kiess@ipvs.uni-stuttgart.de> | 2020-07-13 18:40:12 +0200 |
---|---|---|
committer | Steffen Kieß <Steffen.Kiess@ipvs.uni-stuttgart.de> | 2020-07-13 20:45:20 +0200 |
commit | 6d880185b1483b4efb3e358815060537d91b0de4 (patch) | |
tree | 8c669442c04ac693fa18ff570ad45bbaf58b4465 /tests | |
parent | 2a5ad75ec88d4d3cf2a0903bbfd2ff4a6785dcde (diff) |
Fix passing QDBusUnixFileDescriptors over peer-to-peer connections
Passing QDBusUnixFileDescriptors over peer-to-peer connections currently
does not work, because QDBusConnectionPrivate::setPeer() does not set
this->capabilities (unlike QDBusConnectionPrivate::setConnection()
which is executed for bus connections).
Keep track of whether the connection already has been authenticated, and
once the connection does get authenticated, update this->capabilities.
Note that sending a message directly after connecting (before any
message has been received from the peer) might still fail if the message
contains a QDBusUnixFileDescriptor.
Pick-to: 5.15
Fixes: QTBUG-85396
Change-Id: Ib83213ebcd3255fb091c6faefb3618745b8d736c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp index 6b4ddeaba5..b483372ead 100644 --- a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp +++ b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp @@ -1110,8 +1110,9 @@ void tst_QDBusMarshall::receiveUnknownType() QSKIP("Your session bus does not allow sending Unix file descriptors"); // make sure this QDBusConnection won't handle Unix file descriptors - QDBusConnection::ConnectionCapabilities &capabRef = QDBusConnectionPrivate::d(con)->capabilities; - SetResetValue<QDBusConnection::ConnectionCapabilities> resetter(capabRef, capabRef & ~QDBusConnection::UnixFileDescriptorPassing); + QAtomicInt &capabRef = QDBusConnectionPrivate::d(con)->capabilities; + SetResetValue<QAtomicInt> resetter(capabRef, + capabRef & ~QDBusConnection::UnixFileDescriptorPassing); if (qstrcmp(QTest::currentDataTag(), "in-call") == 0) { // create a call back to us containing a file descriptor |