Chromium Code Reviews| 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()); |