mirror of
https://github.com/rehlds/reunion.git
synced 2024-12-26 06:15:29 +03:00
Fixed a steamid collision in some cases due to a short authkey length limit 31
This commit is contained in:
parent
feacae5c3d
commit
5fec1febb1
@ -48,13 +48,11 @@ static uint32_t revHash(const char* str)
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RevEmuFinishAuthorization(authdata_t* authdata, const char* authStr, bool stripSpecialChars)
|
void RevEmuFinishAuthorization(authdata_t* authdata, const char* authStr, size_t authKeyMaxLen, bool stripSpecialChars)
|
||||||
{
|
{
|
||||||
size_t authKeyMaxLen = g_ReunionConfig->getAuthVersion() >= av_reunion2018 ? MAX_AUTHKEY_LEN : MAX_AUTHKEY_LEN_OLD;
|
|
||||||
uint32_t volumeId;
|
uint32_t volumeId;
|
||||||
char hddsn[256];
|
char hddsn[256];
|
||||||
|
|
||||||
bool authVolumeId = false;
|
|
||||||
if (IsHddsnNumber(authStr)) {
|
if (IsHddsnNumber(authStr)) {
|
||||||
authdata->authKeyKind = AK_HDDSN;
|
authdata->authKeyKind = AK_HDDSN;
|
||||||
|
|
||||||
@ -77,7 +75,6 @@ void RevEmuFinishAuthorization(authdata_t* authdata, const char* authStr, bool s
|
|||||||
volumeId = strtoul(authStr, nullptr, 10) & 0x7FFFFFFF;
|
volumeId = strtoul(authStr, nullptr, 10) & 0x7FFFFFFF;
|
||||||
authdata->authKeyLen = volumeId ? sizeof(volumeId) : 0; // can't be zero
|
authdata->authKeyLen = volumeId ? sizeof(volumeId) : 0; // can't be zero
|
||||||
authStr = (char *)&volumeId;
|
authStr = (char *)&volumeId;
|
||||||
authVolumeId = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
authdata->authKeyLen = min(strlen(authStr), authKeyMaxLen);
|
authdata->authKeyLen = min(strlen(authStr), authKeyMaxLen);
|
||||||
@ -91,7 +88,7 @@ void RevEmuFinishAuthorization(authdata_t* authdata, const char* authStr, bool s
|
|||||||
|
|
||||||
authdata->steamId = revHash(authdata->authKey) << 1;
|
authdata->steamId = revHash(authdata->authKey) << 1;
|
||||||
|
|
||||||
if (authVolumeId)
|
if (authStr == (char *)&volumeId)
|
||||||
LCPrintf(false, "RevEmu auth key: '%u' steamid: %u\n", (uint32_t)authStr, authdata->steamId);
|
LCPrintf(false, "RevEmu auth key: '%u' steamid: %u\n", (uint32_t)authStr, authdata->steamId);
|
||||||
else
|
else
|
||||||
LCPrintf(false, "RevEmu auth key: '%s' steamid: %u\n", authStr, authdata->steamId);
|
LCPrintf(false, "RevEmu auth key: '%s' steamid: %u\n", authStr, authdata->steamId);
|
||||||
@ -147,7 +144,7 @@ bool RevEmu2009to2013Authorize(ticket_t* ticket, authdata_t* authdata)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RevEmuFinishAuthorization(authdata, DecryptedAuthData, g_ReunionConfig->isSC2009RevEmuCompat() || g_ReunionConfig->getAuthVersion() >= av_reunion2018);
|
RevEmuFinishAuthorization(authdata, DecryptedAuthData, sizeof DecryptedAuthData - 1, g_ReunionConfig->isSC2009RevEmuCompat() || g_ReunionConfig->getAuthVersion() >= av_reunion2018);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -239,7 +236,7 @@ client_auth_kind CRevEmuAuthorizer::authorize(authdata_t* authdata)
|
|||||||
return CA_UNKNOWN;
|
return CA_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
RevEmuFinishAuthorization(authdata, ticket->TicketBuf, g_ReunionConfig->getAuthVersion() >= av_reunion2018);
|
RevEmuFinishAuthorization(authdata, ticket->TicketBuf, sizeof ticket->TicketBuf - 1, g_ReunionConfig->getAuthVersion() >= av_reunion2018);
|
||||||
|
|
||||||
return CA_REVEMU;
|
return CA_REVEMU;
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,8 @@
|
|||||||
#define STEAM_ID_LAN 0
|
#define STEAM_ID_LAN 0
|
||||||
#define STEAM_ID_PENDING 1
|
#define STEAM_ID_PENDING 1
|
||||||
#define MAX_STEAMIDSALTLEN 64
|
#define MAX_STEAMIDSALTLEN 64
|
||||||
#define MAX_AUTHKEY_LEN 31
|
#define MAX_AUTHKEY_LEN 128
|
||||||
#define MAX_AUTHKEY_LEN_OLD 16
|
|
||||||
#define MAX_HASHDATA_LEN (4 + MAX_STEAMIDSALTLEN + MAX_AUTHKEY_LEN)
|
#define MAX_HASHDATA_LEN (4 + MAX_STEAMIDSALTLEN + MAX_AUTHKEY_LEN)
|
||||||
//#define MAX_HASHDATA_LEN_OLD (4 + MAX_STEAMIDSALTLEN + MAX_AUTHKEY_LEN_OLD)
|
|
||||||
#define IPGEN_KEY 0xA95CE2B9
|
#define IPGEN_KEY 0xA95CE2B9
|
||||||
|
|
||||||
#define LOG_PREFIX "[REUNION]: "
|
#define LOG_PREFIX "[REUNION]: "
|
||||||
|
Loading…
Reference in New Issue
Block a user