diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-19 18:01:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-19 18:01:14 +0000 |
commit | d6e05cc3bca53565d9ca65377ab8b0b6190774b3 (patch) | |
tree | 76040facd4d0b82162069a19cae8f7f024bf1f65 /src | |
parent | 2ef414538760079fa2955fca1a2c03d610459fa8 (diff) |
preparing to the transparent cyphering: end of MS_DB_CRYPT_ENCODESTRING/MS_DB_CRYPT_DECODESTRING
git-svn-id: http://svn.miranda-ng.org/main/trunk@6938 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_core/db.cpp | 2 | ||||
-rw-r--r-- | src/modules/crypt/encrypt.cpp | 29 | ||||
-rw-r--r-- | src/modules/netlib/netlib.cpp | 23 | ||||
-rw-r--r-- | src/modules/netlib/netlibopts.cpp | 5 |
4 files changed, 12 insertions, 47 deletions
diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index 7d6491c1e0..c4305ae33c 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -120,7 +120,7 @@ MIR_CORE_DLL(char*) db_get_sa(HANDLE hContact, const char *szModule, const char db_get_s(hContact, szModule, szSetting, &dbv, DBVT_ASCIIZ);
if (dbv.type == DBVT_ASCIIZ)
str = mir_strdup(dbv.pszVal);
- db_free(&dbv);
+ db_free(&dbv);
return str;
}
diff --git a/src/modules/crypt/encrypt.cpp b/src/modules/crypt/encrypt.cpp index 3e5da905ee..2868eb41c4 100644 --- a/src/modules/crypt/encrypt.cpp +++ b/src/modules/crypt/encrypt.cpp @@ -23,32 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
-//VERY VERY VERY BASIC ENCRYPTION FUNCTION
-
-void Encrypt(char*msg, BOOL up)
-{
- int jump;
- if (up)
- jump = 5;
- else
- jump = -5;
-
- for (int i = 0; msg[i]; i++)
- msg[i] = msg[i] + jump;
-}
-
-static INT_PTR EncodeString(WPARAM wParam, LPARAM lParam)
-{
- Encrypt((char*)lParam, TRUE);
- return 0;
-}
-
-static INT_PTR DecodeString(WPARAM wParam, LPARAM lParam)
-{
- Encrypt((char*)lParam, FALSE);
- return 0;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
static int CompareFunc(const CRYPTO_PROVIDER *p1, const CRYPTO_PROVIDER *p2)
@@ -97,9 +71,6 @@ static INT_PTR srvGetProvider(WPARAM wParam, LPARAM lParam) int InitCrypt(void)
{
- CreateServiceFunction(MS_DB_CRYPT_ENCODESTRING, EncodeString);
- CreateServiceFunction(MS_DB_CRYPT_DECODESTRING, DecodeString);
-
CreateServiceFunction(MS_CRYPTO_REGISTER_ENGINE, srvRegister);
CreateServiceFunction(MS_CRYPTO_ENUM_PROVIDERS, srvEnumProviders);
CreateServiceFunction(MS_CRYPTO_GET_PROVIDER, srvGetProvider);
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index 58cd922864..10c87ad5c0 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -122,16 +122,13 @@ static INT_PTR GetNetlibUserSettingInt(const char *szUserModule, const char *szS return dbv.dVal;
}
-static char *GetNetlibUserSettingString(const char *szUserModule, const char *szSetting, int decode)
+static char *GetNetlibUserSettingString(const char *szUserModule, const char *szSetting)
{
- DBVARIANT dbv;
- if (db_get_s(NULL, szUserModule, szSetting, &dbv) && db_get_s(NULL, "Netlib", szSetting, &dbv))
- return NULL;
+ char *szRet = db_get_sa(NULL, szUserModule, szSetting);
+ if (szRet == NULL)
+ if ((szRet = db_get_sa(NULL, "Netlib", szSetting)) == NULL)
+ return NULL;
- if (decode) CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
- char *szRet = mir_strdup(dbv.pszVal);
- db_free(&dbv);
- if (szRet == NULL) SetLastError(ERROR_OUTOFMEMORY);
return szRet;
}
@@ -186,16 +183,16 @@ static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam) thisUser->settings.useProxy = 0;
thisUser->settings.proxyType = PROXYTYPE_SOCKS5;
}
- thisUser->settings.szProxyServer = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyServer", 0);
+ thisUser->settings.szProxyServer = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyServer");
thisUser->settings.wProxyPort = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLProxyPort", 1080);
thisUser->settings.useProxyAuth = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLUseProxyAuth", 0);
- thisUser->settings.szProxyAuthUser = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyAuthUser", 0);
- thisUser->settings.szProxyAuthPassword = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyAuthPassword", 1);
+ thisUser->settings.szProxyAuthUser = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyAuthUser");
+ thisUser->settings.szProxyAuthPassword = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyAuthPassword");
thisUser->settings.dnsThroughProxy = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLDnsThroughProxy", 1);
thisUser->settings.specifyIncomingPorts = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLSpecifyIncomingPorts", 0);
- thisUser->settings.szIncomingPorts = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLIncomingPorts", 0);
+ thisUser->settings.szIncomingPorts = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLIncomingPorts");
thisUser->settings.specifyOutgoingPorts = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLSpecifyOutgoingPorts", 0);
- thisUser->settings.szOutgoingPorts = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLOutgoingPorts", 0);
+ thisUser->settings.szOutgoingPorts = GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLOutgoingPorts");
thisUser->settings.enableUPnP = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLEnableUPnP", 1); //default to on
thisUser->settings.validateSSL = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLValidateSSL", 0);
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index 1c81da3c41..67a67c5b2a 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -196,7 +196,6 @@ static void ChangeSettingStringByEdit(HWND hwndDlg, UINT ctrlId, int iUser, int static void WriteSettingsStructToDb(const char *szSettingsModule, NETLIBUSERSETTINGS *settings, DWORD flags)
{
if (flags & NUF_OUTGOING) {
- char szEncodedPassword[512];
db_set_b(NULL, szSettingsModule, "NLValidateSSL", (BYTE)settings->validateSSL);
db_set_b(NULL, szSettingsModule, "NLUseProxy", (BYTE)settings->useProxy);
db_set_b(NULL, szSettingsModule, "NLProxyType", (BYTE)settings->proxyType);
@@ -204,9 +203,7 @@ static void WriteSettingsStructToDb(const char *szSettingsModule, NETLIBUSERSETT db_set_w(NULL, szSettingsModule, "NLProxyPort", (WORD)settings->wProxyPort);
db_set_b(NULL, szSettingsModule, "NLUseProxyAuth", (BYTE)settings->useProxyAuth);
db_set_s(NULL, szSettingsModule, "NLProxyAuthUser", settings->szProxyAuthUser?settings->szProxyAuthUser:"");
- lstrcpynA(szEncodedPassword, settings->szProxyAuthPassword?settings->szProxyAuthPassword:"", SIZEOF(szEncodedPassword));
- CallService(MS_DB_CRYPT_ENCODESTRING, SIZEOF(szEncodedPassword), (LPARAM)szEncodedPassword);
- db_set_s(NULL, szSettingsModule, "NLProxyAuthPassword", szEncodedPassword);
+ db_set_s(NULL, szSettingsModule, "NLProxyAuthPassword", settings->szProxyAuthPassword?settings->szProxyAuthPassword:"");
db_set_b(NULL, szSettingsModule, "NLDnsThroughProxy", (BYTE)settings->dnsThroughProxy);
db_set_b(NULL, szSettingsModule, "NLSpecifyOutgoingPorts", (BYTE)settings->specifyOutgoingPorts);
db_set_s(NULL, szSettingsModule, "NLOutgoingPorts", settings->szOutgoingPorts?settings->szOutgoingPorts:"");
|