Skip to content
Permalink
Browse files Browse the repository at this point in the history
Do not let lanlink connections stay open for long without authenticating
If there's no information received, close the socket to try again.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
  • Loading branch information
aleixpol authored and albertvaka committed Oct 2, 2020
1 parent 4fbd01a commit 024e5f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/backends/lan/lanlinkprovider.cpp
Expand Up @@ -392,6 +392,16 @@ void LanLinkProvider::newConnection()
connect(socket, &QIODevice::readyRead,
this, &LanLinkProvider::dataReceived);

QTimer* timer = new QTimer(socket);
timer->setSingleShot(true);
timer->setInterval(1000);
connect(socket, &QSslSocket::encrypted,
timer, &QObject::deleteLater);
connect(timer, &QTimer::timeout, socket, [socket] {
qCWarning(KDECONNECT_CORE) << "LanLinkProvider/newConnection: Host timed out without sending any identity." << socket->peerAddress();
socket->disconnectFromHost();
});
timer->start();
}
}

Expand Down

0 comments on commit 024e5f2

Please sign in to comment.