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 /protocols/AimOscar/src/connection.cpp | |
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 'protocols/AimOscar/src/connection.cpp')
-rw-r--r-- | protocols/AimOscar/src/connection.cpp | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index fcff93ef09..d9acb8d542 100644 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -61,22 +61,14 @@ HANDLE CAimProto::aim_peer_connect(unsigned long ip, unsigned short port) void CAimProto::aim_connection_authorization(void)
{
- DBVARIANT dbv;
- char *password = NULL;
-
NETLIBPACKETRECVER packetRecv = {0};
HANDLE hServerPacketRecver = NULL;
if (m_iDesiredStatus == ID_STATUS_OFFLINE)
goto exit;
- if (!getString(AIM_KEY_PW, &dbv))
- {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
- password = mir_strdup(dbv.pszVal);
- db_free(&dbv);
- }
- else
+ char *password = getStringA(AIM_KEY_PW);
+ if (password == NULL)
goto exit;
mir_free(username);
@@ -87,44 +79,37 @@ void CAimProto::aim_connection_authorization(void) hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 2048 * 4);
packetRecv.cbSize = sizeof(packetRecv);
packetRecv.dwTimeout = 5000;
- for (;;)
- {
+ for (;;) {
int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM) hServerPacketRecver, (LPARAM) & packetRecv);
- if (recvResult == 0)
- {
+ if (recvResult == 0) {
debugLogA("Connection Closed: No Error? during Connection Authorization");
break;
}
- else if (recvResult < 0)
- {
+ else if (recvResult < 0) {
debugLogA("Connection Closed: Socket Error during Connection Authorization %d", WSAGetLastError());
break;
}
- else
- {
+ else {
unsigned short flap_length=0;
- for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed=flap_length)
- {
+ for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed = flap_length) {
if (!packetRecv.buffer)
break;
+
FLAP flap((char*)&packetRecv.buffer[packetRecv.bytesUsed],(unsigned short)(packetRecv.bytesAvailable-packetRecv.bytesUsed));
if (!flap.len())
break;
+
flap_length+=FLAP_SIZE+flap.len();
- if (flap.cmp(0x01))
- {
+ if (flap.cmp(0x01)) {
if (aim_send_connection_packet(hServerConn, seqno,flap.val())==0)//cookie challenge
aim_authkey_request(hServerConn, seqno);//md5 authkey request
}
- else if (flap.cmp(0x02))
- {
+ else if (flap.cmp(0x02)) {
SNAC snac(flap.val(),flap.snaclen());
- if (snac.cmp(0x0017))
- {
+ if (snac.cmp(0x0017)) {
snac_md5_authkey(snac,hServerConn,seqno, username, password);
int authres = snac_authorization_reply(snac);
- switch (authres)
- {
+ switch (authres) {
case 1:
mir_free(password);
Netlib_CloseHandle(hServerPacketRecver);
@@ -141,8 +126,7 @@ void CAimProto::aim_connection_authorization(void) }
}
}
- else if (flap.cmp(0x04))
- {
+ else if (flap.cmp(0x04)) {
debugLogA("Connection Authorization Thread Ending: Flap 0x04");
goto exit;
}
|