From ac7f4d061854f378e625070f334dd968983c05b6 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 13 Aug 2013 05:40:39 +0200 Subject: [PATCH] Disable sending packages to untrusted devices --- daemon/device.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/daemon/device.cpp b/daemon/device.cpp index dfcef41c8..a86d95147 100644 --- a/daemon/device.cpp +++ b/daemon/device.cpp @@ -156,6 +156,11 @@ void Device::removeLink(DeviceLink* link) bool Device::sendPackage(const NetworkPackage& np) const { + if (!m_paired) { + //qDebug() << "sendpackage disabled on untrusted device" << name(); + return false; + } + Q_FOREACH(DeviceLink* dl, m_deviceLinks) { //TODO: Actually detect if a package is received or not, now when have TCP //"ESTABLISHED" connections that look legit and return true when we use them, @@ -170,7 +175,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np) if (np.type() == "kdeconnect.identity" && !m_knownIdentiy) { m_deviceName = np.get("deviceName"); } else if (m_paired) { - qDebug() << "package received from trusted device"; + //qDebug() << "package received from trusted device" << name(); Q_EMIT receivedPackage(np); } else { qDebug() << "device" << name() << "not trusted, ignoring package" << np.type();