Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KDE Connect
Commits
bd27aec9
Commit
bd27aec9
authored
Sep 24, 2020
by
Albert Vaca Cintora
Browse files
Do not replace connections for a given deviceId if the certs have changed
Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
parent
ce0f00fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/backends/lan/landevicelink.cpp
View file @
bd27aec9
...
...
@@ -178,3 +178,8 @@ bool LanDeviceLink::linkShouldBeKeptAlive() {
//return (mConnectionSource == ConnectionStarted::Remotely || pairStatus() == Paired);
}
QSslCertificate
LanDeviceLink
::
certificate
()
const
{
return
m_socketLineReader
->
peerCertificate
();
}
core/backends/lan/landevicelink.h
View file @
bd27aec9
...
...
@@ -42,6 +42,7 @@ public:
bool
linkShouldBeKeptAlive
()
override
;
QHostAddress
hostAddress
()
const
;
QSslCertificate
certificate
()
const
;
private
Q_SLOTS
:
void
dataReceived
();
...
...
core/backends/lan/lanlinkprovider.cpp
View file @
bd27aec9
...
...
@@ -363,6 +363,12 @@ void LanLinkProvider::encrypted()
NetworkPacket
*
receivedPacket
=
m_receivedIdentityPackets
[
socket
].
np
;
const
QString
&
deviceId
=
receivedPacket
->
get
<
QString
>
(
QStringLiteral
(
"deviceId"
));
if
(
m_links
.
contains
(
deviceId
)
&&
m_links
[
deviceId
]
->
certificate
()
!=
socket
->
peerCertificate
())
{
socket
->
disconnectFromHost
();
qCWarning
(
KDECONNECT_CORE
)
<<
"Got connection for the same deviceId but certificates don't match. Ignoring "
<<
deviceId
;
return
;
}
addLink
(
deviceId
,
socket
,
receivedPacket
,
connectionOrigin
);
// Copied from tcpSocketConnected slot, now delete received packet
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment