summaryrefslogtreecommitdiff
authorGiulio Cesare Solaroli <giulio.cesare@clipperz.com>2013-04-26 09:18:23 (UTC)
committer Giulio Cesare Solaroli <giulio.cesare@clipperz.com>2013-04-26 09:18:23 (UTC)
commit108dd23db8fdc9512446be708d2694f3050b1d8f (patch) (side-by-side diff)
treefeff31a273898aa20d13673947457a87024e457e
parent65f064cb6c99dde320d49e6c4157607c25e2d092 (diff)
downloadclipperz-108dd23db8fdc9512446be708d2694f3050b1d8f.zip
clipperz-108dd23db8fdc9512446be708d2694f3050b1d8f.tar.gz
clipperz-108dd23db8fdc9512446be708d2694f3050b1d8f.tar.bz2
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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Header.js4
1 files changed, 3 insertions, 1 deletions
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
@@ -78,13 +78,14 @@ Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, {
'resetUpdatedSections': function() {
this._updatedSections = []
},
'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) {
return (this.hasSectionBeenUpdated(aSectionName)) ? {} : this.jsonEvaledServerData()[aSectionName];
},
@@ -409,12 +410,13 @@ Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, {
data = this.jsonEvaledServerData();
if (typeof(data[aKey]) != 'undefined') {
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.extractDataWithKey 4: "/* + res*/); return res;});
//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;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
deferredResult.addCallback(function(/*anHeader,*/ aKey, aData, aRecordIndex, aValue) {
var result;