summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSteffen Kieß <Steffen.Kiess@ipvs.uni-stuttgart.de>2020-07-13 18:40:12 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-07-13 22:05:25 +0000
commit3c2f7af2094adc924b3cffadf77602f0f8c47f93 (patch)
treebbc9597ea3e4d8c665ca782a42391517f9fe2213 /tests
parentd97d549391f088e7cabd423700d77407a1d31fa5 (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. Fixes: QTBUG-85396 Change-Id: Ib83213ebcd3255fb091c6faefb3618745b8d736c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 6d880185b1483b4efb3e358815060537d91b0de4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp5
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