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

Unified Diff: chromeos/network/client_cert_util.cc

Issue 23583018: Check configuration for networks without UIData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/client_cert_util.h ('k') | chromeos/network/network_connection_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/client_cert_util.cc
diff --git a/chromeos/network/client_cert_util.cc b/chromeos/network/client_cert_util.cc
index ad2bc457b3037ecf7178609cd3084bdde9db99b1..88ff649982c59385fdafec0540bce347103b0e26 100644
--- a/chromeos/network/client_cert_util.cc
+++ b/chromeos/network/client_cert_util.cc
@@ -91,6 +91,13 @@ class IssuerCaFilter {
const std::vector<std::string>& issuer_ca_pems_;
};
+std::string GetStringFromDictionary(const base::DictionaryValue& dict,
+ const std::string& key) {
+ std::string s;
+ dict.GetStringWithoutPathExpansion(key, &s);
+ return s;
+}
+
} // namespace
// Returns true only if any fields set in this pattern match exactly with
@@ -238,6 +245,36 @@ void SetShillProperties(const client_cert::ConfigType cert_config_type,
properties->SetStringWithoutPathExpansion(tpm_pin_property, tpm_pin);
}
+bool IsCertificateConfigured(const client_cert::ConfigType cert_config_type,
+ const base::DictionaryValue& service_properties) {
+ // VPN certificate properties are read from the Provider dictionary.
+ const base::DictionaryValue* provider_properties = NULL;
+ service_properties.GetDictionaryWithoutPathExpansion(
+ flimflam::kProviderProperty, &provider_properties);
+ switch (cert_config_type) {
+ case CONFIG_TYPE_NONE:
+ return true;
+ case CONFIG_TYPE_OPENVPN:
+ // OpenVPN generally requires a passphrase and we don't know whether or
+ // not one is required, so always return false here.
+ return false;
+ case CONFIG_TYPE_IPSEC:
+ // IPSec may require a passphrase, so return false here also.
+ return false;
+ case CONFIG_TYPE_EAP: {
+ std::string cert_id = GetStringFromDictionary(
+ service_properties, flimflam::kEapCertIdProperty);
+ std::string key_id = GetStringFromDictionary(
+ service_properties, flimflam::kEapKeyIdProperty);
+ std::string identity = GetStringFromDictionary(
+ service_properties, flimflam::kEapIdentityProperty);
+ return !cert_id.empty() && !key_id.empty() && !identity.empty();
+ }
+ }
+ NOTREACHED();
+ return false;
+}
+
} // namespace client_cert
} // namespace chromeos
« no previous file with comments | « chromeos/network/client_cert_util.h ('k') | chromeos/network/network_connection_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698