mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 966143 - Don't attempt to process a malformed password record. r=nalexander
This commit is contained in:
parent
a014dcaea3
commit
eea1085ad4
@ -327,6 +327,13 @@ public class PasswordsRepositorySession extends
|
||||
}
|
||||
// End deletion logic.
|
||||
|
||||
// Validate the incoming record.
|
||||
if (!remoteRecord.isValid()) {
|
||||
Logger.warn(LOG_TAG, "Incoming record is invalid. Reporting store failed.");
|
||||
delegate.onRecordStoreFailed(new RuntimeException("Can't store invalid password record."), record.guid);
|
||||
return;
|
||||
}
|
||||
|
||||
// Now we're processing a non-deleted incoming record.
|
||||
if (existingRecord == null) {
|
||||
trace("Looking up match for record " + remoteRecord.guid);
|
||||
|
@ -181,4 +181,25 @@ public class PasswordRecord extends Record {
|
||||
+ "timePasswordChanged: " + this.timePasswordChanged + ", "
|
||||
+ "timesUsed: " + this.timesUsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* A PasswordRecord is considered valid if it abides by the database
|
||||
* constraints of the PasswordsProvider (moz_logins).
|
||||
*
|
||||
* See toolkit/components/passwordmgr/storage-mozStorage.js for the
|
||||
* definitions:
|
||||
*
|
||||
* http://hg.mozilla.org/mozilla-central/file/00955d61cc94/toolkit/components/passwordmgr/storage-mozStorage.js#l98
|
||||
*/
|
||||
public boolean isValid() {
|
||||
if (this.deleted) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.hostname != null &&
|
||||
this.encryptedUsername != null &&
|
||||
this.encryptedPassword != null &&
|
||||
this.usernameField != null &&
|
||||
this.passwordField != null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user