summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mmap_SA/src/security.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-01-11 15:20:57 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-01-11 15:20:57 +0000
commit4f9f118ed6d053f4bdb530e7412a9229df3d10c4 (patch)
treea2240db3114422759fcae177b830592088ed4103 /plugins/Dbx_mmap_SA/src/security.cpp
parent60ed8dfff0234f4c9c6f0a7b7323e3a3faec2995 (diff)
- database preset file removed (as the atavism & rudiment);
- message about randomly chosen cryptor also removed git-svn-id: http://svn.miranda-ng.org/main/trunk@3057 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mmap_SA/src/security.cpp')
-rw-r--r--plugins/Dbx_mmap_SA/src/security.cpp32
1 files changed, 9 insertions, 23 deletions
diff --git a/plugins/Dbx_mmap_SA/src/security.cpp b/plugins/Dbx_mmap_SA/src/security.cpp
index 9755d55e6a..8b075a37a0 100644
--- a/plugins/Dbx_mmap_SA/src/security.cpp
+++ b/plugins/Dbx_mmap_SA/src/security.cpp
@@ -164,37 +164,23 @@ int CDbxMmapSA::CheckPassword(WORD checkWord, TCHAR *szDBName)
int SelectEncoder()
{
- WORD uid;
- int i;
-
if (arCryptors.getCount() == 0){
MessageBox(0, TranslateT("Crypto modules not found"), TranslateT("Error"), MB_OK | MB_ICONERROR);
return 1;
}
- uid = DBGetContactSettingWord(NULL, "SecureMMAP", "CryptoModule", 0);
-
- if (uid == 0){
- MessageBox(0, TranslateT("Crypto module hasn't been chosen, using first one found"), TranslateT("Notice"), MB_OK | MB_ICONINFORMATION);
- DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", arCryptors[0]->cryptor->uid);
- CryptoEngine = arCryptors[0]->cryptor;
- }
- else{
- int Found = 0;
- for (i = 0; i < arCryptors.getCount(); i++) {
- if (arCryptors[i]->cryptor->uid == uid){
+ WORD uid = db_get_w(NULL, "SecureMMAP", "CryptoModule", 0);
+ if (uid != 0) {
+ for (int i = 0; i < arCryptors.getCount(); i++) {
+ if (arCryptors[i]->cryptor->uid == uid) {
CryptoEngine = arCryptors[i]->cryptor;
- Found = 1;
- break;
+ return 0;
}
}
- if (!Found){
- MessageBox(0, TranslateT("Crypto module hasn't been chosen, using first one found"), TranslateT("Notice"), MB_OK | MB_ICONINFORMATION);
- DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", arCryptors[0]->cryptor->uid);
- CryptoEngine = arCryptors[0]->cryptor;
- }
}
+ db_set_w(NULL, "SecureMMAP", "CryptoModule", arCryptors[0]->cryptor->uid);
+ CryptoEngine = arCryptors[0]->cryptor;
return 0;
}
@@ -319,7 +305,7 @@ void CDbxMmapSA::DecryptDB()
xModifyMenu(hSetPwdMenu, 0, LPGENT("Set Password"), 0);
- DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", 0);
+ db_set_w(NULL, "SecureMMAP", "CryptoModule", 0);
CryptoEngine->FreeKey(key);
@@ -368,7 +354,7 @@ void CDbxMmapSA::ChangePwd()
m_bEncoding = 0;
CryptoEngine = NULL;
- DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", 0);
+ db_set_w(NULL, "SecureMMAP", "CryptoModule", 0);
zero_fill((BYTE *)encryptKey, sizeof encryptKey);