Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: remoting/host/chromoting_host.cc

Issue 205583011: [Draft] Fix canceling pin prompt causes host overload (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Unittests and also reject connections upon authenticating Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/host/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index e4bdae75990a3a93c2c1ac8229ee2ceb544ee95b..010dd25fd1cba4bdc0c5f90a1f06617bd7e3d8fa 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -171,6 +171,17 @@ void ChromotingHost::SetMaximumSessionDuration(
////////////////////////////////////////////////////////////////////////////
// protocol::ClientSession::EventHandler implementation.
+void ChromotingHost::OnSessionAuthenticating(ClientSession* client) {
+ // We treat each incoming connection as a failure to authenticate,
+ // and clear the backoff when a connection successfully
+ // authenticates. This allows the backoff to protect from parallel
+ // connection attempts as well as sequential ones.
+ if (login_backoff_.ShouldRejectRequest()) {
+ client->DisconnectSession();
Sergey Ulanov 2014/03/27 19:06:55 return here. We don't want to increment backoff on
kelvinp 2014/04/01 21:23:49 Done.
+ }
+ login_backoff_.InformOfRequest(false);
+}
+
bool ChromotingHost::OnSessionAuthenticated(ClientSession* client) {
DCHECK(CalledOnValidThread());
@@ -265,16 +276,12 @@ void ChromotingHost::OnIncomingSession(
}
if (login_backoff_.ShouldRejectRequest()) {
+ LOG(WARNING) << "Rejecting connection due to"
+ " an overload of failed login attempts.";
*response = protocol::SessionManager::OVERLOAD;
return;
}
- // We treat each incoming connection as a failure to authenticate,
- // and clear the backoff when a connection successfully
- // authenticates. This allows the backoff to protect from parallel
- // connection attempts as well as sequential ones.
- login_backoff_.InformOfRequest(false);
-
protocol::SessionConfig config;
if (!protocol_config_->Select(session->candidate_config(), &config)) {
LOG(WARNING) << "Rejecting connection from " << session->jid()

Powered by Google App Engine
This is Rietveld 408576698