summaryrefslogtreecommitdiffstats
path: root/chrome/browser/password_manager
diff options
context:
space:
mode:
authorstuartmorgan@google.com <stuartmorgan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 21:29:01 +0000
committerstuartmorgan@google.com <stuartmorgan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 21:29:01 +0000
commitdaf27818e5b5d19fab8bee0da118fe387fe1a21c (patch)
treecd31eae165c0daca15fb495c3a79c2147dc96685 /chrome/browser/password_manager
parentd8be5f4c2e679192460479c0ffb8f2c891219051 (diff)
downloadchromium_src-daf27818e5b5d19fab8bee0da118fe387fe1a21c.zip
chromium_src-daf27818e5b5d19fab8bee0da118fe387fe1a21c.tar.gz
chromium_src-daf27818e5b5d19fab8bee0da118fe387fe1a21c.tar.bz2
Don't store blacklist entries in the keychain.
BUG=none TEST=none; mac password storage has no UI yet. (Once it does: opting never to remember passwords for a site should not create a Keycahin entry.) Review URL: http://codereview.chromium.org/155389 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager')
-rw-r--r--chrome/browser/password_manager/password_store_mac.cc17
-rw-r--r--chrome/browser/password_manager/password_store_mac.h5
2 files changed, 18 insertions, 4 deletions
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index 6841959..9234eaa 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -449,6 +449,9 @@ PasswordForm* MacKeychainPasswordFormAdapter::PasswordExactlyMatchingForm(
}
bool MacKeychainPasswordFormAdapter::AddLogin(const PasswordForm& form) {
+ // We should never be trying to store a blacklist in the keychain.
+ DCHECK(!form.blacklisted_by_user);
+
std::string server;
std::string security_domain;
int port;
@@ -631,17 +634,15 @@ PasswordStoreMac::PasswordStoreMac(MacKeychain* keychain,
PasswordStoreMac::~PasswordStoreMac() {}
void PasswordStoreMac::AddLoginImpl(const PasswordForm& form) {
- MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get());
- if (keychainAdapter.AddLogin(form)) {
+ if (AddToKeychainIfNecessary(form)) {
login_metadata_db_->AddLogin(form);
}
}
void PasswordStoreMac::UpdateLoginImpl(const PasswordForm& form) {
- MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get());
// The keychain AddLogin will update if there is a collision and add if there
// isn't, which is the behavior we want, so there's no separate UpdateLogin.
- if (keychainAdapter.AddLogin(form)) {
+ if (AddToKeychainIfNecessary(form)) {
int update_count = 0;
login_metadata_db_->UpdateLogin(form, &update_count);
// Update will catch any database entries that we already had, but we could
@@ -694,3 +695,11 @@ void PasswordStoreMac::GetAllLoginsImpl(GetLoginsRequest* request) {
void PasswordStoreMac::GetAllAutofillableLoginsImpl(GetLoginsRequest* request) {
NOTIMPLEMENTED();
}
+
+bool PasswordStoreMac::AddToKeychainIfNecessary(const PasswordForm& form) {
+ if (form.blacklisted_by_user) {
+ return true;
+ }
+ MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get());
+ return keychainAdapter.AddLogin(form);
+}
diff --git a/chrome/browser/password_manager/password_store_mac.h b/chrome/browser/password_manager/password_store_mac.h
index c407e4e..e99d7cc 100644
--- a/chrome/browser/password_manager/password_store_mac.h
+++ b/chrome/browser/password_manager/password_store_mac.h
@@ -29,6 +29,11 @@ class PasswordStoreMac : public PasswordStore {
void GetAllLoginsImpl(GetLoginsRequest* request);
void GetAllAutofillableLoginsImpl(GetLoginsRequest* request);
+ // Adds the given form to the Keychain if it's something we want to store
+ // there (i.e., not a blacklist entry). Returns true if the operation
+ // succeeded (either we added successfully, or we didn't need to).
+ bool AddToKeychainIfNecessary(const webkit_glue::PasswordForm& form);
+
scoped_ptr<MacKeychain> keychain_;
scoped_ptr<LoginDatabaseMac> login_metadata_db_;