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

Unified Diff: remoting/host/it2me/it2me_host.cc

Issue 2724223003: Disconnect all users if too many connection requests are received for It2Me (Closed)
Patch Set: Addressing CR Feedback Created 3 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
« no previous file with comments | « remoting/host/it2me/it2me_host.h ('k') | remoting/host/it2me/it2me_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/it2me/it2me_host.cc
diff --git a/remoting/host/it2me/it2me_host.cc b/remoting/host/it2me/it2me_host.cc
index f95c7aae786491f42cc30b9c07d952675c41a0a5..cfa303e03facaf0633bb78a5a5cde5bb15e2f901 100644
--- a/remoting/host/it2me/it2me_host.cc
+++ b/remoting/host/it2me/it2me_host.cc
@@ -52,6 +52,7 @@ const int kMaxLoginAttempts = 5;
using protocol::ValidatingAuthenticator;
typedef ValidatingAuthenticator::Result ValidationResult;
typedef ValidatingAuthenticator::ValidationCallback ValidationCallback;
+typedef ValidatingAuthenticator::ResultCallback ValidationResultCallback;
} // namespace
@@ -482,7 +483,7 @@ void It2MeHost::OnReceivedSupportID(
void It2MeHost::ValidateConnectionDetails(
const std::string& remote_jid,
- const protocol::ValidatingAuthenticator::ResultCallback& result_callback) {
+ const ValidationResultCallback& result_callback) {
DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
// First ensure the JID we received is valid.
@@ -517,6 +518,16 @@ void It2MeHost::ValidateConnectionDetails(
}
}
+ // If we receive valid connection details multiple times, then we don't know
+ // which remote user (if either) is valid so disconnect everyone.
+ if (state_ != kReceivedAccessCode) {
+ DCHECK_EQ(kConnecting, state_);
+ LOG(ERROR) << "Received too many connection requests.";
+ result_callback.Run(ValidationResult::ERROR_TOO_MANY_CONNECTIONS);
+ DisconnectOnNetworkThread();
+ return;
+ }
+
HOST_LOG << "Client " << client_username << " connecting.";
SetState(kConnecting, std::string());
@@ -530,7 +541,7 @@ void It2MeHost::ValidateConnectionDetails(
}
void It2MeHost::OnConfirmationResult(
- const protocol::ValidatingAuthenticator::ResultCallback& result_callback,
+ const ValidationResultCallback& result_callback,
It2MeConfirmationDialog::Result result) {
DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
« no previous file with comments | « remoting/host/it2me/it2me_host.h ('k') | remoting/host/it2me/it2me_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698