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/client_cert_util.h" | 5 #include "chromeos/network/client_cert_util.h" |
6 | 6 |
7 #include <cert.h> | 7 #include <cert.h> |
8 #include <pk11pub.h> | 8 #include <pk11pub.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 const base::DictionaryValue* provider_properties = NULL; | 252 const base::DictionaryValue* provider_properties = NULL; |
253 service_properties.GetDictionaryWithoutPathExpansion( | 253 service_properties.GetDictionaryWithoutPathExpansion( |
254 shill::kProviderProperty, &provider_properties); | 254 shill::kProviderProperty, &provider_properties); |
255 switch (cert_config_type) { | 255 switch (cert_config_type) { |
256 case CONFIG_TYPE_NONE: | 256 case CONFIG_TYPE_NONE: |
257 return true; | 257 return true; |
258 case CONFIG_TYPE_OPENVPN: | 258 case CONFIG_TYPE_OPENVPN: |
259 // OpenVPN generally requires a passphrase and we don't know whether or | 259 // OpenVPN generally requires a passphrase and we don't know whether or |
260 // not one is required, so always return false here. | 260 // not one is required, so always return false here. |
261 return false; | 261 return false; |
262 case CONFIG_TYPE_IPSEC: | 262 case CONFIG_TYPE_IPSEC: { |
stevenjb
2014/02/14 16:44:13
nit: if (!provider_properties) return false;
| |
263 // IPSec may require a passphrase, so return false here also. | 263 std::string client_cert_id; |
264 return false; | 264 if (provider_properties) { |
265 provider_properties->GetStringWithoutPathExpansion( | |
266 shill::kL2tpIpsecClientCertIdProperty, &client_cert_id); | |
267 } | |
268 return !client_cert_id.empty(); | |
269 } | |
265 case CONFIG_TYPE_EAP: { | 270 case CONFIG_TYPE_EAP: { |
266 std::string cert_id = GetStringFromDictionary( | 271 std::string cert_id = GetStringFromDictionary( |
267 service_properties, shill::kEapCertIdProperty); | 272 service_properties, shill::kEapCertIdProperty); |
268 std::string key_id = GetStringFromDictionary( | 273 std::string key_id = GetStringFromDictionary( |
269 service_properties, shill::kEapKeyIdProperty); | 274 service_properties, shill::kEapKeyIdProperty); |
270 std::string identity = GetStringFromDictionary( | 275 std::string identity = GetStringFromDictionary( |
271 service_properties, shill::kEapIdentityProperty); | 276 service_properties, shill::kEapIdentityProperty); |
272 return !cert_id.empty() && !key_id.empty() && !identity.empty(); | 277 return !cert_id.empty() && !key_id.empty() && !identity.empty(); |
273 } | 278 } |
274 } | 279 } |
275 NOTREACHED(); | 280 NOTREACHED(); |
276 return false; | 281 return false; |
277 } | 282 } |
278 | 283 |
279 } // namespace client_cert | 284 } // namespace client_cert |
280 | 285 |
281 } // namespace chromeos | 286 } // namespace chromeos |
OLD | NEW |