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

Side by Side Diff: chromeos/network/onc/onc_normalizer.cc

Issue 368233004: ONC: Cleanup client certificate related fields. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation on Win/Mac. Created 6 years, 5 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
« no previous file with comments | « chromeos/network/network_ui_data.cc ('k') | chromeos/network/onc/onc_signature.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 std::string auth; 98 std::string auth;
99 ethernet->GetStringWithoutPathExpansion(kAuthentication, &auth); 99 ethernet->GetStringWithoutPathExpansion(kAuthentication, &auth);
100 RemoveEntryUnless(ethernet, kEAP, auth == k8021X); 100 RemoveEntryUnless(ethernet, kEAP, auth == k8021X);
101 } 101 }
102 102
103 void Normalizer::NormalizeEAP(base::DictionaryValue* eap) { 103 void Normalizer::NormalizeEAP(base::DictionaryValue* eap) {
104 using namespace ::onc::eap; 104 using namespace ::onc::eap;
105 105
106 std::string clientcert_type; 106 std::string clientcert_type;
107 eap->GetStringWithoutPathExpansion(kClientCertType, &clientcert_type); 107 eap->GetStringWithoutPathExpansion(::onc::client_cert::kClientCertType,
108 RemoveEntryUnless( 108 &clientcert_type);
109 eap, kClientCertPattern, clientcert_type == ::onc::certificate::kPattern); 109 RemoveEntryUnless(eap,
110 RemoveEntryUnless( 110 ::onc::client_cert::kClientCertPattern,
111 eap, kClientCertRef, clientcert_type == ::onc::certificate::kRef); 111 clientcert_type == ::onc::client_cert::kPattern);
112 RemoveEntryUnless(eap,
113 ::onc::client_cert::kClientCertRef,
114 clientcert_type == ::onc::client_cert::kRef);
112 115
113 std::string outer; 116 std::string outer;
114 eap->GetStringWithoutPathExpansion(kOuter, &outer); 117 eap->GetStringWithoutPathExpansion(kOuter, &outer);
115 RemoveEntryUnless(eap, kAnonymousIdentity, 118 RemoveEntryUnless(eap, kAnonymousIdentity,
116 outer == kPEAP || outer == kEAP_TTLS); 119 outer == kPEAP || outer == kEAP_TTLS);
117 RemoveEntryUnless(eap, kInner, 120 RemoveEntryUnless(eap, kInner,
118 outer == kPEAP || outer == kEAP_TTLS || outer == kEAP_FAST); 121 outer == kPEAP || outer == kEAP_TTLS || outer == kEAP_FAST);
119 } 122 }
120 123
121 void Normalizer::NormalizeIPsec(base::DictionaryValue* ipsec) { 124 void Normalizer::NormalizeIPsec(base::DictionaryValue* ipsec) {
122 using namespace ::onc::ipsec; 125 using namespace ::onc::ipsec;
123 126
124 std::string auth_type; 127 std::string auth_type;
125 ipsec->GetStringWithoutPathExpansion(kAuthenticationType, &auth_type); 128 ipsec->GetStringWithoutPathExpansion(kAuthenticationType, &auth_type);
126 RemoveEntryUnless(ipsec, ::onc::vpn::kClientCertType, auth_type == kCert); 129 RemoveEntryUnless(
130 ipsec, ::onc::client_cert::kClientCertType, auth_type == kCert);
127 RemoveEntryUnless(ipsec, kServerCARef, auth_type == kCert); 131 RemoveEntryUnless(ipsec, kServerCARef, auth_type == kCert);
128 RemoveEntryUnless(ipsec, kPSK, auth_type == kPSK); 132 RemoveEntryUnless(ipsec, kPSK, auth_type == kPSK);
129 RemoveEntryUnless(ipsec, ::onc::vpn::kSaveCredentials, auth_type == kPSK); 133 RemoveEntryUnless(ipsec, ::onc::vpn::kSaveCredentials, auth_type == kPSK);
130 134
131 std::string clientcert_type; 135 std::string clientcert_type;
132 ipsec->GetStringWithoutPathExpansion(::onc::vpn::kClientCertType, 136 ipsec->GetStringWithoutPathExpansion(::onc::client_cert::kClientCertType,
133 &clientcert_type); 137 &clientcert_type);
134 RemoveEntryUnless(ipsec, 138 RemoveEntryUnless(ipsec,
135 ::onc::vpn::kClientCertPattern, 139 ::onc::client_cert::kClientCertPattern,
136 clientcert_type == ::onc::certificate::kPattern); 140 clientcert_type == ::onc::client_cert::kPattern);
137 RemoveEntryUnless(ipsec, 141 RemoveEntryUnless(ipsec,
138 ::onc::vpn::kClientCertRef, 142 ::onc::client_cert::kClientCertRef,
139 clientcert_type == ::onc::certificate::kRef); 143 clientcert_type == ::onc::client_cert::kRef);
140 144
141 int ike_version = -1; 145 int ike_version = -1;
142 ipsec->GetIntegerWithoutPathExpansion(kIKEVersion, &ike_version); 146 ipsec->GetIntegerWithoutPathExpansion(kIKEVersion, &ike_version);
143 RemoveEntryUnless(ipsec, kEAP, ike_version == 2); 147 RemoveEntryUnless(ipsec, kEAP, ike_version == 2);
144 RemoveEntryUnless(ipsec, kGroup, ike_version == 1); 148 RemoveEntryUnless(ipsec, kGroup, ike_version == 1);
145 RemoveEntryUnless(ipsec, kXAUTH, ike_version == 1); 149 RemoveEntryUnless(ipsec, kXAUTH, ike_version == 1);
146 } 150 }
147 151
148 void Normalizer::NormalizeNetworkConfiguration(base::DictionaryValue* network) { 152 void Normalizer::NormalizeNetworkConfiguration(base::DictionaryValue* network) {
149 bool remove = false; 153 bool remove = false;
(...skipping 21 matching lines...) Expand all
171 network, ::onc::network_config::kVPN, type == ::onc::network_type::kVPN); 175 network, ::onc::network_config::kVPN, type == ::onc::network_type::kVPN);
172 RemoveEntryUnless(network, 176 RemoveEntryUnless(network,
173 ::onc::network_config::kWiFi, 177 ::onc::network_config::kWiFi,
174 type == ::onc::network_type::kWiFi); 178 type == ::onc::network_type::kWiFi);
175 } 179 }
176 180
177 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) { 181 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) {
178 using namespace ::onc::vpn; 182 using namespace ::onc::vpn;
179 183
180 std::string clientcert_type; 184 std::string clientcert_type;
181 openvpn->GetStringWithoutPathExpansion(kClientCertType, &clientcert_type); 185 openvpn->GetStringWithoutPathExpansion(::onc::client_cert::kClientCertType,
186 &clientcert_type);
182 RemoveEntryUnless(openvpn, 187 RemoveEntryUnless(openvpn,
183 kClientCertPattern, 188 ::onc::client_cert::kClientCertPattern,
184 clientcert_type == ::onc::certificate::kPattern); 189 clientcert_type == ::onc::client_cert::kPattern);
185 RemoveEntryUnless( 190 RemoveEntryUnless(openvpn,
186 openvpn, kClientCertRef, clientcert_type == ::onc::certificate::kRef); 191 ::onc::client_cert::kClientCertRef,
192 clientcert_type == ::onc::client_cert::kRef);
187 } 193 }
188 194
189 void Normalizer::NormalizeProxySettings(base::DictionaryValue* proxy) { 195 void Normalizer::NormalizeProxySettings(base::DictionaryValue* proxy) {
190 using namespace ::onc::proxy; 196 using namespace ::onc::proxy;
191 197
192 std::string type; 198 std::string type;
193 proxy->GetStringWithoutPathExpansion(::onc::proxy::kType, &type); 199 proxy->GetStringWithoutPathExpansion(::onc::proxy::kType, &type);
194 RemoveEntryUnless(proxy, kManual, type == kManual); 200 RemoveEntryUnless(proxy, kManual, type == kManual);
195 RemoveEntryUnless(proxy, kExcludeDomains, type == kManual); 201 RemoveEntryUnless(proxy, kExcludeDomains, type == kManual);
196 RemoveEntryUnless(proxy, kPAC, type == kPAC); 202 RemoveEntryUnless(proxy, kPAC, type == kPAC);
(...skipping 14 matching lines...) Expand all
211 217
212 std::string security; 218 std::string security;
213 wifi->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security); 219 wifi->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security);
214 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP); 220 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP);
215 RemoveEntryUnless(wifi, kPassphrase, 221 RemoveEntryUnless(wifi, kPassphrase,
216 security == kWEP_PSK || security == kWPA_PSK); 222 security == kWEP_PSK || security == kWPA_PSK);
217 } 223 }
218 224
219 } // namespace onc 225 } // namespace onc
220 } // namespace chromeos 226 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_ui_data.cc ('k') | chromeos/network/onc/onc_signature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698