From 08dc0f0af530f082093315d61ecb2377a410e88c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 1 Jan 2014 17:52:05 +0000 Subject: fix against buggy key generators in early 0.94.7 builds git-svn-id: http://svn.miranda-ng.org/main/trunk@7446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/src/dbcrypt.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 96981fb8f0..7aa8a0c046 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -161,14 +161,18 @@ LBL_SetNewKey: if (dbv.cpbVal != (WORD)iKeyLength) goto LBL_SetNewKey; - if (!m_crypto->setKey(dbv.pbVal, iKeyLength)) - if (!EnterPassword(dbv.pbVal, iKeyLength)) { // password protected? - if (m_dbHeader.version == DB_THIS_VERSION) - return 4; + if (!m_crypto->setKey(dbv.pbVal, iKeyLength)) { + if (!m_bEncrypted) + goto LBL_SetNewKey; - // one of the early used version of mmap was replaced then by mmap_sa - // simply remove old badly generated key - goto LBL_SetNewKey; + 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); -- cgit v1.2.3