From 9000595b551d09cbaf14cbfd7b49aa5aca3d9a90 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 5 Feb 2017 22:03:00 +0300 Subject: proper fix for UINs in auth dialogs --- bin10/lib/mir_app.lib | Bin 103298 -> 103574 bytes bin10/lib/mir_app64.lib | Bin 98670 -> 98950 bytes bin12/lib/mir_app.lib | Bin 103298 -> 103574 bytes bin12/lib/mir_app64.lib | Bin 98670 -> 98950 bytes bin14/lib/mir_app.lib | Bin 103298 -> 103574 bytes bin14/lib/mir_app64.lib | Bin 98670 -> 98950 bytes include/m_database.h | 4 +++- protocols/IcqOscarJ/src/fam_04message.cpp | 2 +- protocols/IcqOscarJ/src/fam_13servclist.cpp | 2 +- src/mir_app/src/db_events.cpp | 4 +++- src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + 12 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib index c2a0c3e080..170a52afca 100644 Binary files a/bin10/lib/mir_app.lib and b/bin10/lib/mir_app.lib differ diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib index c9c6976d56..4725b97a31 100644 Binary files a/bin10/lib/mir_app64.lib and b/bin10/lib/mir_app64.lib differ diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib index c2a0c3e080..170a52afca 100644 Binary files a/bin12/lib/mir_app.lib and b/bin12/lib/mir_app.lib differ diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib index c9c6976d56..4725b97a31 100644 Binary files a/bin12/lib/mir_app64.lib and b/bin12/lib/mir_app64.lib differ diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib index c2a0c3e080..170a52afca 100644 Binary files a/bin14/lib/mir_app.lib and b/bin14/lib/mir_app.lib differ diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib index c9c6976d56..4725b97a31 100644 Binary files a/bin14/lib/mir_app64.lib and b/bin14/lib/mir_app64.lib differ diff --git a/include/m_database.h b/include/m_database.h index 23926eba9b..f4d7b1ea46 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -680,7 +680,9 @@ public: __forceinline const char* get_lastName() const { return m_szLastName; } __forceinline const char* get_email() const { return m_szEmail; } __forceinline const char* get_reason() const { return m_szReason; } - __forceinline DWORD get_uin() const { return m_dwUin; } + + __forceinline DWORD get_uin() const { return m_dwUin; } + __forceinline void set_uin(DWORD dwValue) { m_dwUin = dwValue; } }; #endif // M_DATABASE_H__ diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index a86ee63662..25ed7614d9 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -1628,7 +1628,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, } { DB_AUTH_BLOB blob(hContact, pszMsgField[0], pszMsgField[1], pszMsgField[2], pszMsgField[3], pszMsgField[5]); - *(DWORD*)(PBYTE)blob = dwUin; + blob.set_uin(dwUin); PROTORECVEVENT pre = { 0 }; pre.timestamp = dwTimestamp; diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index 3e7b1004db..4d7e78c0b4 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -1392,7 +1392,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, size_t wLen) szNick = null_strdup(szUid); DB_AUTH_BLOB blob(hContact, szNick, 0, 0, 0, szReason); - *(DWORD*)(PBYTE)blob = dwUin; + blob.set_uin(dwUin); setByte(hContact, "Grant", 1); diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index 24dbeb55a8..dac49009ce 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -265,6 +265,7 @@ MIR_APP_DLL(wchar_t*) DbEvent_GetString(DBEVENTINFO *dbei, const char *str) ///////////////////////////////////////////////////////////////////////////////////////// DB_AUTH_BLOB::DB_AUTH_BLOB(MCONTACT hContact, LPCSTR nick, LPCSTR fname, LPCSTR lname, LPCSTR email, LPCSTR reason) : + m_dwUin(0), m_hContact(hContact), m_szNick(mir_strdup(nick)), m_szFirstName(mir_strdup(fname)), @@ -278,6 +279,7 @@ DB_AUTH_BLOB::DB_AUTH_BLOB(MCONTACT hContact, LPCSTR nick, LPCSTR fname, LPCSTR DB_AUTH_BLOB::DB_AUTH_BLOB(PBYTE blob) { PBYTE pCurBlob = blob; + m_dwUin = *(PDWORD)pCurBlob; pCurBlob += sizeof(DWORD); m_hContact = *(PDWORD)pCurBlob; pCurBlob += sizeof(DWORD); @@ -298,7 +300,7 @@ PBYTE DB_AUTH_BLOB::makeBlob() PBYTE pBlob, pCurBlob; pCurBlob = pBlob = (PBYTE)mir_alloc(m_size + 1); - *((PDWORD)pCurBlob) = 0; + *((PDWORD)pCurBlob) = m_dwUin; pCurBlob += sizeof(DWORD); *((PDWORD)pCurBlob) = (DWORD)m_hContact; pCurBlob += sizeof(DWORD); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 473761ff35..baf17bf743 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -398,3 +398,4 @@ Netlib_NtlmCreateResponse @383 Chat_UnescapeTags @399 NONAME ProtoGetAvatarFormatByMimeType @400 ProtoGetAvatarMimeType @401 +?set_uin@DB_AUTH_BLOB@@QAEXK@Z @402 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 044ee43a95..b60684fb88 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -398,3 +398,4 @@ Netlib_NtlmCreateResponse @383 Chat_UnescapeTags @399 NONAME ProtoGetAvatarFormatByMimeType @400 ProtoGetAvatarMimeType @401 +?set_uin@DB_AUTH_BLOB@@QEAAXK@Z @402 NONAME -- cgit v1.2.3