summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src/dbcrypt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Db3x_mmap/src/dbcrypt.cpp')
-rw-r--r--plugins/Db3x_mmap/src/dbcrypt.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp
index 7b384cedfe..f181f53cd2 100644
--- a/plugins/Db3x_mmap/src/dbcrypt.cpp
+++ b/plugins/Db3x_mmap/src/dbcrypt.cpp
@@ -162,9 +162,15 @@ LBL_SetNewKey:
goto LBL_SetNewKey;
if (!m_crypto->setKey(dbv.pbVal, iKeyLength))
- if (!EnterPassword(dbv.pbVal, iKeyLength)) // password protected?
+ if (!EnterPassword(dbv.pbVal, iKeyLength)) { // password protected?
+ if (m_dbHeader.version == DB_THIS_VERSION)
return 4;
+ // one of the early used version of mmap was replaced then by mmap_sa
+ // simply remove old badly generated key
+ goto LBL_SetNewKey;
+ }
+
FreeVariant(&dbv);
}
@@ -178,6 +184,11 @@ LBL_SetNewKey:
DBWrite(0, &dbSignatureU, sizeof(dbSignatureU));
}
+ if (m_dbHeader.version == DB_OLD_VERSION) {
+ m_dbHeader.version = DB_THIS_VERSION;
+ DBWrite(sizeof(dbSignatureU), &m_dbHeader.version, sizeof(m_dbHeader.version));
+ }
+
InitDialogs();
return 0;
}