Skip to content

Commit

Permalink
Disconnect all clients if IT2Me Host receives a second successful cli…
Browse files Browse the repository at this point in the history
…ent.

BUG=93997

Review URL: http://codereview.chromium.org/7846009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100246 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
wez@chromium.org committed Sep 8, 2011
1 parent af397fe commit e1c74da
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions remoting/host/chromoting_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,11 @@ void ChromotingHost::Shutdown(Task* shutdown_task) {
state_ = kStopping;
}

// Make sure ScreenRecorder doesn't write to the connection.
if (recorder_.get()) {
recorder_->RemoveAllConnections();
// Disconnect all of the clients, implicitly stopping the ScreenRecorder.
while (!clients_.empty()) {
OnClientDisconnected(clients_.front()->connection());
}

// Stop all desktop interaction.
desktop_environment_->OnLastDisconnect();

// Disconnect the clients.
for (size_t i = 0; i < clients_.size(); i++) {
clients_[i]->Disconnect();
}
clients_.clear();

ShutdownNetwork();
}

Expand Down Expand Up @@ -233,10 +224,6 @@ void ChromotingHost::OnStateChange(
it != status_observers_.end(); ++it) {
(*it)->OnSignallingDisconnected();
}
// TODO(sergeyu): Don't shutdown the host and let the upper level
// decide what needs to be done when signalling channel is
// disconnected.
Shutdown(NULL);
}
}

Expand All @@ -262,13 +249,6 @@ void ChromotingHost::OnIncomingSession(
return;
}

// If we are running Me2Mom and already have an authenticated client then
// reject the connection immediately.
if (is_it2me_ && AuthenticatedClientsCount() > 0) {
*response = protocol::SessionManager::DECLINE;
return;
}

// Check that the client has access to the host.
if (!access_verifier_->VerifyPermissions(session->jid(),
session->initiator_token())) {
Expand All @@ -282,6 +262,16 @@ void ChromotingHost::OnIncomingSession(
return;
}

// If we are running Me2Mom and already have an authenticated client then
// one of the connections may be an attacker, so both are suspect.
if (is_it2me_ && AuthenticatedClientsCount() > 0) {
*response = protocol::SessionManager::DECLINE;

// Close existing sessions and shutdown the host.
Shutdown(NULL);
return;
}

// TODO(simonmorris): The resolution is set in the video stream now,
// so it doesn't need to be set here.
*protocol_config_->mutable_initial_resolution() =
Expand Down

0 comments on commit e1c74da

Please sign in to comment.