Require Steam validation before granting admin access (bug 4837, r=asherkin).
This commit is contained in:
parent
d77ebd60cf
commit
ac2bbf16f6
@ -116,6 +116,8 @@ PlayerManager::PlayerManager()
|
|||||||
m_SourceTVUserId = -1;
|
m_SourceTVUserId = -1;
|
||||||
m_ReplayUserId = -1;
|
m_ReplayUserId = -1;
|
||||||
|
|
||||||
|
m_bUseSteamAdminAuth = true; // use steam auth by default
|
||||||
|
|
||||||
m_UserIdLookUp = new int[USHRT_MAX+1];
|
m_UserIdLookUp = new int[USHRT_MAX+1];
|
||||||
memset(m_UserIdLookUp, 0, sizeof(int) * (USHRT_MAX+1));
|
memset(m_UserIdLookUp, 0, sizeof(int) * (USHRT_MAX+1));
|
||||||
}
|
}
|
||||||
@ -229,6 +231,17 @@ ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
|
|||||||
return ConfigResult_Reject;
|
return ConfigResult_Reject;
|
||||||
}
|
}
|
||||||
return ConfigResult_Accept;
|
return ConfigResult_Accept;
|
||||||
|
} else if (strcmp( key, "SteamAuthstringValidation" ) == 0) {
|
||||||
|
if (strcasecmp(value, "yes") == 0)
|
||||||
|
{
|
||||||
|
m_bUseSteamAdminAuth = true;
|
||||||
|
} else if ( strcasecmp(value, "no") == 0) {
|
||||||
|
m_bUseSteamAdminAuth = false;
|
||||||
|
} else {
|
||||||
|
UTIL_Format(error, maxlength, "Invalid value: must be \"yes\" or \"no\"");
|
||||||
|
return ConfigResult_Reject;
|
||||||
|
}
|
||||||
|
return ConfigResult_Accept;
|
||||||
}
|
}
|
||||||
return ConfigResult_Ignore;
|
return ConfigResult_Ignore;
|
||||||
}
|
}
|
||||||
@ -354,6 +367,18 @@ void PlayerManager::RunAuthChecks()
|
|||||||
{
|
{
|
||||||
pPlayer = &m_Players[m_AuthQueue[i]];
|
pPlayer = &m_Players[m_AuthQueue[i]];
|
||||||
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
|
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
// we can only easily check if the client is fully authed if we're on a recent engine
|
||||||
|
if (m_bUseSteamAdminAuth && !g_HL2.IsLANServer())
|
||||||
|
{
|
||||||
|
if (!pPlayer->IsAuthedBySteam())
|
||||||
|
{
|
||||||
|
continue; // we're using steam auth, and steam doesn't know about this player yet so we can't do anything about them for now
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (authstr && authstr[0] != '\0'
|
if (authstr && authstr[0] != '\0'
|
||||||
&& (strcmp(authstr, "STEAM_ID_PENDING") != 0))
|
&& (strcmp(authstr, "STEAM_ID_PENDING") != 0))
|
||||||
{
|
{
|
||||||
@ -1632,6 +1657,13 @@ bool CPlayer::IsAuthorized()
|
|||||||
return m_IsAuthorized;
|
return m_IsAuthorized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
bool CPlayer::IsAuthedBySteam()
|
||||||
|
{
|
||||||
|
return engine->IsClientFullyAuthenticated( m_pEdict );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
IPlayerInfo *CPlayer::GetPlayerInfo()
|
IPlayerInfo *CPlayer::GetPlayerInfo()
|
||||||
{
|
{
|
||||||
if (m_pEdict->GetUnknown())
|
if (m_pEdict->GetUnknown())
|
||||||
|
@ -75,6 +75,9 @@ public:
|
|||||||
bool WasCountedAsInGame();
|
bool WasCountedAsInGame();
|
||||||
bool IsConnected();
|
bool IsConnected();
|
||||||
bool IsAuthorized();
|
bool IsAuthorized();
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
bool IsAuthedBySteam();
|
||||||
|
#endif
|
||||||
bool IsFakeClient();
|
bool IsFakeClient();
|
||||||
bool IsSourceTV() const;
|
bool IsSourceTV() const;
|
||||||
bool IsReplay() const;
|
bool IsReplay() const;
|
||||||
@ -217,6 +220,7 @@ private:
|
|||||||
unsigned int *m_AuthQueue;
|
unsigned int *m_AuthQueue;
|
||||||
String m_PassInfoVar;
|
String m_PassInfoVar;
|
||||||
bool m_QueryLang;
|
bool m_QueryLang;
|
||||||
|
bool m_bUseSteamAdminAuth; // are we validating admins with steam before authorizing?
|
||||||
bool m_bIsListenServer;
|
bool m_bIsListenServer;
|
||||||
int m_ListenClient;
|
int m_ListenClient;
|
||||||
bool m_bIsSourceTVActive;
|
bool m_bIsSourceTVActive;
|
||||||
|
Loading…
Reference in New Issue
Block a user