diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-26 22:19:35 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-26 22:19:35 +0300 |
commit | 6eb0f2f247e91915971be03c63c5c12907898a00 (patch) | |
tree | a23e407049d770bb2bfddd485790ce57b1b3c7af /protocols | |
parent | be77f747e64b695328b1dc529d93846165f8f487 (diff) |
code cleaning
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Icq10/src/http.cpp | 4 | ||||
-rw-r--r-- | protocols/Icq10/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Icq10/src/server.cpp | 5 |
3 files changed, 6 insertions, 5 deletions
diff --git a/protocols/Icq10/src/http.cpp b/protocols/Icq10/src/http.cpp index eb2e07646d..294fbda1e9 100644 --- a/protocols/Icq10/src/http.cpp +++ b/protocols/Icq10/src/http.cpp @@ -27,7 +27,7 @@ void __cdecl CIcqProto::ServerThread(void*) memset(&m_ConnPool, 0, sizeof(m_ConnPool)); m_bTerminated = false; - if (m_dwUin == 0 || mir_strlen(m_szPassword) == 0) { + if (m_dwUin == 0 || mir_wstrlen(m_szPassword) == 0) { debugLogA("Thread ended, UIN/password are not configured"); ConnectionFailed(LOGINERR_BADUSERID); return; @@ -43,7 +43,7 @@ void __cdecl CIcqProto::ServerThread(void*) if (m_szAToken.IsEmpty() || m_szSessionKey.IsEmpty()) { auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_POST, "https://api.login.icq.net/auth/clientLogin", &CIcqProto::OnCheckPassword); pReq << CHAR_PARAM("clientName", "Miranda NG") << CHAR_PARAM("clientVersion", mirVer) << CHAR_PARAM("devId", ICQ_APP_ID) - << CHAR_PARAM("f", "json") << CHAR_PARAM("tokenType", "longTerm") << INT_PARAM("s", m_dwUin) << CHAR_PARAM("pwd", m_szPassword); + << CHAR_PARAM("f", "json") << CHAR_PARAM("tokenType", "longTerm") << INT_PARAM("s", m_dwUin) << WCHAR_PARAM("pwd", m_szPassword); pReq->flags |= NLHRF_NODUMPSEND; Push(pReq); } diff --git a/protocols/Icq10/src/proto.h b/protocols/Icq10/src/proto.h index 9b28adc787..85b78d044d 100644 --- a/protocols/Icq10/src/proto.h +++ b/protocols/Icq10/src/proto.h @@ -187,7 +187,7 @@ public: ~CIcqProto(); CMOption<DWORD> m_dwUin; - CMOption<char*> m_szPassword; + CMOption<wchar_t*> m_szPassword; }; struct CMPlugin : public ACCPROTOPLUGIN<CIcqProto> diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp index 7b154ba4c7..be3e9941dd 100644 --- a/protocols/Icq10/src/server.cpp +++ b/protocols/Icq10/src/server.cpp @@ -136,11 +136,12 @@ void CIcqProto::OnCheckPassword(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) m_szAToken = ptrA(mir_urlDecode(m_szAToken)); setString("AToken", m_szAToken); - CMStringA m_szSessionSecret = data["sessionSecret"].as_mstring(); + CMStringA szSessionSecret = data["sessionSecret"].as_mstring(); + CMStringA szPassTemp = m_szPassword; unsigned int len; BYTE hashOut[MIR_SHA256_HASH_SIZE]; - HMAC(EVP_sha256(), m_szPassword, (int)mir_strlen(m_szPassword), (BYTE*)m_szSessionSecret.c_str(), m_szSessionSecret.GetLength(), hashOut, &len); + HMAC(EVP_sha256(), szPassTemp, szPassTemp.GetLength(), (BYTE*)szSessionSecret.c_str(), szSessionSecret.GetLength(), hashOut, &len); m_szSessionKey = ptrA(mir_base64_encode(hashOut, sizeof(hashOut))); setString("SessionKey", m_szSessionKey); |