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

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: Pre-review cleanup Created 3 years, 10 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 | « no previous file | 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..e4b6be323ca73bb1893679df12fee22bdac4d367 100644
--- a/remoting/host/it2me/it2me_host.cc
+++ b/remoting/host/it2me/it2me_host.cc
@@ -376,7 +376,7 @@ void It2MeHost::UpdateClientDomainPolicy(const std::string& client_domain) {
VLOG(2) << "UpdateClientDomainPolicy: " << client_domain;
- // When setting a client domain policy, disconnect any existing session.
+ // When setting a client domain policy, disconnect any existing session.
if (!client_domain.empty() && IsRunning()) {
DisconnectOnNetworkThread();
}
@@ -490,16 +490,14 @@ void It2MeHost::ValidateConnectionDetails(
if (!SplitJidResource(remote_jid, &client_username, /*resource=*/nullptr)) {
LOG(ERROR) << "Rejecting incoming connection from " << remote_jid
<< ": Invalid JID.";
- result_callback.Run(
- protocol::ValidatingAuthenticator::Result::ERROR_INVALID_ACCOUNT);
+ result_callback.Run(ValidationResult::ERROR_INVALID_ACCOUNT);
DisconnectOnNetworkThread();
return;
}
if (client_username.empty()) {
LOG(ERROR) << "Invalid user name passed in: " << remote_jid;
- result_callback.Run(
- protocol::ValidatingAuthenticator::Result::ERROR_INVALID_ACCOUNT);
+ result_callback.Run(ValidationResult::ERROR_INVALID_ACCOUNT);
DisconnectOnNetworkThread();
return;
}
@@ -517,6 +515,15 @@ 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) {
Sergey Ulanov 2017/03/02 23:07:29 I don't think we want to shutdown the host when th
joedow 2017/03/13 23:26:57 I missed that scenario so thanks for pointing that
+ 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());
« no previous file with comments | « no previous file | remoting/host/it2me/it2me_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698