diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-24 17:27:34 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-24 17:27:34 +0000 |
commit | 5b6f2daa070dff9998af4259daa3926cb70bb817 (patch) | |
tree | daf84f3668e9de0dd2b29d60859d596475b29064 /protocols/MSN/src/msn_auth.cpp | |
parent | 26c78a6a63f3fd7bc2f3179df04615ebbd49eb8f (diff) |
- custom UrlEncode replaced with the core function;
- fix for opening Hotmail Inbox in a browser;
- end of strange buffers;
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@6976 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN/src/msn_auth.cpp')
-rw-r--r-- | protocols/MSN/src/msn_auth.cpp | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index e69972e28a..172c74cab9 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -439,7 +439,7 @@ char* CMsnProto::GenerateLoginBlob(char* challenge) }
-char* CMsnProto::HotmailLogin(const char* url)
+CMStringA CMsnProto::HotmailLogin(const char* url)
{
unsigned char nonce[24];
CallService(MS_UTILS_GETRANDOM, sizeof(nonce), (LPARAM)nonce);
@@ -458,29 +458,17 @@ char* CMsnProto::HotmailLogin(const char* url) unsigned char key2[MIR_SHA1_HASH_SIZE+4];
derive_key(key2, key1, key1len, data1, data1len);
- const size_t xmlenclen = 3 * strlen(hotAuthToken) + 1;
- char* xmlenc = (char*)alloca(xmlenclen);
- UrlEncode(hotAuthToken, xmlenc, xmlenclen);
+ CMStringA result;
+ result.Format("%s&da=%s&nonce=", url, ptrA(mir_urlEncode(hotAuthToken)));
- ptrA noncenc( mir_base64_encode(nonce, sizeof(nonce)));
- size_t noncenclen = lstrlenA(noncenc);
-
- const size_t fnpstlen = strlen(xmlenc) + strlen(url) + 3*noncenclen + 100;
- char* fnpst = (char*)mir_alloc(fnpstlen);
-
- size_t sz = mir_snprintf(fnpst, fnpstlen, "%s&da=%s&nonce=", url, xmlenc);
-
- UrlEncode(noncenc, fnpst + sz, fnpstlen - sz);
- sz = strlen(fnpst);
+ ptrA noncenc(mir_base64_encode(nonce, sizeof(nonce)));
+ result.Append(ptrA(mir_urlEncode(noncenc)));
BYTE hash[MIR_SHA1_HASH_SIZE];
- mir_hmac_sha1(hash, key2, sizeof(key2), (BYTE*)fnpst, sz);
-
- noncenc = mir_base64_encode(hash, sizeof(hash));
-
- sz += mir_snprintf(fnpst + sz, fnpstlen - sz, "&hash=");
- UrlEncode(noncenc, fnpst + sz, fnpstlen - sz);
- return fnpst;
+ mir_hmac_sha1(hash, key2, sizeof(key2), (BYTE*)result.GetString(), result.GetLength());
+ ptrA szHash(mir_base64_encode(hash, sizeof(hash)));
+ result.AppendFormat("&hash=%s", ptrA(mir_urlEncode(szHash)));
+ return result;
}
void CMsnProto::FreeAuthTokens(void)
|