| 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_signature.h" | 5 #include "chromeos/network/onc/onc_signature.h" |
| 6 | 6 |
| 7 #include "chromeos/network/onc/onc_constants.h" | 7 #include "chromeos/network/onc/onc_constants.h" |
| 8 #include "third_party/cros_system_api/dbus/service_constants.h" | 8 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 9 | 9 |
| 10 using base::Value; | 10 using base::Value; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 const OncFieldSignature issuer_subject_pattern_fields[] = { | 32 const OncFieldSignature issuer_subject_pattern_fields[] = { |
| 33 { certificate::kCommonName, NULL, &kStringSignature }, | 33 { certificate::kCommonName, NULL, &kStringSignature }, |
| 34 { certificate::kLocality, NULL, &kStringSignature }, | 34 { certificate::kLocality, NULL, &kStringSignature }, |
| 35 { certificate::kOrganization, NULL, &kStringSignature }, | 35 { certificate::kOrganization, NULL, &kStringSignature }, |
| 36 { certificate::kOrganizationalUnit, NULL, &kStringSignature }, | 36 { certificate::kOrganizationalUnit, NULL, &kStringSignature }, |
| 37 { NULL } | 37 { NULL } |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 // CertificatePattern is converted with function CreateUIData(...) to UIData |
| 41 // stored in Shill. |
| 40 const OncFieldSignature certificate_pattern_fields[] = { | 42 const OncFieldSignature certificate_pattern_fields[] = { |
| 41 { kRecommended, NULL, &kRecommendedSignature }, | 43 { kRecommended, NULL, &kRecommendedSignature }, |
| 42 { certificate::kEnrollmentURI, NULL, &kStringListSignature }, | 44 { certificate::kEnrollmentURI, NULL, &kStringListSignature }, |
| 43 { certificate::kIssuer, NULL, &kIssuerSubjectPatternSignature }, | 45 { certificate::kIssuer, NULL, &kIssuerSubjectPatternSignature }, |
| 44 { certificate::kIssuerCARef, NULL, &kStringListSignature }, | 46 { certificate::kIssuerCARef, NULL, &kStringListSignature }, |
| 45 { certificate::kSubject, NULL, &kIssuerSubjectPatternSignature }, | 47 { certificate::kSubject, NULL, &kIssuerSubjectPatternSignature }, |
| 46 { NULL } | 48 { NULL } |
| 47 }; | 49 }; |
| 48 | 50 |
| 49 const OncFieldSignature eap_fields[] = { | 51 const OncFieldSignature eap_fields[] = { |
| 50 { kRecommended, NULL, &kRecommendedSignature }, | 52 { kRecommended, NULL, &kRecommendedSignature }, |
| 51 { eap::kAnonymousIdentity, flimflam::kEapAnonymousIdentityProperty, | 53 { eap::kAnonymousIdentity, flimflam::kEapAnonymousIdentityProperty, |
| 52 &kStringSignature }, | 54 &kStringSignature }, |
| 53 { eap::kClientCertPattern, NULL, &kCertificatePatternSignature }, | 55 { eap::kClientCertPattern, NULL, &kCertificatePatternSignature }, |
| 54 { eap::kClientCertRef, NULL, &kStringSignature }, | 56 { eap::kClientCertRef, NULL, &kStringSignature }, |
| 55 { eap::kClientCertType, NULL, &kStringSignature }, | 57 { eap::kClientCertType, NULL, &kStringSignature }, |
| 56 { eap::kIdentity, flimflam::kEapIdentityProperty, &kStringSignature }, | 58 { eap::kIdentity, flimflam::kEapIdentityProperty, &kStringSignature }, |
| 57 { eap::kInner, flimflam::kEapPhase2AuthProperty, &kStringSignature }, | 59 // This field is converted during translation, see onc_translator_*. |
| 58 { eap::kOuter, flimflam::kEapMethodProperty, &kStringSignature }, | 60 { eap::kInner, NULL, &kStringSignature }, |
| 61 // This field is converted during translation, see onc_translator_*. |
| 62 { eap::kOuter, NULL, &kStringSignature }, |
| 59 { eap::kPassword, flimflam::kEapPasswordProperty, &kStringSignature }, | 63 { eap::kPassword, flimflam::kEapPasswordProperty, &kStringSignature }, |
| 60 { eap::kSaveCredentials, flimflam::kSaveCredentialsProperty, | 64 { eap::kSaveCredentials, flimflam::kSaveCredentialsProperty, |
| 61 &kBoolSignature }, | 65 &kBoolSignature }, |
| 62 { eap::kServerCARef, flimflam::kEapCaCertNssProperty, &kStringSignature }, | 66 { eap::kServerCARef, flimflam::kEapCaCertNssProperty, &kStringSignature }, |
| 63 { eap::kUseSystemCAs, flimflam::kEapUseSystemCasProperty, &kBoolSignature }, | 67 { eap::kUseSystemCAs, flimflam::kEapUseSystemCasProperty, &kBoolSignature }, |
| 64 { NULL } | 68 { NULL } |
| 65 }; | 69 }; |
| 66 | 70 |
| 67 const OncFieldSignature ipsec_fields[] = { | 71 const OncFieldSignature ipsec_fields[] = { |
| 68 { kRecommended, NULL, &kRecommendedSignature }, | 72 { kRecommended, NULL, &kRecommendedSignature }, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 { vpn::kRemoteCertEKU, flimflam::kOpenVPNRemoteCertEKUProperty, | 123 { vpn::kRemoteCertEKU, flimflam::kOpenVPNRemoteCertEKUProperty, |
| 120 &kStringSignature }, | 124 &kStringSignature }, |
| 121 // This field is converted during translation, see onc_translator_*. | 125 // This field is converted during translation, see onc_translator_*. |
| 122 { vpn::kRemoteCertKU, NULL, &kStringListSignature }, | 126 { vpn::kRemoteCertKU, NULL, &kStringListSignature }, |
| 123 { vpn::kRemoteCertTLS, flimflam::kOpenVPNRemoteCertTLSProperty, | 127 { vpn::kRemoteCertTLS, flimflam::kOpenVPNRemoteCertTLSProperty, |
| 124 &kStringSignature }, | 128 &kStringSignature }, |
| 125 { vpn::kRenegSec, flimflam::kOpenVPNRenegSecProperty, &kIntegerSignature }, | 129 { vpn::kRenegSec, flimflam::kOpenVPNRenegSecProperty, &kIntegerSignature }, |
| 126 { vpn::kSaveCredentials, flimflam::kSaveCredentialsProperty, | 130 { vpn::kSaveCredentials, flimflam::kSaveCredentialsProperty, |
| 127 &kBoolSignature }, | 131 &kBoolSignature }, |
| 128 { vpn::kServerCARef, flimflam::kOpenVPNCaCertNSSProperty, &kStringSignature }, | 132 { vpn::kServerCARef, flimflam::kOpenVPNCaCertNSSProperty, &kStringSignature }, |
| 133 // Not supported, yet. |
| 129 { vpn::kServerCertRef, NULL, &kStringSignature }, | 134 { vpn::kServerCertRef, NULL, &kStringSignature }, |
| 130 { vpn::kServerPollTimeout, flimflam::kOpenVPNServerPollTimeoutProperty, | 135 { vpn::kServerPollTimeout, flimflam::kOpenVPNServerPollTimeoutProperty, |
| 131 &kIntegerSignature }, | 136 &kIntegerSignature }, |
| 132 { vpn::kShaper, flimflam::kOpenVPNShaperProperty, &kIntegerSignature }, | 137 { vpn::kShaper, flimflam::kOpenVPNShaperProperty, &kIntegerSignature }, |
| 133 { vpn::kStaticChallenge, flimflam::kOpenVPNStaticChallengeProperty, | 138 { vpn::kStaticChallenge, flimflam::kOpenVPNStaticChallengeProperty, |
| 134 &kStringSignature }, | 139 &kStringSignature }, |
| 135 { vpn::kTLSAuthContents, flimflam::kOpenVPNTLSAuthContentsProperty, | 140 { vpn::kTLSAuthContents, flimflam::kOpenVPNTLSAuthContentsProperty, |
| 136 &kStringSignature }, | 141 &kStringSignature }, |
| 137 { vpn::kTLSRemote, flimflam::kOpenVPNTLSRemoteProperty, &kStringSignature }, | 142 { vpn::kTLSRemote, flimflam::kOpenVPNTLSRemoteProperty, &kStringSignature }, |
| 138 { vpn::kUsername, flimflam::kOpenVPNUserProperty, &kStringSignature }, | 143 { vpn::kUsername, flimflam::kOpenVPNUserProperty, &kStringSignature }, |
| 144 // Not supported, yet. |
| 139 { vpn::kVerb, NULL, &kStringSignature }, | 145 { vpn::kVerb, NULL, &kStringSignature }, |
| 140 { NULL } | 146 { NULL } |
| 141 }; | 147 }; |
| 142 | 148 |
| 143 const OncFieldSignature vpn_fields[] = { | 149 const OncFieldSignature vpn_fields[] = { |
| 144 { kRecommended, NULL, &kRecommendedSignature }, | 150 { kRecommended, NULL, &kRecommendedSignature }, |
| 145 { vpn::kHost, flimflam::kProviderHostProperty, &kStringSignature }, | 151 { vpn::kHost, flimflam::kProviderHostProperty, &kStringSignature }, |
| 146 { vpn::kIPsec, NULL, &kIPsecSignature }, | 152 { vpn::kIPsec, NULL, &kIPsecSignature }, |
| 147 { vpn::kL2TP, NULL, &kL2TPSignature }, | 153 { vpn::kL2TP, NULL, &kL2TPSignature }, |
| 148 { vpn::kOpenVPN, NULL, &kOpenVPNSignature }, | 154 { vpn::kOpenVPN, NULL, &kOpenVPNSignature }, |
| 149 // This field is converted during translation, see onc_translator_*. | 155 // This field is converted during translation, see onc_translator_*. |
| 150 { kType, NULL, &kStringSignature }, | 156 { vpn::kType, NULL, &kStringSignature }, |
| 151 { NULL } | 157 { NULL } |
| 152 }; | 158 }; |
| 153 | 159 |
| 154 const OncFieldSignature ethernet_fields[] = { | 160 const OncFieldSignature ethernet_fields[] = { |
| 155 { kRecommended, NULL, &kRecommendedSignature }, | 161 { kRecommended, NULL, &kRecommendedSignature }, |
| 162 // Not supported, yet. |
| 156 { ethernet::kAuthentication, NULL, &kStringSignature }, | 163 { ethernet::kAuthentication, NULL, &kStringSignature }, |
| 157 { ethernet::kEAP, NULL, &kEAPSignature }, | 164 { ethernet::kEAP, NULL, &kEAPSignature }, |
| 158 { NULL } | 165 { NULL } |
| 159 }; | 166 }; |
| 160 | 167 |
| 168 // Not supported, yet. |
| 161 const OncFieldSignature ipconfig_fields[] = { | 169 const OncFieldSignature ipconfig_fields[] = { |
| 162 { ipconfig::kGateway, NULL, &kStringSignature }, | 170 { ipconfig::kGateway, NULL, &kStringSignature }, |
| 163 { ipconfig::kIPAddress, NULL, &kStringSignature }, | 171 { ipconfig::kIPAddress, NULL, &kStringSignature }, |
| 164 { kNameServers, NULL, &kStringSignature }, | 172 { kNameServers, NULL, &kStringSignature }, |
| 165 { ipconfig::kRoutingPrefix, NULL, &kIntegerSignature }, | 173 { ipconfig::kRoutingPrefix, NULL, &kIntegerSignature }, |
| 166 { kSearchDomains, NULL, &kStringListSignature }, | 174 { kSearchDomains, NULL, &kStringListSignature }, |
| 167 // This field is converted during translation, see onc_translator_*. | 175 { ipconfig::kType, NULL, &kStringSignature }, |
| 168 { kType, NULL, &kStringSignature }, | |
| 169 { NULL } | 176 { NULL } |
| 170 }; | 177 }; |
| 171 | 178 |
| 172 const OncFieldSignature proxy_location_fields[] = { | 179 const OncFieldSignature proxy_location_fields[] = { |
| 173 { proxy::kHost, NULL, &kStringSignature }, | 180 { proxy::kHost, NULL, &kStringSignature }, |
| 174 { proxy::kPort, NULL, &kIntegerSignature }, | 181 { proxy::kPort, NULL, &kIntegerSignature }, |
| 175 { NULL } | 182 { NULL } |
| 176 }; | 183 }; |
| 177 | 184 |
| 178 const OncFieldSignature proxy_manual_fields[] = { | 185 const OncFieldSignature proxy_manual_fields[] = { |
| 179 { proxy::kFtp, NULL, &kProxyLocationSignature }, | 186 { proxy::kFtp, NULL, &kProxyLocationSignature }, |
| 180 { proxy::kHttp, NULL, &kProxyLocationSignature }, | 187 { proxy::kHttp, NULL, &kProxyLocationSignature }, |
| 181 { proxy::kHttps, NULL, &kProxyLocationSignature }, | 188 { proxy::kHttps, NULL, &kProxyLocationSignature }, |
| 182 { proxy::kSocks, NULL, &kProxyLocationSignature }, | 189 { proxy::kSocks, NULL, &kProxyLocationSignature }, |
| 183 { NULL } | 190 { NULL } |
| 184 }; | 191 }; |
| 185 | 192 |
| 193 // Proxy settings are converted to Shill by |
| 194 // function ConvertOncProxySettingsToProxyConfig(...). |
| 186 const OncFieldSignature proxy_settings_fields[] = { | 195 const OncFieldSignature proxy_settings_fields[] = { |
| 187 { kRecommended, NULL, &kRecommendedSignature }, | 196 { kRecommended, NULL, &kRecommendedSignature }, |
| 188 { proxy::kExcludeDomains, NULL, &kStringListSignature }, | 197 { proxy::kExcludeDomains, NULL, &kStringListSignature }, |
| 189 { proxy::kManual, NULL, &kProxyManualSignature }, | 198 { proxy::kManual, NULL, &kProxyManualSignature }, |
| 190 { proxy::kPAC, NULL, &kStringSignature }, | 199 { proxy::kPAC, NULL, &kStringSignature }, |
| 191 { kType, NULL, &kStringSignature }, | 200 { proxy::kType, NULL, &kStringSignature }, |
| 192 { NULL } | 201 { NULL } |
| 193 }; | 202 }; |
| 194 | 203 |
| 195 const OncFieldSignature wifi_fields[] = { | 204 const OncFieldSignature wifi_fields[] = { |
| 196 { kRecommended, NULL, &kRecommendedSignature }, | 205 { kRecommended, NULL, &kRecommendedSignature }, |
| 197 { wifi::kAutoConnect, flimflam::kAutoConnectProperty, &kBoolSignature }, | 206 { wifi::kAutoConnect, flimflam::kAutoConnectProperty, &kBoolSignature }, |
| 198 { wifi::kEAP, NULL, &kEAPSignature }, | 207 { wifi::kEAP, NULL, &kEAPSignature }, |
| 199 { wifi::kHiddenSSID, flimflam::kWifiHiddenSsid, &kBoolSignature }, | 208 { wifi::kHiddenSSID, flimflam::kWifiHiddenSsid, &kBoolSignature }, |
| 200 { wifi::kPassphrase, flimflam::kPassphraseProperty, &kStringSignature }, | 209 { wifi::kPassphrase, flimflam::kPassphraseProperty, &kStringSignature }, |
| 201 { wifi::kSSID, flimflam::kSSIDProperty, &kStringSignature }, | 210 { wifi::kSSID, flimflam::kSSIDProperty, &kStringSignature }, |
| 202 { wifi::kSecurity, flimflam::kSecurityProperty, &kStringSignature }, | 211 // This field is converted during translation, see onc_translator_*. |
| 212 { wifi::kSecurity, NULL, &kStringSignature }, |
| 203 { NULL } | 213 { NULL } |
| 204 }; | 214 }; |
| 205 | 215 |
| 206 const OncFieldSignature network_configuration_fields[] = { | 216 const OncFieldSignature network_configuration_fields[] = { |
| 207 { kRecommended, NULL, &kRecommendedSignature }, | 217 { kRecommended, NULL, &kRecommendedSignature }, |
| 208 { kEthernet, NULL, &kEthernetSignature }, | 218 { kEthernet, NULL, &kEthernetSignature }, |
| 209 { kGUID, flimflam::kGuidProperty, &kStringSignature }, | 219 { kGUID, flimflam::kGuidProperty, &kStringSignature }, |
| 210 { kIPConfigs, NULL, &kIPConfigListSignature }, | 220 { kIPConfigs, NULL, &kIPConfigListSignature }, |
| 211 { kName, flimflam::kNameProperty, &kStringSignature }, | 221 // Shill doesn't allow setting the name for non-VPN networks. |
| 222 // This field is conditionally translated, see onc_translator_*. |
| 223 { kName, NULL, &kStringSignature }, |
| 224 // Not supported, yet. |
| 212 { kNameServers, NULL, &kStringListSignature }, | 225 { kNameServers, NULL, &kStringListSignature }, |
| 213 { kProxySettings, NULL, &kProxySettingsSignature }, | 226 { kProxySettings, NULL, &kProxySettingsSignature }, |
| 227 // No need to translate. |
| 214 { kRemove, NULL, &kBoolSignature }, | 228 { kRemove, NULL, &kBoolSignature }, |
| 229 // Not supported, yet. |
| 215 { kSearchDomains, NULL, &kStringListSignature }, | 230 { kSearchDomains, NULL, &kStringListSignature }, |
| 216 // This field is converted during translation, see onc_translator_*. | 231 // This field is converted during translation, see onc_translator_*. |
| 217 { kType, NULL, &kStringSignature }, | 232 { kType, NULL, &kStringSignature }, |
| 218 { kVPN, NULL, &kVPNSignature }, | 233 { kVPN, NULL, &kVPNSignature }, |
| 219 { kWiFi, NULL, &kWiFiSignature }, | 234 { kWiFi, NULL, &kWiFiSignature }, |
| 220 { NULL } | 235 { NULL } |
| 221 }; | 236 }; |
| 222 | 237 |
| 238 // Certificates are not translated to Shill. |
| 223 const OncFieldSignature certificate_fields[] = { | 239 const OncFieldSignature certificate_fields[] = { |
| 224 { kGUID, flimflam::kGuidProperty, &kStringSignature }, | 240 { kGUID, NULL, &kStringSignature }, |
| 225 { certificate::kPKCS12, NULL, &kStringSignature }, | 241 { certificate::kPKCS12, NULL, &kStringSignature }, |
| 226 { kRemove, NULL, &kBoolSignature }, | 242 { kRemove, NULL, &kBoolSignature }, |
| 227 { certificate::kTrust, NULL, &kStringListSignature }, | 243 { certificate::kTrust, NULL, &kStringListSignature }, |
| 228 { kType, NULL, &kStringSignature }, | 244 { certificate::kType, NULL, &kStringSignature }, |
| 229 { certificate::kX509, NULL, &kStringSignature }, | 245 { certificate::kX509, NULL, &kStringSignature }, |
| 230 { NULL } | 246 { NULL } |
| 231 }; | 247 }; |
| 232 | 248 |
| 233 const OncFieldSignature toplevel_configuration_fields[] = { | 249 const OncFieldSignature toplevel_configuration_fields[] = { |
| 234 { kCertificates, NULL, &kCertificateListSignature }, | 250 { kCertificates, NULL, &kCertificateListSignature }, |
| 235 { kNetworkConfigurations, NULL, &kNetworkConfigurationListSignature }, | 251 { kNetworkConfigurations, NULL, &kNetworkConfigurationListSignature }, |
| 236 { kType, NULL, &kStringSignature }, | 252 { kType, NULL, &kStringSignature }, |
| 237 { encrypted::kCipher, NULL, &kStringSignature }, | 253 { encrypted::kCipher, NULL, &kStringSignature }, |
| 238 { encrypted::kCiphertext, NULL, &kStringSignature }, | 254 { encrypted::kCiphertext, NULL, &kStringSignature }, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 for (const OncFieldSignature* field_signature = signature.fields; | 328 for (const OncFieldSignature* field_signature = signature.fields; |
| 313 field_signature->onc_field_name != NULL; ++field_signature) { | 329 field_signature->onc_field_name != NULL; ++field_signature) { |
| 314 if (onc_field_name == field_signature->onc_field_name) | 330 if (onc_field_name == field_signature->onc_field_name) |
| 315 return field_signature; | 331 return field_signature; |
| 316 } | 332 } |
| 317 return NULL; | 333 return NULL; |
| 318 } | 334 } |
| 319 | 335 |
| 320 } // namespace onc | 336 } // namespace onc |
| 321 } // namespace chromeos | 337 } // namespace chromeos |
| OLD | NEW |