Do not compare against the current version of the protocol
This commit is contained in:
parent
e66096d05a
commit
91c23dfdea
1 changed files with 6 additions and 5 deletions
|
@ -43,6 +43,8 @@
|
||||||
#include <QtNetwork/qsslcipher.h>
|
#include <QtNetwork/qsslcipher.h>
|
||||||
#include <QtNetwork/qsslconfiguration.h>
|
#include <QtNetwork/qsslconfiguration.h>
|
||||||
|
|
||||||
|
#define MIN_VERSION_WITH_SSL_SUPPORT 6
|
||||||
|
|
||||||
LanLinkProvider::LanLinkProvider(bool testMode)
|
LanLinkProvider::LanLinkProvider(bool testMode)
|
||||||
: mTestMode(testMode)
|
: mTestMode(testMode)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +228,7 @@ void LanLinkProvider::connected()
|
||||||
qCDebug(KDECONNECT_CORE) << "Handshaking done (i'm the existing device)";
|
qCDebug(KDECONNECT_CORE) << "Handshaking done (i'm the existing device)";
|
||||||
|
|
||||||
// if ssl supported
|
// if ssl supported
|
||||||
if (receivedPackage->get<int>("protocolVersion") >= NetworkPackage::ProtocolVersion) {
|
if (receivedPackage->get<int>("protocolVersion") >= MIN_VERSION_WITH_SSL_SUPPORT) {
|
||||||
// since I support ssl and remote device support ssl
|
// since I support ssl and remote device support ssl
|
||||||
|
|
||||||
socket->setPeerVerifyName(deviceId);
|
socket->setPeerVerifyName(deviceId);
|
||||||
|
@ -249,7 +251,7 @@ void LanLinkProvider::connected()
|
||||||
socket->startServerEncryption();
|
socket->startServerEncryption();
|
||||||
return; // Return statement prevents from deleting received package, needed in slot "encrypted"
|
return; // Return statement prevents from deleting received package, needed in slot "encrypted"
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Incompatible protocol version, this won't work";
|
qWarning() << receivedPackage->get<QString>("deviceName") << "uses an old protocol version, this won't work";
|
||||||
//addLink(deviceId, socket, receivedPackage, LanDeviceLink::Remotely);
|
//addLink(deviceId, socket, receivedPackage, LanDeviceLink::Remotely);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +277,6 @@ void LanLinkProvider::encrypted()
|
||||||
|
|
||||||
NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np;
|
NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np;
|
||||||
const QString& deviceId = receivedPackage->get<QString>("deviceId");
|
const QString& deviceId = receivedPackage->get<QString>("deviceId");
|
||||||
//qCDebug(KDECONNECT_CORE) << "Connected" << socket->isWritable();
|
|
||||||
|
|
||||||
addLink(deviceId, socket, receivedPackage, LanDeviceLink::Remotely);
|
addLink(deviceId, socket, receivedPackage, LanDeviceLink::Remotely);
|
||||||
|
|
||||||
|
@ -376,7 +377,7 @@ void LanLinkProvider::dataReceived()
|
||||||
//This socket will now be owned by the LanDeviceLink or we don't want more data to be received, forget about it
|
//This socket will now be owned by the LanDeviceLink or we don't want more data to be received, forget about it
|
||||||
disconnect(socket, SIGNAL(readyRead()), this, SLOT(dataReceived()));
|
disconnect(socket, SIGNAL(readyRead()), this, SLOT(dataReceived()));
|
||||||
|
|
||||||
if (NetworkPackage::ProtocolVersion <= np->get<int>("protocolVersion")) {
|
if (np->get<int>("protocolVersion") >= MIN_VERSION_WITH_SSL_SUPPORT) {
|
||||||
// since I support ssl and remote device support ssl
|
// since I support ssl and remote device support ssl
|
||||||
|
|
||||||
bool isDeviceTrusted = KdeConnectConfig::instance()->trustedDevices().contains(deviceId);
|
bool isDeviceTrusted = KdeConnectConfig::instance()->trustedDevices().contains(deviceId);
|
||||||
|
@ -400,7 +401,7 @@ void LanLinkProvider::dataReceived()
|
||||||
|
|
||||||
socket->startClientEncryption();
|
socket->startClientEncryption();
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Incompatible protocol version, this won't work";
|
qWarning() << np->get<QString>("deviceName") << "uses an old protocol version, this won't work";
|
||||||
//addLink(deviceId, socket, np, LanDeviceLink::Locally);
|
//addLink(deviceId, socket, np, LanDeviceLink::Locally);
|
||||||
delete receivedIdentityPackages.take(socket).np;
|
delete receivedIdentityPackages.take(socket).np;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue