diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-19 06:03:40 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-19 06:03:40 +0000 |
commit | 7bf0edaf97198eae500070b1694e35b01ed8c6ba (patch) | |
tree | 369bc0f8637bc42185c0306812f0e49071518250 /plugins/NewsAggregator/Src/Utils.cpp | |
parent | 607936ac04647798823b4fdd9e423aab350122c6 (diff) |
added password encoding/decoding
git-svn-id: http://svn.miranda-ng.org/main/trunk@5410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewsAggregator/Src/Utils.cpp')
-rw-r--r-- | plugins/NewsAggregator/Src/Utils.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index 858713f163..21c8e5c037 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -94,10 +94,10 @@ void CreateAuthString(char *auth, HANDLE hContact, HWND hwndDlg) tlogin = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
- if (!db_get_ts(hContact, MODULE, "Password", &dbv)) {
- tpass = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
+ ptrA pwd(db_get_sa(hContact, MODULE, "Password"));
+ if (pwd)
+ CallService(MS_DB_CRYPT_DECODESTRING, strlen(pwd), pwd);
+ tpass = mir_a2t(pwd);
}
else if (hwndDlg && IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
GetDlgItemText(hwndDlg, IDC_LOGIN, buf, SIZEOF(buf));
@@ -158,12 +158,13 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDOK:
{
ItemInfo &SelItem = *(ItemInfo*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- TCHAR str[MAX_PATH], str2[MAX_PATH];
- if (!GetDlgItemText(hwndDlg, IDC_FEEDUSERNAME, str, SIZEOF(str))) {
+ TCHAR username[MAX_PATH];
+ char passw[MAX_PATH];
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDUSERNAME, username, SIZEOF(username))) {
MessageBox(hwndDlg, TranslateT("Enter your username"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_FEEDPASSWORD, str2, SIZEOF(str2))) {
+ if (!GetDlgItemTextA(hwndDlg, IDC_FEEDPASSWORD, passw, SIZEOF(passw))) {
MessageBox(hwndDlg, TranslateT("Enter your password"), TranslateT("Error"), MB_OK);
break;
}
@@ -172,14 +173,15 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CheckDlgButton(SelItem.hwndList, IDC_USEAUTH, BST_CHECKED);
EnableWindow(GetDlgItem(SelItem.hwndList, IDC_LOGIN), TRUE);
EnableWindow(GetDlgItem(SelItem.hwndList, IDC_PASSWORD), TRUE);
- SetDlgItemText(SelItem.hwndList, IDC_LOGIN, str);
- SetDlgItemText(SelItem.hwndList, IDC_PASSWORD, str2);
+ SetDlgItemText(SelItem.hwndList, IDC_LOGIN, username);
+ SetDlgItemTextA(SelItem.hwndList, IDC_PASSWORD, passw);
}
else if (SelItem.hContact)
{
db_set_b(SelItem.hContact, MODULE, "UseAuth", 1);
- db_set_ts(SelItem.hContact, MODULE, "Login", str);
- db_set_ts(SelItem.hContact, MODULE, "Password", str2);
+ db_set_ts(SelItem.hContact, MODULE, "Login", username);
+ CallService(MS_DB_CRYPT_ENCODESTRING, strlen(passw), (LPARAM)&passw);
+ db_set_s(SelItem.hContact, MODULE, "Password", passw);
}
EndDialog(hwndDlg, IDOK);
return TRUE;
|