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

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

Issue 2398803002: Disconnect It2Me session if the incoming connection is invalid (Closed)
Patch Set: Prereview cleanup Created 4 years, 2 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 6f28fa5f0c7ee4cc99dcdebe0121304ed11c4136..d1528c3cf73845ff8a65074ed66fb0f98696c367 100644
--- a/remoting/host/it2me/it2me_host.cc
+++ b/remoting/host/it2me/it2me_host.cc
@@ -483,6 +483,8 @@ void It2MeHost::OnReceivedSupportID(
void It2MeHost::ValidateConnectionDetails(
const std::string& remote_jid,
const protocol::ValidatingAuthenticator::ResultCallback& result_callback) {
+ DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
+
// First ensure the JID we received is valid.
std::string client_username;
if (!SplitJidResource(remote_jid, &client_username, /*resource=*/nullptr)) {
@@ -490,6 +492,7 @@ void It2MeHost::ValidateConnectionDetails(
<< ": Invalid JID.";
result_callback.Run(
protocol::ValidatingAuthenticator::Result::ERROR_INVALID_ACCOUNT);
+ DisconnectOnNetworkThread();
return;
}
@@ -497,6 +500,7 @@ void It2MeHost::ValidateConnectionDetails(
LOG(ERROR) << "Invalid user name passed in: " << remote_jid;
result_callback.Run(
protocol::ValidatingAuthenticator::Result::ERROR_INVALID_ACCOUNT);
+ DisconnectOnNetworkThread();
return;
}
@@ -508,6 +512,7 @@ void It2MeHost::ValidateConnectionDetails(
LOG(ERROR) << "Rejecting incoming connection from " << remote_jid
<< ": Domain mismatch.";
result_callback.Run(ValidationResult::ERROR_INVALID_ACCOUNT);
+ DisconnectOnNetworkThread();
return;
}
}
@@ -524,6 +529,8 @@ void It2MeHost::ValidateConnectionDetails(
void It2MeHost::OnConfirmationResult(
const protocol::ValidatingAuthenticator::ResultCallback& result_callback,
It2MeConfirmationDialog::Result result) {
+ DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
+
switch (result) {
case It2MeConfirmationDialog::Result::OK:
result_callback.Run(ValidationResult::SUCCESS);
@@ -531,6 +538,7 @@ void It2MeHost::OnConfirmationResult(
case It2MeConfirmationDialog::Result::CANCEL:
result_callback.Run(ValidationResult::ERROR_REJECTED_BY_USER);
+ DisconnectOnNetworkThread();
break;
}
}
« 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