OLD | NEW |
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 "chromeos/network/onc/onc_normalizer.h" | 5 #include "chromeos/network/onc/onc_normalizer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 std::string outer; | 112 std::string outer; |
113 eap->GetStringWithoutPathExpansion(kOuter, &outer); | 113 eap->GetStringWithoutPathExpansion(kOuter, &outer); |
114 RemoveEntryUnless(eap, kAnonymousIdentity, | 114 RemoveEntryUnless(eap, kAnonymousIdentity, |
115 outer == kPEAP || outer == kEAP_TTLS); | 115 outer == kPEAP || outer == kEAP_TTLS); |
116 RemoveEntryUnless(eap, kInner, | 116 RemoveEntryUnless(eap, kInner, |
117 outer == kPEAP || outer == kEAP_TTLS || outer == kEAP_FAST); | 117 outer == kPEAP || outer == kEAP_TTLS || outer == kEAP_FAST); |
118 } | 118 } |
119 | 119 |
120 void Normalizer::NormalizeIPsec(base::DictionaryValue* ipsec) { | 120 void Normalizer::NormalizeIPsec(base::DictionaryValue* ipsec) { |
121 using namespace vpn; | 121 using namespace ipsec; |
122 | 122 |
123 std::string auth_type; | 123 std::string auth_type; |
124 ipsec->GetStringWithoutPathExpansion(kAuthenticationType, &auth_type); | 124 ipsec->GetStringWithoutPathExpansion(kAuthenticationType, &auth_type); |
125 RemoveEntryUnless(ipsec, kClientCertType, auth_type == kCert); | 125 RemoveEntryUnless(ipsec, vpn::kClientCertType, auth_type == kCert); |
126 RemoveEntryUnless(ipsec, kServerCARef, auth_type == kCert); | 126 RemoveEntryUnless(ipsec, kServerCARef, auth_type == kCert); |
127 RemoveEntryUnless(ipsec, kPSK, auth_type == kPSK); | 127 RemoveEntryUnless(ipsec, kPSK, auth_type == kPSK); |
128 RemoveEntryUnless(ipsec, kSaveCredentials, auth_type == kPSK); | 128 RemoveEntryUnless(ipsec, vpn::kSaveCredentials, auth_type == kPSK); |
129 | 129 |
130 std::string clientcert_type; | 130 std::string clientcert_type; |
131 ipsec->GetStringWithoutPathExpansion(kClientCertType, &clientcert_type); | 131 ipsec->GetStringWithoutPathExpansion(vpn::kClientCertType, &clientcert_type); |
132 RemoveEntryUnless(ipsec, kClientCertPattern, | 132 RemoveEntryUnless(ipsec, vpn::kClientCertPattern, |
133 clientcert_type == certificate::kPattern); | 133 clientcert_type == certificate::kPattern); |
134 RemoveEntryUnless(ipsec, kClientCertRef, | 134 RemoveEntryUnless(ipsec, vpn::kClientCertRef, |
135 clientcert_type == certificate::kRef); | 135 clientcert_type == certificate::kRef); |
136 | 136 |
137 int ike_version = -1; | 137 int ike_version = -1; |
138 ipsec->GetIntegerWithoutPathExpansion(kIKEVersion, &ike_version); | 138 ipsec->GetIntegerWithoutPathExpansion(kIKEVersion, &ike_version); |
139 RemoveEntryUnless(ipsec, kEAP, ike_version == 2); | 139 RemoveEntryUnless(ipsec, kEAP, ike_version == 2); |
140 RemoveEntryUnless(ipsec, kGroup, ike_version == 1); | 140 RemoveEntryUnless(ipsec, kGroup, ike_version == 1); |
141 RemoveEntryUnless(ipsec, kXAUTH, ike_version == 1); | 141 RemoveEntryUnless(ipsec, kXAUTH, ike_version == 1); |
142 } | 142 } |
143 | 143 |
144 void Normalizer::NormalizeNetworkConfiguration(base::DictionaryValue* network) { | 144 void Normalizer::NormalizeNetworkConfiguration(base::DictionaryValue* network) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 std::string security; | 200 std::string security; |
201 wifi->GetStringWithoutPathExpansion(wifi::kSecurity, &security); | 201 wifi->GetStringWithoutPathExpansion(wifi::kSecurity, &security); |
202 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP); | 202 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP); |
203 RemoveEntryUnless(wifi, kPassphrase, | 203 RemoveEntryUnless(wifi, kPassphrase, |
204 security == kWEP_PSK || security == kWPA_PSK); | 204 security == kWEP_PSK || security == kWPA_PSK); |
205 } | 205 } |
206 | 206 |
207 } // namespace onc | 207 } // namespace onc |
208 } // namespace chromeos | 208 } // namespace chromeos |
OLD | NEW |