diff options
author | George Hazan <george.hazan@gmail.com> | 2013-12-05 21:09:54 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-12-05 21:09:54 +0000 |
commit | 3f4bfef9370e7ec778e501f4608d3c4fe0b3b255 (patch) | |
tree | bd9909d80ccfc52654dc201d965df35d16bfb846 /plugins/Db3x_mmap/src/dbcrypt.cpp | |
parent | c694daeb12c2ee641e539c89e721af27d6526948 (diff) |
fix for setting password online
git-svn-id: http://svn.miranda-ng.org/main/trunk@7060 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/dbcrypt.cpp')
-rw-r--r-- | plugins/Db3x_mmap/src/dbcrypt.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index e6bb7e704b..4193316d17 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -161,11 +161,9 @@ LBL_SetNewKey: if (dbv.cpbVal != (WORD)iKeyLength)
goto LBL_SetNewKey;
- if (!m_crypto->setKey(dbv.pbVal, iKeyLength)) {
+ if (!m_crypto->setKey(dbv.pbVal, iKeyLength))
if (!EnterPassword(dbv.pbVal, iKeyLength)) // password protected?
return 4;
- m_bUsesPassword = true;
- }
FreeVariant(&dbv);
}
@@ -198,3 +196,15 @@ void CDb3Mmap::StoreKey() SecureZeroMemory(pKey, iKeyLength);
}
+
+void CDb3Mmap::SetPassword(LPCTSTR ptszPassword)
+{
+ if (ptszPassword == NULL || *ptszPassword == 0) {
+ m_bUsesPassword = false;
+ m_crypto->setPassword(NULL);
+ }
+ else {
+ m_bUsesPassword = true;
+ m_crypto->setPassword(ptrA(mir_utf8encodeT(ptszPassword)));
+ }
+}
|