diff options
author | erikchen <erikchen@chromium.org> | 2015-02-09 15:49:20 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-09 23:49:53 +0000 |
commit | ac00ebe0d6b6b2f79df394aa768022da8e181c30 (patch) | |
tree | 093a95197c180908baac5771e8c85188975357b4 /components | |
parent | 6edaec3e96636afe78e4464539a030177c6b7ed0 (diff) | |
download | chromium_src-ac00ebe0d6b6b2f79df394aa768022da8e181c30.zip chromium_src-ac00ebe0d6b6b2f79df394aa768022da8e181c30.tar.gz chromium_src-ac00ebe0d6b6b2f79df394aa768022da8e181c30.tar.bz2 |
mac, wifi: Access to the keychain should go through AppleKeychain.
The OSX keychain is not thread safe, so all access needs to go through the
AppleKeychain class.
BUG=
Review URL: https://codereview.chromium.org/903933007
Cr-Commit-Position: refs/heads/master@{#315441}
Diffstat (limited to 'components')
-rw-r--r-- | components/wifi.gypi | 1 | ||||
-rw-r--r-- | components/wifi/DEPS | 1 | ||||
-rw-r--r-- | components/wifi/wifi_service_mac.mm | 20 |
3 files changed, 13 insertions, 9 deletions
diff --git a/components/wifi.gypi b/components/wifi.gypi index 866b4da..3d71215 100644 --- a/components/wifi.gypi +++ b/components/wifi.gypi @@ -9,6 +9,7 @@ 'type': '<(component)', 'dependencies': [ '../base/base.gyp:base', + '../crypto/crypto.gyp:crypto', '../third_party/libxml/libxml.gyp:libxml', 'onc_component', ], diff --git a/components/wifi/DEPS b/components/wifi/DEPS index f88b423..5afea71 100644 --- a/components/wifi/DEPS +++ b/components/wifi/DEPS @@ -1,4 +1,5 @@ include_rules = [ "+components/onc", + "+crypto", "+third_party/libxml", ] diff --git a/components/wifi/wifi_service_mac.mm b/components/wifi/wifi_service_mac.mm index 46fc9f0..e7c0e27 100644 --- a/components/wifi/wifi_service_mac.mm +++ b/components/wifi/wifi_service_mac.mm @@ -17,6 +17,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/onc/onc_constants.h" #include "components/wifi/network_properties.h" +#include "crypto/apple_keychain.h" namespace wifi { @@ -361,14 +362,15 @@ void WiFiServiceMac::GetKeyFromSystem(const std::string& network_guid, UInt32 password_length = 0; void *password_data = NULL; - OSStatus status = SecKeychainFindGenericPassword(NULL, - strlen(kAirPortServiceName), - kAirPortServiceName, - network_guid.length(), - network_guid.c_str(), - &password_length, - &password_data, - NULL); + crypto::AppleKeychain keychain; + OSStatus status = keychain.FindGenericPassword(NULL, + strlen(kAirPortServiceName), + kAirPortServiceName, + network_guid.length(), + network_guid.c_str(), + &password_length, + &password_data, + NULL); if (status != errSecSuccess) { *error = kErrorNotFound; return; @@ -377,7 +379,7 @@ void WiFiServiceMac::GetKeyFromSystem(const std::string& network_guid, if (password_data) { *key_data = std::string(reinterpret_cast<char*>(password_data), password_length); - SecKeychainItemFreeContent(NULL, password_data); + keychain.ItemFreeContent(NULL, password_data); } } |