summaryrefslogtreecommitdiffstats
path: root/chromeos/network
diff options
context:
space:
mode:
authorpstew <pstew@chromium.org>2015-11-04 11:21:48 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-04 19:23:18 +0000
commit418647a8740a5ea7314d224721728abbadf2f236 (patch)
treeaf8edf7609a68b0b2e5a942e4263977181e7f435 /chromeos/network
parent23f406f957bfc311337e2d9ee83ea1b44ff8e82e (diff)
downloadchromium_src-418647a8740a5ea7314d224721728abbadf2f236.zip
chromium_src-418647a8740a5ea7314d224721728abbadf2f236.tar.gz
chromium_src-418647a8740a5ea7314d224721728abbadf2f236.tar.bz2
Translate 802.1x WEP ("Enterprise WEP")
This CL adds translation of "Enterprise WEP": 802.1x authentication with WEP encryption. BUG=551085 TEST=New unit tests R=stevenjb@chromium.org Review URL: https://codereview.chromium.org/1412283006 Cr-Commit-Position: refs/heads/master@{#357867}
Diffstat (limited to 'chromeos/network')
-rw-r--r--chromeos/network/onc/onc_translation_tables.cc1
-rw-r--r--chromeos/network/onc/onc_translator_onc_to_shill.cc7
-rw-r--r--chromeos/network/onc/onc_translator_shill_to_onc.cc20
-rw-r--r--chromeos/network/onc/onc_translator_unittest.cc4
4 files changed, 30 insertions, 2 deletions
diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc
index a71f441..27feecb 100644
--- a/chromeos/network/onc/onc_translation_tables.cc
+++ b/chromeos/network/onc/onc_translation_tables.cc
@@ -296,6 +296,7 @@ const StringTranslationEntry kWiFiSecurityTable[] = {
{::onc::wifi::kWEP_PSK, shill::kSecurityWep},
{::onc::wifi::kWPA_PSK, shill::kSecurityPsk},
{::onc::wifi::kWPA_EAP, shill::kSecurity8021x},
+ {::onc::wifi::kWEP_8021X, shill::kSecurityWep},
{NULL}};
const StringTranslationEntry kEAPOuterTable[] = {
diff --git a/chromeos/network/onc/onc_translator_onc_to_shill.cc b/chromeos/network/onc/onc_translator_onc_to_shill.cc
index f399d8b..0e84300 100644
--- a/chromeos/network/onc/onc_translator_onc_to_shill.cc
+++ b/chromeos/network/onc/onc_translator_onc_to_shill.cc
@@ -29,6 +29,9 @@ namespace onc {
namespace {
+// TODO(pstew): Remove once crosreview.com/310644 lands and merges to Chrome.
+const char kKeyManagementIEEE8021X[] = "IEEE8021X";
+
scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) {
std::string str;
if (!value.GetAsString(&str))
@@ -220,6 +223,10 @@ void LocalTranslator::TranslateWiFi() {
&security)) {
TranslateWithTableAndSet(security, kWiFiSecurityTable,
shill::kSecurityClassProperty);
+ if (security == ::onc::wifi::kWEP_8021X) {
+ shill_dictionary_->SetStringWithoutPathExpansion(
+ shill::kEapKeyMgmtProperty, kKeyManagementIEEE8021X);
+ }
}
// We currently only support managed and no adhoc networks.
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
index f91950f..e76f5e6 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -27,6 +27,9 @@ namespace onc {
namespace {
+// TODO(pstew): Remove once crosreview.com/310644 lands and merges to Chrome.
+const char kKeyManagementIEEE8021X[] = "IEEE8021X";
+
// Converts |str| to a base::Value of the given |type|. If the conversion fails,
// returns NULL.
scoped_ptr<base::Value> ConvertStringToValue(const std::string& str,
@@ -329,8 +332,21 @@ void ShillToONCTranslator::TranslateVPN() {
}
void ShillToONCTranslator::TranslateWiFiWithState() {
- TranslateWithTableAndSet(shill::kSecurityClassProperty, kWiFiSecurityTable,
- ::onc::wifi::kSecurity);
+ std::string shill_security;
+ std::string shill_key_mgmt;
+ if (shill_dictionary_->GetStringWithoutPathExpansion(
+ shill::kSecurityClassProperty, &shill_security) &&
+ shill_security == shill::kSecurityWep &&
+ shill_dictionary_->GetStringWithoutPathExpansion(
+ shill::kEapKeyMgmtProperty, &shill_key_mgmt) &&
+ shill_key_mgmt == kKeyManagementIEEE8021X) {
+ onc_object_->SetStringWithoutPathExpansion(::onc::wifi::kSecurity,
+ ::onc::wifi::kWEP_8021X);
+ } else {
+ TranslateWithTableAndSet(shill::kSecurityClassProperty, kWiFiSecurityTable,
+ ::onc::wifi::kSecurity);
+ }
+
bool unknown_encoding = true;
std::string ssid = shill_property_util::GetSSIDFromProperties(
*shill_dictionary_, false /* verbose_logging */, &unknown_encoding);
diff --git a/chromeos/network/onc/onc_translator_unittest.cc b/chromeos/network/onc/onc_translator_unittest.cc
index 72ceae1..7de265a 100644
--- a/chromeos/network/onc/onc_translator_unittest.cc
+++ b/chromeos/network/onc/onc_translator_unittest.cc
@@ -51,6 +51,8 @@ INSTANTIATE_TEST_CASE_P(
std::make_pair("valid_wifi_psk.onc", "shill_wifi_psk.json"),
std::make_pair("wifi_clientcert_with_cert_pems.onc",
"shill_wifi_clientcert.json"),
+ std::make_pair("wifi_wep_8021x_clientcert_with_cert_pems.onc",
+ "shill_wifi_wep_8021x_clientcert.json"),
std::make_pair("valid_wifi_clientref.onc", "shill_wifi_clientref.json"),
std::make_pair("valid_l2tpipsec.onc", "shill_l2tpipsec.json"),
std::make_pair("wifi_dhcp.onc", "shill_wifi_dhcp.json"),
@@ -106,6 +108,8 @@ INSTANTIATE_TEST_CASE_P(
"translation_of_shill_wifi_clientcert.onc"),
std::make_pair("shill_wifi_non_utf8_ssid.json",
"translation_of_shill_wifi_non_utf8_ssid.onc"),
+ std::make_pair("shill_wifi_wep_8021x_clientcert.json",
+ "translation_of_shill_wifi_wep_8021x_clientcert.onc"),
std::make_pair("shill_output_l2tpipsec.json",
"translation_of_shill_l2tpipsec.onc"),
std::make_pair("shill_output_openvpn.json",