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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/plugin/host_script_object.cc
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 1f83dcde3c6b5cac3e911324757c444b62f31c6a..917a252a5bbf0f8515a9166f7dd9964de07db763 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -74,6 +74,9 @@ const char* kAttrNameError = "ERROR";
const int kMaxLoginAttempts = 5;
+const int kMinPortNumber = 12400;
Sergey Ulanov 2012/08/22 23:50:34 Maybe put these values somewhere where they can be
Wez 2012/08/23 23:26:26 Done.
+const int kMaxPortNumber = 12409;
+
// We may need to have more than one task running at the same time
// (e.g. key generation and status update), yet unlikely to ever need
// more than 2 threads.
@@ -576,15 +579,22 @@ void HostNPScriptObject::FinishConnectNetworkThread(
signal_strategy_.reset(signal_strategy.release());
register_request_.reset(register_request.release());
- // Create the Host.
+ // If NAT traversal is off then limit port range to allow firewall pin-holing.
LOG(INFO) << "NAT state: " << nat_traversal_enabled_;
+ NetworkSettings network_settings(
+ nat_traversal_enabled_ ?
+ NetworkSettings::NAT_TRAVERSAL_ENABLED :
+ NetworkSettings::NAT_TRAVERSAL_DISABLED);
+ if (!nat_traversal_enabled_) {
+ network_settings.min_port = kMinPortNumber;
+ network_settings.max_port = kMaxPortNumber;
+ }
+
+ // Create the Host.
host_ = new ChromotingHost(
host_context_.get(), signal_strategy_.get(), desktop_environment_.get(),
- CreateHostSessionManager(
- NetworkSettings(nat_traversal_enabled_ ?
- NetworkSettings::NAT_TRAVERSAL_ENABLED :
- NetworkSettings::NAT_TRAVERSAL_DISABLED),
- host_context_->url_request_context_getter()));
+ CreateHostSessionManager(network_settings,
+ host_context_->url_request_context_getter()));
host_->AddStatusObserver(this);
log_to_server_.reset(
new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get()));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698