| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/login_database.h" | 5 #include "components/password_manager/core/browser/login_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/pickle.h" | 13 #include "base/pickle.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "components/autofill/core/common/password_form.h" | 16 #include "components/autofill/core/common/password_form.h" |
| 17 #include "sql/connection.h" | 17 #include "sql/connection.h" |
| 18 #include "sql/statement.h" | 18 #include "sql/statement.h" |
| 19 #include "sql/transaction.h" | 19 #include "sql/transaction.h" |
| 20 | 20 |
| 21 using autofill::PasswordForm; | 21 using autofill::PasswordForm; |
| 22 | 22 |
| 23 static const int kCurrentVersionNumber = 4; | 23 static const int kCurrentVersionNumber = 5; |
| 24 static const int kCompatibleVersionNumber = 1; | 24 static const int kCompatibleVersionNumber = 1; |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // Convenience enum for interacting with SQL queries that use all the columns. | 28 // Convenience enum for interacting with SQL queries that use all the columns. |
| 29 enum LoginTableColumns { | 29 enum LoginTableColumns { |
| 30 COLUMN_ORIGIN_URL = 0, | 30 COLUMN_ORIGIN_URL = 0, |
| 31 COLUMN_ACTION_URL, | 31 COLUMN_ACTION_URL, |
| 32 COLUMN_USERNAME_ELEMENT, | 32 COLUMN_USERNAME_ELEMENT, |
| 33 COLUMN_USERNAME_VALUE, | 33 COLUMN_USERNAME_VALUE, |
| 34 COLUMN_PASSWORD_ELEMENT, | 34 COLUMN_PASSWORD_ELEMENT, |
| 35 COLUMN_PASSWORD_VALUE, | 35 COLUMN_PASSWORD_VALUE, |
| 36 COLUMN_SUBMIT_ELEMENT, | 36 COLUMN_SUBMIT_ELEMENT, |
| 37 COLUMN_SIGNON_REALM, | 37 COLUMN_SIGNON_REALM, |
| 38 COLUMN_SSL_VALID, | 38 COLUMN_SSL_VALID, |
| 39 COLUMN_PREFERRED, | 39 COLUMN_PREFERRED, |
| 40 COLUMN_DATE_CREATED, | 40 COLUMN_DATE_CREATED, |
| 41 COLUMN_BLACKLISTED_BY_USER, | 41 COLUMN_BLACKLISTED_BY_USER, |
| 42 COLUMN_SCHEME, | 42 COLUMN_SCHEME, |
| 43 COLUMN_PASSWORD_TYPE, | 43 COLUMN_PASSWORD_TYPE, |
| 44 COLUMN_POSSIBLE_USERNAMES, | 44 COLUMN_POSSIBLE_USERNAMES, |
| 45 COLUMN_TIMES_USED, | 45 COLUMN_TIMES_USED, |
| 46 COLUMN_FORM_DATA | 46 COLUMN_FORM_DATA, |
| 47 COLUMN_USE_ADDITIONAL_AUTH |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace | 50 } // namespace |
| 50 | 51 |
| 51 LoginDatabase::LoginDatabase() { | 52 LoginDatabase::LoginDatabase() { |
| 52 } | 53 } |
| 53 | 54 |
| 54 LoginDatabase::~LoginDatabase() { | 55 LoginDatabase::~LoginDatabase() { |
| 55 } | 56 } |
| 56 | 57 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // Fall through. | 126 // Fall through. |
| 126 case 3: | 127 case 3: |
| 127 // We need to check if the column exists because of | 128 // We need to check if the column exists because of |
| 128 // https://crbug.com/295851 | 129 // https://crbug.com/295851 |
| 129 if (!db_.DoesColumnExist("logins", "form_data") && | 130 if (!db_.DoesColumnExist("logins", "form_data") && |
| 130 !db_.Execute("ALTER TABLE logins ADD COLUMN form_data BLOB")) { | 131 !db_.Execute("ALTER TABLE logins ADD COLUMN form_data BLOB")) { |
| 131 return false; | 132 return false; |
| 132 } | 133 } |
| 133 meta_table_.SetVersionNumber(4); | 134 meta_table_.SetVersionNumber(4); |
| 134 // Fall through. | 135 // Fall through. |
| 136 case 4: |
| 137 if (!db_.Execute( |
| 138 "ALTER TABLE logins ADD COLUMN use_additional_auth INTEGER")) { |
| 139 return false; |
| 140 } |
| 141 meta_table_.SetVersionNumber(5); |
| 142 // Fall through. |
| 135 case kCurrentVersionNumber: | 143 case kCurrentVersionNumber: |
| 136 // Already up to date | 144 // Already up to date |
| 137 return true; | 145 return true; |
| 138 default: | 146 default: |
| 139 NOTREACHED(); | 147 NOTREACHED(); |
| 140 return false; | 148 return false; |
| 141 } | 149 } |
| 142 } | 150 } |
| 143 | 151 |
| 144 bool LoginDatabase::InitLoginsTable() { | 152 bool LoginDatabase::InitLoginsTable() { |
| 145 if (!db_.DoesTableExist("logins")) { | 153 if (!db_.DoesTableExist("logins")) { |
| 146 if (!db_.Execute("CREATE TABLE logins (" | 154 if (!db_.Execute("CREATE TABLE logins (" |
| 147 "origin_url VARCHAR NOT NULL, " | 155 "origin_url VARCHAR NOT NULL, " |
| 148 "action_url VARCHAR, " | 156 "action_url VARCHAR, " |
| 149 "username_element VARCHAR, " | 157 "username_element VARCHAR, " |
| 150 "username_value VARCHAR, " | 158 "username_value VARCHAR, " |
| 151 "password_element VARCHAR, " | 159 "password_element VARCHAR, " |
| 152 "password_value BLOB, " | 160 "password_value BLOB, " |
| 153 "submit_element VARCHAR, " | 161 "submit_element VARCHAR, " |
| 154 "signon_realm VARCHAR NOT NULL," | 162 "signon_realm VARCHAR NOT NULL," |
| 155 "ssl_valid INTEGER NOT NULL," | 163 "ssl_valid INTEGER NOT NULL," |
| 156 "preferred INTEGER NOT NULL," | 164 "preferred INTEGER NOT NULL," |
| 157 "date_created INTEGER NOT NULL," | 165 "date_created INTEGER NOT NULL," |
| 158 "blacklisted_by_user INTEGER NOT NULL," | 166 "blacklisted_by_user INTEGER NOT NULL," |
| 159 "scheme INTEGER NOT NULL," | 167 "scheme INTEGER NOT NULL," |
| 160 "password_type INTEGER," | 168 "password_type INTEGER," |
| 161 "possible_usernames BLOB," | 169 "possible_usernames BLOB," |
| 162 "times_used INTEGER," | 170 "times_used INTEGER," |
| 163 "form_data BLOB," | 171 "form_data BLOB," |
| 172 "use_additional_auth INTEGER," |
| 164 "UNIQUE " | 173 "UNIQUE " |
| 165 "(origin_url, username_element, " | 174 "(origin_url, username_element, " |
| 166 "username_value, password_element, " | 175 "username_value, password_element, " |
| 167 "submit_element, signon_realm))")) { | 176 "submit_element, signon_realm))")) { |
| 168 NOTREACHED(); | 177 NOTREACHED(); |
| 169 return false; | 178 return false; |
| 170 } | 179 } |
| 171 if (!db_.Execute("CREATE INDEX logins_signon ON " | 180 if (!db_.Execute("CREATE INDEX logins_signon ON " |
| 172 "logins (signon_realm)")) { | 181 "logins (signon_realm)")) { |
| 173 NOTREACHED(); | 182 NOTREACHED(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 if (EncryptedString(form.password_value, &encrypted_password) != | 241 if (EncryptedString(form.password_value, &encrypted_password) != |
| 233 ENCRYPTION_RESULT_SUCCESS) | 242 ENCRYPTION_RESULT_SUCCESS) |
| 234 return false; | 243 return false; |
| 235 | 244 |
| 236 // You *must* change LoginTableColumns if this query changes. | 245 // You *must* change LoginTableColumns if this query changes. |
| 237 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, | 246 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, |
| 238 "INSERT OR REPLACE INTO logins " | 247 "INSERT OR REPLACE INTO logins " |
| 239 "(origin_url, action_url, username_element, username_value, " | 248 "(origin_url, action_url, username_element, username_value, " |
| 240 " password_element, password_value, submit_element, " | 249 " password_element, password_value, submit_element, " |
| 241 " signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " | 250 " signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " |
| 242 " scheme, password_type, possible_usernames, times_used, form_data) " | 251 " scheme, password_type, possible_usernames, times_used, form_data, " |
| 243 "VALUES " | 252 " use_additional_auth) VALUES " |
| 244 "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")); | 253 "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")); |
| 245 s.BindString(COLUMN_ORIGIN_URL, form.origin.spec()); | 254 s.BindString(COLUMN_ORIGIN_URL, form.origin.spec()); |
| 246 s.BindString(COLUMN_ACTION_URL, form.action.spec()); | 255 s.BindString(COLUMN_ACTION_URL, form.action.spec()); |
| 247 s.BindString16(COLUMN_USERNAME_ELEMENT, form.username_element); | 256 s.BindString16(COLUMN_USERNAME_ELEMENT, form.username_element); |
| 248 s.BindString16(COLUMN_USERNAME_VALUE, form.username_value); | 257 s.BindString16(COLUMN_USERNAME_VALUE, form.username_value); |
| 249 s.BindString16(COLUMN_PASSWORD_ELEMENT, form.password_element); | 258 s.BindString16(COLUMN_PASSWORD_ELEMENT, form.password_element); |
| 250 s.BindBlob(COLUMN_PASSWORD_VALUE, encrypted_password.data(), | 259 s.BindBlob(COLUMN_PASSWORD_VALUE, encrypted_password.data(), |
| 251 static_cast<int>(encrypted_password.length())); | 260 static_cast<int>(encrypted_password.length())); |
| 252 s.BindString16(COLUMN_SUBMIT_ELEMENT, form.submit_element); | 261 s.BindString16(COLUMN_SUBMIT_ELEMENT, form.submit_element); |
| 253 s.BindString(COLUMN_SIGNON_REALM, form.signon_realm); | 262 s.BindString(COLUMN_SIGNON_REALM, form.signon_realm); |
| 254 s.BindInt(COLUMN_SSL_VALID, form.ssl_valid); | 263 s.BindInt(COLUMN_SSL_VALID, form.ssl_valid); |
| 255 s.BindInt(COLUMN_PREFERRED, form.preferred); | 264 s.BindInt(COLUMN_PREFERRED, form.preferred); |
| 256 s.BindInt64(COLUMN_DATE_CREATED, form.date_created.ToTimeT()); | 265 s.BindInt64(COLUMN_DATE_CREATED, form.date_created.ToTimeT()); |
| 257 s.BindInt(COLUMN_BLACKLISTED_BY_USER, form.blacklisted_by_user); | 266 s.BindInt(COLUMN_BLACKLISTED_BY_USER, form.blacklisted_by_user); |
| 258 s.BindInt(COLUMN_SCHEME, form.scheme); | 267 s.BindInt(COLUMN_SCHEME, form.scheme); |
| 259 s.BindInt(COLUMN_PASSWORD_TYPE, form.type); | 268 s.BindInt(COLUMN_PASSWORD_TYPE, form.type); |
| 260 Pickle usernames_pickle = SerializeVector(form.other_possible_usernames); | 269 Pickle usernames_pickle = SerializeVector(form.other_possible_usernames); |
| 261 s.BindBlob(COLUMN_POSSIBLE_USERNAMES, | 270 s.BindBlob(COLUMN_POSSIBLE_USERNAMES, |
| 262 usernames_pickle.data(), | 271 usernames_pickle.data(), |
| 263 usernames_pickle.size()); | 272 usernames_pickle.size()); |
| 264 s.BindInt(COLUMN_TIMES_USED, form.times_used); | 273 s.BindInt(COLUMN_TIMES_USED, form.times_used); |
| 265 Pickle form_data_pickle; | 274 Pickle form_data_pickle; |
| 266 autofill::SerializeFormData(form.form_data, &form_data_pickle); | 275 autofill::SerializeFormData(form.form_data, &form_data_pickle); |
| 267 s.BindBlob(COLUMN_FORM_DATA, | 276 s.BindBlob(COLUMN_FORM_DATA, |
| 268 form_data_pickle.data(), | 277 form_data_pickle.data(), |
| 269 form_data_pickle.size()); | 278 form_data_pickle.size()); |
| 279 s.BindInt(COLUMN_USE_ADDITIONAL_AUTH, form.use_additional_authentication); |
| 270 | 280 |
| 271 return s.Run(); | 281 return s.Run(); |
| 272 } | 282 } |
| 273 | 283 |
| 274 bool LoginDatabase::UpdateLogin(const PasswordForm& form, int* items_changed) { | 284 bool LoginDatabase::UpdateLogin(const PasswordForm& form, int* items_changed) { |
| 275 std::string encrypted_password; | 285 std::string encrypted_password; |
| 276 if (EncryptedString(form.password_value, &encrypted_password) != | 286 if (EncryptedString(form.password_value, &encrypted_password) != |
| 277 ENCRYPTION_RESULT_SUCCESS) | 287 ENCRYPTION_RESULT_SUCCESS) |
| 278 return false; | 288 return false; |
| 279 | 289 |
| 280 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, | 290 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, |
| 281 "UPDATE logins SET " | 291 "UPDATE logins SET " |
| 282 "action_url = ?, " | 292 "action_url = ?, " |
| 283 "password_value = ?, " | 293 "password_value = ?, " |
| 284 "ssl_valid = ?, " | 294 "ssl_valid = ?, " |
| 285 "preferred = ?, " | 295 "preferred = ?, " |
| 286 "possible_usernames = ?, " | 296 "possible_usernames = ?, " |
| 287 "times_used = ? " | 297 "times_used = ?, " |
| 298 "use_additional_auth = ? " |
| 288 "WHERE origin_url = ? AND " | 299 "WHERE origin_url = ? AND " |
| 289 "username_element = ? AND " | 300 "username_element = ? AND " |
| 290 "username_value = ? AND " | 301 "username_value = ? AND " |
| 291 "password_element = ? AND " | 302 "password_element = ? AND " |
| 292 "signon_realm = ?")); | 303 "signon_realm = ?")); |
| 293 s.BindString(0, form.action.spec()); | 304 s.BindString(0, form.action.spec()); |
| 294 s.BindBlob(1, encrypted_password.data(), | 305 s.BindBlob(1, encrypted_password.data(), |
| 295 static_cast<int>(encrypted_password.length())); | 306 static_cast<int>(encrypted_password.length())); |
| 296 s.BindInt(2, form.ssl_valid); | 307 s.BindInt(2, form.ssl_valid); |
| 297 s.BindInt(3, form.preferred); | 308 s.BindInt(3, form.preferred); |
| 298 Pickle pickle = SerializeVector(form.other_possible_usernames); | 309 Pickle pickle = SerializeVector(form.other_possible_usernames); |
| 299 s.BindBlob(4, pickle.data(), pickle.size()); | 310 s.BindBlob(4, pickle.data(), pickle.size()); |
| 300 s.BindInt(5, form.times_used); | 311 s.BindInt(5, form.times_used); |
| 301 s.BindString(6, form.origin.spec()); | 312 s.BindInt(6, form.use_additional_authentication); |
| 302 s.BindString16(7, form.username_element); | 313 s.BindString(7, form.origin.spec()); |
| 303 s.BindString16(8, form.username_value); | 314 s.BindString16(8, form.username_element); |
| 304 s.BindString16(9, form.password_element); | 315 s.BindString16(9, form.username_value); |
| 305 s.BindString(10, form.signon_realm); | 316 s.BindString16(10, form.password_element); |
| 317 s.BindString(11, form.signon_realm); |
| 306 | 318 |
| 307 if (!s.Run()) | 319 if (!s.Run()) |
| 308 return false; | 320 return false; |
| 309 | 321 |
| 310 if (items_changed) | 322 if (items_changed) |
| 311 *items_changed = db_.GetLastChangeCount(); | 323 *items_changed = db_.GetLastChangeCount(); |
| 312 | 324 |
| 313 return true; | 325 return true; |
| 314 } | 326 } |
| 315 | 327 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 Pickle pickle( | 393 Pickle pickle( |
| 382 static_cast<const char*>(s.ColumnBlob(COLUMN_POSSIBLE_USERNAMES)), | 394 static_cast<const char*>(s.ColumnBlob(COLUMN_POSSIBLE_USERNAMES)), |
| 383 s.ColumnByteLength(COLUMN_POSSIBLE_USERNAMES)); | 395 s.ColumnByteLength(COLUMN_POSSIBLE_USERNAMES)); |
| 384 form->other_possible_usernames = DeserializeVector(pickle); | 396 form->other_possible_usernames = DeserializeVector(pickle); |
| 385 form->times_used = s.ColumnInt(COLUMN_TIMES_USED); | 397 form->times_used = s.ColumnInt(COLUMN_TIMES_USED); |
| 386 Pickle form_data_pickle( | 398 Pickle form_data_pickle( |
| 387 static_cast<const char*>(s.ColumnBlob(COLUMN_FORM_DATA)), | 399 static_cast<const char*>(s.ColumnBlob(COLUMN_FORM_DATA)), |
| 388 s.ColumnByteLength(COLUMN_FORM_DATA)); | 400 s.ColumnByteLength(COLUMN_FORM_DATA)); |
| 389 PickleIterator form_data_iter(form_data_pickle); | 401 PickleIterator form_data_iter(form_data_pickle); |
| 390 autofill::DeserializeFormData(&form_data_iter, &form->form_data); | 402 autofill::DeserializeFormData(&form_data_iter, &form->form_data); |
| 403 form->use_additional_authentication = |
| 404 (s.ColumnInt(COLUMN_USE_ADDITIONAL_AUTH) > 0); |
| 391 return ENCRYPTION_RESULT_SUCCESS; | 405 return ENCRYPTION_RESULT_SUCCESS; |
| 392 } | 406 } |
| 393 | 407 |
| 394 bool LoginDatabase::GetLogins(const PasswordForm& form, | 408 bool LoginDatabase::GetLogins(const PasswordForm& form, |
| 395 std::vector<PasswordForm*>* forms) const { | 409 std::vector<PasswordForm*>* forms) const { |
| 396 DCHECK(forms); | 410 DCHECK(forms); |
| 397 // You *must* change LoginTableColumns if this query changes. | 411 // You *must* change LoginTableColumns if this query changes. |
| 398 const std::string sql_query = "SELECT origin_url, action_url, " | 412 const std::string sql_query = "SELECT origin_url, action_url, " |
| 399 "username_element, username_value, " | 413 "username_element, username_value, " |
| 400 "password_element, password_value, submit_element, " | 414 "password_element, password_value, submit_element, " |
| 401 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " | 415 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " |
| 402 "scheme, password_type, possible_usernames, times_used, form_data " | 416 "scheme, password_type, possible_usernames, times_used, form_data, " |
| 403 "FROM logins WHERE signon_realm == ? "; | 417 "use_additional_auth FROM logins WHERE signon_realm == ? "; |
| 404 sql::Statement s; | 418 sql::Statement s; |
| 405 const GURL signon_realm(form.signon_realm); | 419 const GURL signon_realm(form.signon_realm); |
| 406 std::string registered_domain = | 420 std::string registered_domain = |
| 407 PSLMatchingHelper::GetRegistryControlledDomain(signon_realm); | 421 PSLMatchingHelper::GetRegistryControlledDomain(signon_realm); |
| 408 PSLMatchingHelper::PSLDomainMatchMetric psl_domain_match_metric = | 422 PSLMatchingHelper::PSLDomainMatchMetric psl_domain_match_metric = |
| 409 PSLMatchingHelper::PSL_DOMAIN_MATCH_NONE; | 423 PSLMatchingHelper::PSL_DOMAIN_MATCH_NONE; |
| 410 if (psl_helper_.ShouldPSLDomainMatchingApply(registered_domain)) { | 424 if (psl_helper_.ShouldPSLDomainMatchingApply(registered_domain)) { |
| 411 // We are extending the original SQL query with one that includes more | 425 // We are extending the original SQL query with one that includes more |
| 412 // possible matches based on public suffix domain matching. Using a regexp | 426 // possible matches based on public suffix domain matching. Using a regexp |
| 413 // here is just an optimization to not have to parse all the stored entries | 427 // here is just an optimization to not have to parse all the stored entries |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 bool LoginDatabase::GetLoginsCreatedBetween( | 495 bool LoginDatabase::GetLoginsCreatedBetween( |
| 482 const base::Time begin, | 496 const base::Time begin, |
| 483 const base::Time end, | 497 const base::Time end, |
| 484 std::vector<autofill::PasswordForm*>* forms) const { | 498 std::vector<autofill::PasswordForm*>* forms) const { |
| 485 DCHECK(forms); | 499 DCHECK(forms); |
| 486 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, | 500 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, |
| 487 "SELECT origin_url, action_url, " | 501 "SELECT origin_url, action_url, " |
| 488 "username_element, username_value, " | 502 "username_element, username_value, " |
| 489 "password_element, password_value, submit_element, " | 503 "password_element, password_value, submit_element, " |
| 490 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " | 504 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " |
| 491 "scheme, password_type, possible_usernames, times_used, form_data " | 505 "scheme, password_type, possible_usernames, times_used, form_data, " |
| 492 "FROM logins WHERE date_created >= ? AND date_created < ?" | 506 "use_additional_auth FROM logins " |
| 507 "WHERE date_created >= ? AND date_created < ?" |
| 493 "ORDER BY origin_url")); | 508 "ORDER BY origin_url")); |
| 494 s.BindInt64(0, begin.ToTimeT()); | 509 s.BindInt64(0, begin.ToTimeT()); |
| 495 s.BindInt64(1, end.is_null() ? std::numeric_limits<int64>::max() | 510 s.BindInt64(1, end.is_null() ? std::numeric_limits<int64>::max() |
| 496 : end.ToTimeT()); | 511 : end.ToTimeT()); |
| 497 | 512 |
| 498 while (s.Step()) { | 513 while (s.Step()) { |
| 499 scoped_ptr<PasswordForm> new_form(new PasswordForm()); | 514 scoped_ptr<PasswordForm> new_form(new PasswordForm()); |
| 500 EncryptionResult result = InitPasswordFormFromStatement(new_form.get(), s); | 515 EncryptionResult result = InitPasswordFormFromStatement(new_form.get(), s); |
| 501 if (result == ENCRYPTION_RESULT_SERVICE_FAILURE) | 516 if (result == ENCRYPTION_RESULT_SERVICE_FAILURE) |
| 502 return false; | 517 return false; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 520 | 535 |
| 521 bool LoginDatabase::GetAllLoginsWithBlacklistSetting( | 536 bool LoginDatabase::GetAllLoginsWithBlacklistSetting( |
| 522 bool blacklisted, std::vector<PasswordForm*>* forms) const { | 537 bool blacklisted, std::vector<PasswordForm*>* forms) const { |
| 523 DCHECK(forms); | 538 DCHECK(forms); |
| 524 // You *must* change LoginTableColumns if this query changes. | 539 // You *must* change LoginTableColumns if this query changes. |
| 525 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, | 540 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, |
| 526 "SELECT origin_url, action_url, " | 541 "SELECT origin_url, action_url, " |
| 527 "username_element, username_value, " | 542 "username_element, username_value, " |
| 528 "password_element, password_value, submit_element, " | 543 "password_element, password_value, submit_element, " |
| 529 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " | 544 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " |
| 530 "scheme, password_type, possible_usernames, times_used, form_data " | 545 "scheme, password_type, possible_usernames, times_used, form_data, " |
| 531 "FROM logins WHERE blacklisted_by_user == ? " | 546 "use_additional_auth FROM logins WHERE blacklisted_by_user == ? " |
| 532 "ORDER BY origin_url")); | 547 "ORDER BY origin_url")); |
| 533 s.BindInt(0, blacklisted ? 1 : 0); | 548 s.BindInt(0, blacklisted ? 1 : 0); |
| 534 | 549 |
| 535 while (s.Step()) { | 550 while (s.Step()) { |
| 536 scoped_ptr<PasswordForm> new_form(new PasswordForm()); | 551 scoped_ptr<PasswordForm> new_form(new PasswordForm()); |
| 537 EncryptionResult result = InitPasswordFormFromStatement(new_form.get(), s); | 552 EncryptionResult result = InitPasswordFormFromStatement(new_form.get(), s); |
| 538 if (result == ENCRYPTION_RESULT_SERVICE_FAILURE) | 553 if (result == ENCRYPTION_RESULT_SERVICE_FAILURE) |
| 539 return false; | 554 return false; |
| 540 if (result == ENCRYPTION_RESULT_ITEM_FAILURE) | 555 if (result == ENCRYPTION_RESULT_ITEM_FAILURE) |
| 541 continue; | 556 continue; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 566 const Pickle& p) const { | 581 const Pickle& p) const { |
| 567 std::vector<base::string16> ret; | 582 std::vector<base::string16> ret; |
| 568 base::string16 str; | 583 base::string16 str; |
| 569 | 584 |
| 570 PickleIterator iterator(p); | 585 PickleIterator iterator(p); |
| 571 while (iterator.ReadString16(&str)) { | 586 while (iterator.ReadString16(&str)) { |
| 572 ret.push_back(str); | 587 ret.push_back(str); |
| 573 } | 588 } |
| 574 return ret; | 589 return ret; |
| 575 } | 590 } |
| OLD | NEW |