From 108dd23db8fdc9512446be708d2694f3050b1d8f Mon Sep 17 00:00:00 2001 From: Giulio Cesare Solaroli Date: Fri, 26 Apr 2013 09:18:23 +0000 Subject: Fixed a bug that would "corrupt" header data when upgrading the crypto version used to process an account data The problem being that only part of the header section would be re-encrypted, thus ending up with different sections encrypted using different crypto function versions. And this would break when loading data back on next login. --- diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Header.js b/frontend/beta/js/Clipperz/PM/DataModel/Header.js index 908d9f4..d577830 100644 --- a/frontend/beta/js/Clipperz/PM/DataModel/Header.js +++ b/frontend/beta/js/Clipperz/PM/DataModel/Header.js @@ -81,7 +81,8 @@ Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, { }, 'hasSectionBeenUpdated': function(aSectionName) { - return (this.updatedSections().join().indexOf(aSectionName) != -1); + return (this.updatedSections().join().indexOf(aSectionName) != -1) + || (this.serverDataVersion() != Clipperz.PM.Crypto.encryptingFunctions.currentVersion); }, 'cachedServerDataSection': function(aSectionName) { @@ -412,6 +413,7 @@ Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, { //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_decryptingUserData'); //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 5: "/* + res*/); return res;}); +//deferredResult.addBoth(function(res) {console.log("aKey: " + aKey); return res;}); //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, this.user().passphrase(), data[aKey]['data'], this.serverDataVersion()); //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 6: "/* + res*/); return res;}); -- cgit v0.9.0.2