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
542d94a7
Commit
542d94a7
authored
Sep 24, 2020
by
Albert Vaca Cintora
Browse files
Limit number of connected sockets from unpaired devices
Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
parent
8112729e
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/backends/lan/lanlinkprovider.cpp
View file @
542d94a7
...
...
@@ -33,6 +33,8 @@
#define MIN_VERSION_WITH_SSL_SUPPORT 6
static
const
int
MAX_UNPAIRED_CONNECTIONS
=
42
;
LanLinkProvider
::
LanLinkProvider
(
bool
testMode
,
quint16
udpBroadcastPort
,
...
...
@@ -580,6 +582,15 @@ void LanLinkProvider::addLink(const QString& deviceId, QSslSocket* socket, Netwo
deviceLink
->
reset
(
socket
,
connectionOrigin
);
}
else
{
deviceLink
=
new
LanDeviceLink
(
deviceId
,
this
,
socket
,
connectionOrigin
);
// Socket disconnection will now be handled by LanDeviceLink
disconnect
(
socket
,
&
QAbstractSocket
::
disconnected
,
socket
,
&
QObject
::
deleteLater
);
bool
isDeviceTrusted
=
KdeConnectConfig
::
instance
().
trustedDevices
().
contains
(
deviceId
);
if
(
!
isDeviceTrusted
&&
m_links
.
size
()
>
MAX_UNPAIRED_CONNECTIONS
)
{
qCWarning
(
KDECONNECT_CORE
)
<<
"Too many unpaired devices to remember them all. Ignoring "
<<
deviceId
;
socket
->
disconnectFromHost
();
socket
->
deleteLater
();
return
;
}
connect
(
deviceLink
,
&
QObject
::
destroyed
,
this
,
&
LanLinkProvider
::
deviceLinkDestroyed
);
m_links
[
deviceId
]
=
deviceLink
;
if
(
m_pairingHandlers
.
contains
(
deviceId
))
{
...
...
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