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

Side by Side Diff: remoting/host/plugin/host_script_object.cc

Issue 10868031: Limit the ports used by IT2Me when NAT traversal is disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move default min & max port definitions to NetworkSettings. Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/plugin/host_script_object.h" 5 #include "remoting/host/plugin/host_script_object.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 scoped_ptr<RegisterSupportHostRequest> register_request( 569 scoped_ptr<RegisterSupportHostRequest> register_request(
570 new RegisterSupportHostRequest( 570 new RegisterSupportHostRequest(
571 signal_strategy.get(), &host_key_pair_, 571 signal_strategy.get(), &host_key_pair_,
572 base::Bind(&HostNPScriptObject::OnReceivedSupportID, 572 base::Bind(&HostNPScriptObject::OnReceivedSupportID,
573 base::Unretained(this)))); 573 base::Unretained(this))));
574 574
575 // Beyond this point nothing can fail, so save the config and request. 575 // Beyond this point nothing can fail, so save the config and request.
576 signal_strategy_.reset(signal_strategy.release()); 576 signal_strategy_.reset(signal_strategy.release());
577 register_request_.reset(register_request.release()); 577 register_request_.reset(register_request.release());
578 578
579 // If NAT traversal is off then limit port range to allow firewall pin-holing.
580 LOG(INFO) << "NAT state: " << nat_traversal_enabled_;
581 NetworkSettings network_settings(
582 nat_traversal_enabled_ ?
583 NetworkSettings::NAT_TRAVERSAL_ENABLED :
584 NetworkSettings::NAT_TRAVERSAL_DISABLED);
585 if (!nat_traversal_enabled_) {
586 network_settings.min_port = NetworkSettings::kDefaultMinPort;
587 network_settings.max_port = NetworkSettings::kDefaultMaxPort;
588 }
589
579 // Create the Host. 590 // Create the Host.
580 LOG(INFO) << "NAT state: " << nat_traversal_enabled_;
581 host_ = new ChromotingHost( 591 host_ = new ChromotingHost(
582 host_context_.get(), signal_strategy_.get(), desktop_environment_.get(), 592 host_context_.get(), signal_strategy_.get(), desktop_environment_.get(),
583 CreateHostSessionManager( 593 CreateHostSessionManager(network_settings,
584 NetworkSettings(nat_traversal_enabled_ ? 594 host_context_->url_request_context_getter()));
585 NetworkSettings::NAT_TRAVERSAL_ENABLED :
586 NetworkSettings::NAT_TRAVERSAL_DISABLED),
587 host_context_->url_request_context_getter()));
588 host_->AddStatusObserver(this); 595 host_->AddStatusObserver(this);
589 log_to_server_.reset( 596 log_to_server_.reset(
590 new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get())); 597 new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get()));
591 base::Closure disconnect_callback = base::Bind( 598 base::Closure disconnect_callback = base::Bind(
592 &ChromotingHost::Shutdown, base::Unretained(host_.get()), 599 &ChromotingHost::Shutdown, base::Unretained(host_.get()),
593 base::Closure()); 600 base::Closure());
594 it2me_host_user_interface_->Start(host_.get(), disconnect_callback); 601 it2me_host_user_interface_->Start(host_.get(), disconnect_callback);
595 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); 602 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName);
596 603
597 { 604 {
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 return is_good; 1298 return is_good;
1292 } 1299 }
1293 1300
1294 void HostNPScriptObject::SetException(const std::string& exception_string) { 1301 void HostNPScriptObject::SetException(const std::string& exception_string) {
1295 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); 1302 DCHECK(plugin_task_runner_->BelongsToCurrentThread());
1296 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); 1303 g_npnetscape_funcs->setexception(parent_, exception_string.c_str());
1297 LOG(INFO) << exception_string; 1304 LOG(INFO) << exception_string;
1298 } 1305 }
1299 1306
1300 } // namespace remoting 1307 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698