summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2015-08-20 08:34:30 +0000
committerRobin Burchell <robin.burchell@viroteck.net>2015-08-20 13:08:42 +0000
commitb074cb8a42d9f4ea83806617b5a58d06b68739c7 (patch)
tree57a91597488ba47c5f021a444e98d3d6f32542e4 /src
parent1f5329a9ae80bfc9616cb873c09a0665e4544794 (diff)
bluez: peername: find a device before creating it.
To enable reading peername for known devices even if org.bluez.Adapter.CreateDevice has security restrictions, call org.bluez.Adapter.FindDevice first and CreateDevice only if the device isn't already known. The change is needed due to runtime security checks on Jolla devices, but reordering the calls does no harm when used with upstream bluetoothd. Change-Id: I4a86840487a8b4c90759044b7c995815c77a7609 Task-number: MER#1225 Done-by: Hannu Mallat <hannu.mallat@jollamobile.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qbluetoothsocket_bluez.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothsocket_bluez.cpp b/src/bluetooth/qbluetoothsocket_bluez.cpp
index 51bc5179..6947e9d0 100644
--- a/src/bluetooth/qbluetoothsocket_bluez.cpp
+++ b/src/bluetooth/qbluetoothsocket_bluez.cpp
@@ -407,13 +407,13 @@ QString QBluetoothSocketPrivate::peerName() const
OrgBluezAdapterInterface adapter(QStringLiteral("org.bluez"), reply.value().path(),
QDBusConnection::systemBus());
- QDBusPendingReply<QDBusObjectPath> deviceObjectPath = adapter.CreateDevice(peerAddress);
+ QDBusPendingReply<QDBusObjectPath> deviceObjectPath = adapter.FindDevice(peerAddress);
deviceObjectPath.waitForFinished();
if (deviceObjectPath.isError()) {
- if (deviceObjectPath.error().name() != QStringLiteral("org.bluez.Error.AlreadyExists"))
+ if (deviceObjectPath.error().name() != QStringLiteral("org.bluez.Error.DoesNotExist"))
return QString();
- deviceObjectPath = adapter.FindDevice(peerAddress);
+ deviceObjectPath = adapter.CreateDevice(peerAddress);
deviceObjectPath.waitForFinished();
if (deviceObjectPath.isError())
return QString();