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
3 // found in the LICENSE file.
5 #include "chromeos/network/onc/onc_signature.h"
7 #include "components/onc/onc_constants.h"
8 #include "third_party/cros_system_api/dbus/service_constants.h"
16 const OncValueSignature kBoolSignature
= {
17 base::Value::TYPE_BOOLEAN
, NULL
19 const OncValueSignature kStringSignature
= {
20 base::Value::TYPE_STRING
, NULL
22 const OncValueSignature kIntegerSignature
= {
23 base::Value::TYPE_INTEGER
, NULL
25 const OncValueSignature kDoubleSignature
= {
26 base::Value::TYPE_DOUBLE
, NULL
28 const OncValueSignature kStringListSignature
= {
29 base::Value::TYPE_LIST
, NULL
, &kStringSignature
31 const OncValueSignature kIntegerListSignature
= {
32 base::Value::TYPE_LIST
, NULL
, &kIntegerSignature
34 const OncValueSignature kIPConfigListSignature
= {
35 base::Value::TYPE_LIST
, NULL
, &kIPConfigSignature
37 const OncValueSignature kCellularApnListSignature
= {
38 base::Value::TYPE_LIST
, NULL
, &kCellularApnSignature
40 const OncValueSignature kCellularFoundNetworkListSignature
= {
41 base::Value::TYPE_LIST
, NULL
, &kCellularFoundNetworkSignature
44 const OncFieldSignature issuer_subject_pattern_fields
[] = {
45 { ::onc::client_cert::kCommonName
, &kStringSignature
},
46 { ::onc::client_cert::kLocality
, &kStringSignature
},
47 { ::onc::client_cert::kOrganization
, &kStringSignature
},
48 { ::onc::client_cert::kOrganizationalUnit
, &kStringSignature
},
51 const OncFieldSignature certificate_pattern_fields
[] = {
52 { ::onc::kRecommended
, &kRecommendedSignature
},
53 { ::onc::client_cert::kEnrollmentURI
, &kStringListSignature
},
54 { ::onc::client_cert::kIssuer
, &kIssuerSubjectPatternSignature
},
55 { ::onc::client_cert::kIssuerCARef
, &kStringListSignature
},
56 // Used internally. Not officially supported.
57 { ::onc::client_cert::kIssuerCAPEMs
, &kStringListSignature
},
58 { ::onc::client_cert::kSubject
, &kIssuerSubjectPatternSignature
},
61 const OncFieldSignature eap_fields
[] = {
62 { ::onc::kRecommended
, &kRecommendedSignature
},
63 { ::onc::eap::kAnonymousIdentity
, &kStringSignature
},
64 { ::onc::client_cert::kClientCertPattern
, &kCertificatePatternSignature
},
65 { ::onc::client_cert::kClientCertRef
, &kStringSignature
},
66 { ::onc::client_cert::kClientCertType
, &kStringSignature
},
67 { ::onc::eap::kIdentity
, &kStringSignature
},
68 { ::onc::eap::kInner
, &kStringSignature
},
69 { ::onc::eap::kOuter
, &kStringSignature
},
70 { ::onc::eap::kPassword
, &kStringSignature
},
71 { ::onc::eap::kSaveCredentials
, &kBoolSignature
},
72 // Used internally. Not officially supported.
73 { ::onc::eap::kServerCAPEMs
, &kStringListSignature
},
74 { ::onc::eap::kServerCARef
, &kStringSignature
},
75 { ::onc::eap::kServerCARefs
, &kStringListSignature
},
76 { ::onc::eap::kUseSystemCAs
, &kBoolSignature
},
79 const OncFieldSignature ipsec_fields
[] = {
80 { ::onc::kRecommended
, &kRecommendedSignature
},
81 { ::onc::ipsec::kAuthenticationType
, &kStringSignature
},
82 { ::onc::client_cert::kClientCertPattern
, &kCertificatePatternSignature
},
83 { ::onc::client_cert::kClientCertRef
, &kStringSignature
},
84 { ::onc::client_cert::kClientCertType
, &kStringSignature
},
85 { ::onc::ipsec::kGroup
, &kStringSignature
},
86 { ::onc::ipsec::kIKEVersion
, &kIntegerSignature
},
87 { ::onc::ipsec::kPSK
, &kStringSignature
},
88 { ::onc::vpn::kSaveCredentials
, &kBoolSignature
},
89 // Used internally. Not officially supported.
90 { ::onc::ipsec::kServerCAPEMs
, &kStringListSignature
},
91 { ::onc::ipsec::kServerCARef
, &kStringSignature
},
92 { ::onc::ipsec::kServerCARefs
, &kStringListSignature
},
93 { ::onc::ipsec::kXAUTH
, &kXAUTHSignature
},
95 // { ipsec::kEAP, &kEAPSignature },
98 const OncFieldSignature xauth_fields
[] = {
99 { ::onc::vpn::kPassword
, &kStringSignature
},
100 { ::onc::vpn::kUsername
, &kStringSignature
},
103 const OncFieldSignature l2tp_fields
[] = {
104 { ::onc::kRecommended
, &kRecommendedSignature
},
105 { ::onc::vpn::kPassword
, &kStringSignature
},
106 { ::onc::vpn::kSaveCredentials
, &kBoolSignature
},
107 { ::onc::vpn::kUsername
, &kStringSignature
},
110 const OncFieldSignature openvpn_fields
[] = {
111 { ::onc::kRecommended
, &kRecommendedSignature
},
112 { ::onc::openvpn::kAuth
, &kStringSignature
},
113 { ::onc::openvpn::kAuthNoCache
, &kBoolSignature
},
114 { ::onc::openvpn::kAuthRetry
, &kStringSignature
},
115 { ::onc::openvpn::kCipher
, &kStringSignature
},
116 { ::onc::client_cert::kClientCertPattern
, &kCertificatePatternSignature
},
117 { ::onc::client_cert::kClientCertRef
, &kStringSignature
},
118 { ::onc::client_cert::kClientCertType
, &kStringSignature
},
119 { ::onc::openvpn::kCompLZO
, &kStringSignature
},
120 { ::onc::openvpn::kCompNoAdapt
, &kBoolSignature
},
121 { ::onc::openvpn::kIgnoreDefaultRoute
, &kBoolSignature
},
122 { ::onc::openvpn::kKeyDirection
, &kStringSignature
},
123 { ::onc::openvpn::kNsCertType
, &kStringSignature
},
124 { ::onc::vpn::kPassword
, &kStringSignature
},
125 { ::onc::openvpn::kPort
, &kIntegerSignature
},
126 { ::onc::openvpn::kProto
, &kStringSignature
},
127 { ::onc::openvpn::kPushPeerInfo
, &kBoolSignature
},
128 { ::onc::openvpn::kRemoteCertEKU
, &kStringSignature
},
129 { ::onc::openvpn::kRemoteCertKU
, &kStringListSignature
},
130 { ::onc::openvpn::kRemoteCertTLS
, &kStringSignature
},
131 { ::onc::openvpn::kRenegSec
, &kIntegerSignature
},
132 { ::onc::vpn::kSaveCredentials
, &kBoolSignature
},
133 // Used internally. Not officially supported.
134 { ::onc::openvpn::kServerCAPEMs
, &kStringListSignature
},
135 { ::onc::openvpn::kServerCARef
, &kStringSignature
},
136 { ::onc::openvpn::kServerCARefs
, &kStringListSignature
},
137 // Not supported, yet.
138 { ::onc::openvpn::kServerCertPEM
, &kStringSignature
},
139 { ::onc::openvpn::kServerCertRef
, &kStringSignature
},
140 { ::onc::openvpn::kServerPollTimeout
, &kIntegerSignature
},
141 { ::onc::openvpn::kShaper
, &kIntegerSignature
},
142 { ::onc::openvpn::kStaticChallenge
, &kStringSignature
},
143 { ::onc::openvpn::kTLSAuthContents
, &kStringSignature
},
144 { ::onc::openvpn::kTLSRemote
, &kStringSignature
},
145 { ::onc::vpn::kUsername
, &kStringSignature
},
146 // Not supported, yet.
147 { ::onc::openvpn::kVerb
, &kStringSignature
},
148 { ::onc::openvpn::kVerifyHash
, &kStringSignature
},
149 { ::onc::openvpn::kVerifyX509
, &kVerifyX509Signature
},
152 const OncFieldSignature verify_x509_fields
[] = {
153 { ::onc::verify_x509::kName
, &kStringSignature
},
154 { ::onc::verify_x509::kType
, &kStringSignature
},
157 const OncFieldSignature vpn_fields
[] = {
158 { ::onc::kRecommended
, &kRecommendedSignature
},
159 { ::onc::vpn::kAutoConnect
, &kBoolSignature
},
160 { ::onc::vpn::kHost
, &kStringSignature
},
161 { ::onc::vpn::kIPsec
, &kIPsecSignature
},
162 { ::onc::vpn::kL2TP
, &kL2TPSignature
},
163 { ::onc::vpn::kOpenVPN
, &kOpenVPNSignature
},
164 { ::onc::vpn::kType
, &kStringSignature
},
167 const OncFieldSignature ethernet_fields
[] = {
168 { ::onc::kRecommended
, &kRecommendedSignature
},
169 { ::onc::ethernet::kAuthentication
, &kStringSignature
},
170 { ::onc::ethernet::kEAP
, &kEAPSignature
},
173 const OncFieldSignature ipconfig_fields
[] = {
174 { ::onc::ipconfig::kGateway
, &kStringSignature
},
175 { ::onc::ipconfig::kIPAddress
, &kStringSignature
},
176 { ::onc::ipconfig::kNameServers
, &kStringListSignature
},
177 { ::onc::ipconfig::kRoutingPrefix
, &kIntegerSignature
},
178 { ::onc::network_config::kSearchDomains
, &kStringListSignature
},
179 { ::onc::ipconfig::kType
, &kStringSignature
},
180 { ::onc::ipconfig::kWebProxyAutoDiscoveryUrl
, &kStringSignature
},
183 const OncFieldSignature proxy_location_fields
[] = {
184 { ::onc::proxy::kHost
, &kStringSignature
},
185 { ::onc::proxy::kPort
, &kIntegerSignature
}, {NULL
}};
187 const OncFieldSignature proxy_manual_fields
[] = {
188 { ::onc::proxy::kFtp
, &kProxyLocationSignature
},
189 { ::onc::proxy::kHttp
, &kProxyLocationSignature
},
190 { ::onc::proxy::kHttps
, &kProxyLocationSignature
},
191 { ::onc::proxy::kSocks
, &kProxyLocationSignature
},
194 const OncFieldSignature proxy_settings_fields
[] = {
195 { ::onc::kRecommended
, &kRecommendedSignature
},
196 { ::onc::proxy::kExcludeDomains
, &kStringListSignature
},
197 { ::onc::proxy::kManual
, &kProxyManualSignature
},
198 { ::onc::proxy::kPAC
, &kStringSignature
},
199 { ::onc::proxy::kType
, &kStringSignature
},
202 const OncFieldSignature wifi_fields
[] = {
203 { ::onc::kRecommended
, &kRecommendedSignature
},
204 { ::onc::wifi::kAutoConnect
, &kBoolSignature
},
205 { ::onc::wifi::kEAP
, &kEAPSignature
},
206 { ::onc::wifi::kHiddenSSID
, &kBoolSignature
},
207 { ::onc::wifi::kPassphrase
, &kStringSignature
},
208 { ::onc::wifi::kSSID
, &kStringSignature
},
209 { ::onc::wifi::kSecurity
, &kStringSignature
},
212 const OncFieldSignature wifi_with_state_fields
[] = {
213 { ::onc::wifi::kBSSID
, &kStringSignature
},
214 { ::onc::wifi::kFrequency
, &kIntegerSignature
},
215 { ::onc::wifi::kFrequencyList
, &kIntegerListSignature
},
216 { ::onc::wifi::kSignalStrength
, &kIntegerSignature
},
219 const OncFieldSignature cellular_provider_fields
[] = {
220 { ::onc::cellular_provider::kCode
, &kStringSignature
},
221 { ::onc::cellular_provider::kCountry
, &kStringSignature
},
222 { ::onc::cellular_provider::kName
, &kStringSignature
},
225 const OncFieldSignature cellular_apn_fields
[] = {
226 { ::onc::cellular_apn::kAccessPointName
, &kStringSignature
},
227 { ::onc::cellular_apn::kName
, &kStringSignature
},
228 { ::onc::cellular_apn::kUsername
, &kStringSignature
},
229 { ::onc::cellular_apn::kPassword
, &kStringSignature
},
230 { ::onc::cellular_apn::kLocalizedName
, &kStringSignature
},
231 { ::onc::cellular_apn::kLanguage
, &kStringSignature
},
234 const OncFieldSignature cellular_found_network_fields
[] = {
235 { ::onc::cellular_found_network::kStatus
, &kStringSignature
},
236 { ::onc::cellular_found_network::kNetworkId
, &kStringSignature
},
237 { ::onc::cellular_found_network::kShortName
, &kStringSignature
},
238 { ::onc::cellular_found_network::kLongName
, &kStringSignature
},
239 { ::onc::cellular_found_network::kTechnology
, &kStringSignature
},
242 const OncFieldSignature sim_lock_status_fields
[] = {
243 { ::onc::sim_lock_status::kLockEnabled
, &kBoolSignature
},
244 { ::onc::sim_lock_status::kLockType
, &kStringSignature
},
245 { ::onc::sim_lock_status::kRetriesLeft
, &kDoubleSignature
},
248 const OncFieldSignature cellular_fields
[] = {
249 { ::onc::kRecommended
, &kRecommendedSignature
},
250 { ::onc::cellular::kAPN
, &kCellularApnSignature
},
251 { ::onc::cellular::kAPNList
, &kCellularApnListSignature
},
254 const OncFieldSignature cellular_with_state_fields
[] = {
255 { ::onc::cellular::kActivationType
, &kStringSignature
},
256 { ::onc::cellular::kActivationState
, &kStringSignature
},
257 { ::onc::cellular::kAllowRoaming
, &kBoolSignature
},
258 { ::onc::cellular::kCarrier
, &kStringSignature
},
259 { ::onc::cellular::kESN
, &kStringSignature
},
260 { ::onc::cellular::kFamily
, &kStringSignature
},
261 { ::onc::cellular::kFirmwareRevision
, &kStringSignature
},
262 { ::onc::cellular::kFoundNetworks
, &kCellularFoundNetworkListSignature
},
263 { ::onc::cellular::kHardwareRevision
, &kStringSignature
},
264 { ::onc::cellular::kHomeProvider
, &kCellularProviderSignature
},
265 { ::onc::cellular::kICCID
, &kStringSignature
},
266 { ::onc::cellular::kIMEI
, &kStringSignature
},
267 { ::onc::cellular::kIMSI
, &kStringSignature
},
268 { ::onc::cellular::kLastGoodAPN
, &kCellularApnSignature
},
269 { ::onc::cellular::kManufacturer
, &kStringSignature
},
270 { ::onc::cellular::kMDN
, &kStringSignature
},
271 { ::onc::cellular::kMEID
, &kStringSignature
},
272 { ::onc::cellular::kMIN
, &kStringSignature
},
273 { ::onc::cellular::kModelID
, &kStringSignature
},
274 { ::onc::cellular::kNetworkTechnology
, &kStringSignature
},
275 { ::onc::cellular::kPRLVersion
, &kIntegerSignature
},
276 { ::onc::cellular::kProviderRequiresRoaming
, &kBoolSignature
},
277 { ::onc::cellular::kRoamingState
, &kStringSignature
},
278 { ::onc::cellular::kSelectedNetwork
, &kStringSignature
},
279 { ::onc::cellular::kServingOperator
, &kCellularProviderSignature
},
280 { ::onc::cellular::kSIMLockStatus
, &kSIMLockStatusSignature
},
281 { ::onc::cellular::kSIMPresent
, &kBoolSignature
},
282 { ::onc::cellular::kSupportNetworkScan
, &kBoolSignature
},
283 { ::onc::cellular::kSupportedCarriers
, &kStringListSignature
},
286 const OncFieldSignature network_configuration_fields
[] = {
287 { ::onc::network_config::kCellular
, &kCellularSignature
},
288 { ::onc::network_config::kEthernet
, &kEthernetSignature
},
289 { ::onc::network_config::kGUID
, &kStringSignature
},
291 { ::onc::network_config::kName
, &kStringSignature
},
293 // Not supported, yet.
294 { ::onc::network_config::kNameServers
, &kStringListSignature
},
296 { ::onc::network_config::kPriority
, &kIntegerSignature
},
297 { ::onc::network_config::kProxySettings
, &kProxySettingsSignature
},
298 { ::onc::kRecommended
, &kRecommendedSignature
},
299 { ::onc::kRemove
, &kBoolSignature
},
301 // Not supported, yet.
302 { ::onc::network_config::kSearchDomains
, &kStringListSignature
},
304 { ::onc::network_config::kStaticIPConfig
, &kStaticIPConfigSignature
},
305 { ::onc::network_config::kType
, &kStringSignature
},
306 { ::onc::network_config::kVPN
, &kVPNSignature
},
307 { ::onc::network_config::kWiFi
, &kWiFiSignature
},
310 const OncFieldSignature network_with_state_fields
[] = {
311 { ::onc::network_config::kCellular
, &kCellularWithStateSignature
},
312 { ::onc::network_config::kConnectionState
, &kStringSignature
},
313 { ::onc::network_config::kConnectable
, &kBoolSignature
},
314 { ::onc::network_config::kErrorState
, &kStringSignature
},
315 { ::onc::network_config::kIPConfigs
, &kIPConfigListSignature
},
316 { ::onc::network_config::kMacAddress
, &kStringSignature
},
317 { ::onc::network_config::kRestrictedConnectivity
, &kBoolSignature
},
318 { ::onc::network_config::kSavedIPConfig
, &kSavedIPConfigSignature
},
319 { ::onc::network_config::kSource
, &kStringSignature
},
320 { ::onc::network_config::kWiFi
, &kWiFiWithStateSignature
},
323 const OncFieldSignature global_network_configuration_fields
[] = {
324 { ::onc::global_network_config::kAllowOnlyPolicyNetworksToAutoconnect
,
328 const OncFieldSignature certificate_fields
[] = {
329 { ::onc::certificate::kGUID
, &kStringSignature
},
330 { ::onc::certificate::kPKCS12
, &kStringSignature
},
331 { ::onc::kRemove
, &kBoolSignature
},
332 { ::onc::certificate::kTrustBits
, &kStringListSignature
},
333 { ::onc::certificate::kType
, &kStringSignature
},
334 { ::onc::certificate::kX509
, &kStringSignature
},
337 const OncFieldSignature toplevel_configuration_fields
[] = {
338 { ::onc::toplevel_config::kCertificates
, &kCertificateListSignature
},
339 { ::onc::toplevel_config::kNetworkConfigurations
,
340 &kNetworkConfigurationListSignature
},
341 { ::onc::toplevel_config::kGlobalNetworkConfiguration
,
342 &kGlobalNetworkConfigurationSignature
},
343 { ::onc::toplevel_config::kType
, &kStringSignature
},
344 { ::onc::encrypted::kCipher
, &kStringSignature
},
345 { ::onc::encrypted::kCiphertext
, &kStringSignature
},
346 { ::onc::encrypted::kHMAC
, &kStringSignature
},
347 { ::onc::encrypted::kHMACMethod
, &kStringSignature
},
348 { ::onc::encrypted::kIV
, &kStringSignature
},
349 { ::onc::encrypted::kIterations
, &kIntegerSignature
},
350 { ::onc::encrypted::kSalt
, &kStringSignature
},
351 { ::onc::encrypted::kStretch
, &kStringSignature
}, {NULL
}};
355 const OncValueSignature kRecommendedSignature
= {
356 base::Value::TYPE_LIST
, NULL
, &kStringSignature
358 const OncValueSignature kEAPSignature
= {
359 base::Value::TYPE_DICTIONARY
, eap_fields
, NULL
361 const OncValueSignature kIssuerSubjectPatternSignature
= {
362 base::Value::TYPE_DICTIONARY
, issuer_subject_pattern_fields
, NULL
364 const OncValueSignature kCertificatePatternSignature
= {
365 base::Value::TYPE_DICTIONARY
, certificate_pattern_fields
, NULL
367 const OncValueSignature kIPsecSignature
= {
368 base::Value::TYPE_DICTIONARY
, ipsec_fields
, NULL
370 const OncValueSignature kXAUTHSignature
= {
371 base::Value::TYPE_DICTIONARY
, xauth_fields
, NULL
373 const OncValueSignature kL2TPSignature
= {
374 base::Value::TYPE_DICTIONARY
, l2tp_fields
, NULL
376 const OncValueSignature kOpenVPNSignature
= {
377 base::Value::TYPE_DICTIONARY
, openvpn_fields
, NULL
379 const OncValueSignature kVerifyX509Signature
= {
380 base::Value::TYPE_DICTIONARY
, verify_x509_fields
, NULL
382 const OncValueSignature kVPNSignature
= {
383 base::Value::TYPE_DICTIONARY
, vpn_fields
, NULL
385 const OncValueSignature kEthernetSignature
= {
386 base::Value::TYPE_DICTIONARY
, ethernet_fields
, NULL
388 const OncValueSignature kIPConfigSignature
= {
389 base::Value::TYPE_DICTIONARY
, ipconfig_fields
, NULL
391 const OncValueSignature kSavedIPConfigSignature
= {
392 base::Value::TYPE_DICTIONARY
, ipconfig_fields
, NULL
394 const OncValueSignature kStaticIPConfigSignature
= {
395 base::Value::TYPE_DICTIONARY
, ipconfig_fields
, NULL
397 const OncValueSignature kProxyLocationSignature
= {
398 base::Value::TYPE_DICTIONARY
, proxy_location_fields
, NULL
400 const OncValueSignature kProxyManualSignature
= {
401 base::Value::TYPE_DICTIONARY
, proxy_manual_fields
, NULL
403 const OncValueSignature kProxySettingsSignature
= {
404 base::Value::TYPE_DICTIONARY
, proxy_settings_fields
, NULL
406 const OncValueSignature kWiFiSignature
= {
407 base::Value::TYPE_DICTIONARY
, wifi_fields
, NULL
409 const OncValueSignature kCertificateSignature
= {
410 base::Value::TYPE_DICTIONARY
, certificate_fields
, NULL
412 const OncValueSignature kNetworkConfigurationSignature
= {
413 base::Value::TYPE_DICTIONARY
, network_configuration_fields
, NULL
415 const OncValueSignature kGlobalNetworkConfigurationSignature
= {
416 base::Value::TYPE_DICTIONARY
, global_network_configuration_fields
, NULL
418 const OncValueSignature kCertificateListSignature
= {
419 base::Value::TYPE_LIST
, NULL
, &kCertificateSignature
421 const OncValueSignature kNetworkConfigurationListSignature
= {
422 base::Value::TYPE_LIST
, NULL
, &kNetworkConfigurationSignature
424 const OncValueSignature kToplevelConfigurationSignature
= {
425 base::Value::TYPE_DICTIONARY
, toplevel_configuration_fields
, NULL
428 // Derived "ONC with State" signatures.
429 const OncValueSignature kNetworkWithStateSignature
= {
430 base::Value::TYPE_DICTIONARY
, network_with_state_fields
, NULL
,
431 &kNetworkConfigurationSignature
433 const OncValueSignature kWiFiWithStateSignature
= {
434 base::Value::TYPE_DICTIONARY
, wifi_with_state_fields
, NULL
, &kWiFiSignature
436 const OncValueSignature kCellularSignature
= {
437 base::Value::TYPE_DICTIONARY
, cellular_fields
, NULL
439 const OncValueSignature kCellularWithStateSignature
= {
440 base::Value::TYPE_DICTIONARY
, cellular_with_state_fields
, NULL
,
443 const OncValueSignature kCellularProviderSignature
= {
444 base::Value::TYPE_DICTIONARY
, cellular_provider_fields
, NULL
446 const OncValueSignature kCellularApnSignature
= {
447 base::Value::TYPE_DICTIONARY
, cellular_apn_fields
, NULL
449 const OncValueSignature kCellularFoundNetworkSignature
= {
450 base::Value::TYPE_DICTIONARY
, cellular_found_network_fields
, NULL
452 const OncValueSignature kSIMLockStatusSignature
= {
453 base::Value::TYPE_DICTIONARY
, sim_lock_status_fields
, NULL
456 const OncFieldSignature
* GetFieldSignature(const OncValueSignature
& signature
,
457 const std::string
& onc_field_name
) {
458 if (!signature
.fields
)
460 for (const OncFieldSignature
* field_signature
= signature
.fields
;
461 field_signature
->onc_field_name
!= NULL
; ++field_signature
) {
462 if (onc_field_name
== field_signature
->onc_field_name
)
463 return field_signature
;
465 if (signature
.base_signature
)
466 return GetFieldSignature(*signature
.base_signature
, onc_field_name
);
472 struct CredentialEntry
{
473 const OncValueSignature
* value_signature
;
474 const char* field_name
;
477 const CredentialEntry credentials
[] = {
478 {&kEAPSignature
, ::onc::eap::kPassword
},
479 {&kIPsecSignature
, ::onc::ipsec::kPSK
},
480 {&kXAUTHSignature
, ::onc::vpn::kPassword
},
481 {&kL2TPSignature
, ::onc::vpn::kPassword
},
482 {&kOpenVPNSignature
, ::onc::vpn::kPassword
},
483 {&kOpenVPNSignature
, ::onc::openvpn::kTLSAuthContents
},
484 {&kWiFiSignature
, ::onc::wifi::kPassphrase
},
485 {&kCellularApnSignature
, ::onc::cellular_apn::kPassword
},
490 bool FieldIsCredential(const OncValueSignature
& signature
,
491 const std::string
& onc_field_name
) {
492 for (const CredentialEntry
* entry
= credentials
;
493 entry
->value_signature
!= NULL
; ++entry
) {
494 if (&signature
== entry
->value_signature
&&
495 onc_field_name
== entry
->field_name
) {
503 } // namespace chromeos