Commit 44e19583 authored by fqj's avatar fqj Committed by Commit bot

only forbid unmanaged WiFi on AllowOnlyPolicyNetworksToConnect

BUG=208378

Review URL: https://codereview.chromium.org/1465133002

Cr-Commit-Position: refs/heads/master@{#361144}
parent 3b976a68
...@@ -287,7 +287,8 @@ void NetworkConnectionHandler::ConnectToNetwork( ...@@ -287,7 +287,8 @@ void NetworkConnectionHandler::ConnectToNetwork(
// Connect immediately to 'connectable' networks. // Connect immediately to 'connectable' networks.
// TODO(stevenjb): Shill needs to properly set Connectable for VPN. // TODO(stevenjb): Shill needs to properly set Connectable for VPN.
if (network && network->connectable() && network->type() != shill::kTypeVPN) { if (network && network->connectable() && network->type() != shill::kTypeVPN) {
if (IsNetworkProhibitedByPolicy(network->guid(), network->profile_path())) { if (IsNetworkProhibitedByPolicy(network->type(), network->guid(),
network->profile_path())) {
ErrorCallbackForPendingRequest(service_path, kErrorUnmanagedNetwork); ErrorCallbackForPendingRequest(service_path, kErrorUnmanagedNetwork);
return; return;
} }
...@@ -423,7 +424,7 @@ void NetworkConnectionHandler::VerifyConfiguredAndConnect( ...@@ -423,7 +424,7 @@ void NetworkConnectionHandler::VerifyConfiguredAndConnect(
const base::DictionaryValue* user_policy = const base::DictionaryValue* user_policy =
managed_configuration_handler_->FindPolicyByGuidAndProfile(guid, profile); managed_configuration_handler_->FindPolicyByGuidAndProfile(guid, profile);
if (IsNetworkProhibitedByPolicy(guid, profile)) { if (IsNetworkProhibitedByPolicy(type, guid, profile)) {
ErrorCallbackForPendingRequest(service_path, kErrorUnmanagedNetwork); ErrorCallbackForPendingRequest(service_path, kErrorUnmanagedNetwork);
return; return;
} }
...@@ -536,10 +537,13 @@ void NetworkConnectionHandler::VerifyConfiguredAndConnect( ...@@ -536,10 +537,13 @@ void NetworkConnectionHandler::VerifyConfiguredAndConnect(
} }
bool NetworkConnectionHandler::IsNetworkProhibitedByPolicy( bool NetworkConnectionHandler::IsNetworkProhibitedByPolicy(
const std::string& type,
const std::string& guid, const std::string& guid,
const std::string& profile_path) { const std::string& profile_path) {
if (!logged_in_) if (!logged_in_)
return false; return false;
if (type != shill::kTypeWifi)
return false;
const base::DictionaryValue* global_network_config = const base::DictionaryValue* global_network_config =
managed_configuration_handler_->GetGlobalConfigFromPolicy( managed_configuration_handler_->GetGlobalConfigFromPolicy(
std::string() /* no username hash, device policy */); std::string() /* no username hash, device policy */);
......
...@@ -170,7 +170,8 @@ class CHROMEOS_EXPORT NetworkConnectionHandler ...@@ -170,7 +170,8 @@ class CHROMEOS_EXPORT NetworkConnectionHandler
const std::string& service_path, const std::string& service_path,
const base::DictionaryValue& properties); const base::DictionaryValue& properties);
bool IsNetworkProhibitedByPolicy(const std::string& guid, bool IsNetworkProhibitedByPolicy(const std::string& type,
const std::string& guid,
const std::string& profile_path); const std::string& profile_path);
// Queues a connect request until certificates have loaded. // Queues a connect request until certificates have loaded.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment