From d6e05cc3bca53565d9ca65377ab8b0b6190774b3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 19 Nov 2013 18:01:14 +0000 Subject: 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 --- src/modules/netlib/netlib.cpp | 23 ++++++++++------------- src/modules/netlib/netlibopts.cpp | 5 +---- 2 files changed, 11 insertions(+), 17 deletions(-) (limited to 'src/modules/netlib') 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:""); -- cgit v1.2.3