From 40fc2d00a511c66a4c71a5df2439898152e415af Mon Sep 17 00:00:00 2001 From: Splatt581 <31417200+Splatt581@users.noreply.github.com> Date: Mon, 13 May 2024 14:10:52 +0300 Subject: [PATCH 1/8] Update sv_steam3.cpp --- rehlds/engine/sv_steam3.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rehlds/engine/sv_steam3.cpp b/rehlds/engine/sv_steam3.cpp index c35b2934..a5df416f 100644 --- a/rehlds/engine/sv_steam3.cpp +++ b/rehlds/engine/sv_steam3.cpp @@ -156,7 +156,9 @@ void CSteam3Server::OnGSClientDenyHelper(client_t *cl, EDenyReason eDenyReason, break; case k_EDenySteamValidationStalled: - if (m_bLanOnly) + if (!m_bLanOnly) + SV_DropClient(cl, 0, "STEAM verification failed"); + else cl->network_userid.m_SteamID = 1; break; From 073b7c4e503a909e66eca085aae842f6d1dcda78 Mon Sep 17 00:00:00 2001 From: Splatt581 <31417200+Splatt581@users.noreply.github.com> Date: Mon, 13 May 2024 14:12:03 +0300 Subject: [PATCH 2/8] Update userid_rehlds.h --- rehlds/public/rehlds/userid_rehlds.h | 1 + 1 file changed, 1 insertion(+) diff --git a/rehlds/public/rehlds/userid_rehlds.h b/rehlds/public/rehlds/userid_rehlds.h index 6a222214..707229af 100644 --- a/rehlds/public/rehlds/userid_rehlds.h +++ b/rehlds/public/rehlds/userid_rehlds.h @@ -42,5 +42,6 @@ typedef struct USERID_s { int idtype; uint64 m_SteamID; + uint64 m_SteamIDValidated; unsigned int clientip; } USERID_t; From 2455cbe3437bf20777854d0383038996d863edfc Mon Sep 17 00:00:00 2001 From: Splatt581 <31417200+Splatt581@users.noreply.github.com> Date: Mon, 13 May 2024 14:13:01 +0300 Subject: [PATCH 3/8] Update structSizeCheck.cpp --- rehlds/rehlds/structSizeCheck.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rehlds/rehlds/structSizeCheck.cpp b/rehlds/rehlds/structSizeCheck.cpp index 259787c3..a26eadb9 100644 --- a/rehlds/rehlds/structSizeCheck.cpp +++ b/rehlds/rehlds/structSizeCheck.cpp @@ -13,8 +13,8 @@ void check_size() { void checkSizesStatic() { - CHECK_TYPE_SIZE(client_t, 0x5018, 0x4EF4); - CHECK_TYPE_SIZE(userfilter_t, 0x20, 0x18); + CHECK_TYPE_SIZE(client_t, 0x5020, 0x4EFC); + CHECK_TYPE_SIZE(userfilter_t, 0x28, 0x20); #ifndef REHLDS_FIXES CHECK_TYPE_SIZE(CSteam3Server, 0x90, 0xA8); #endif From 8a1b1fdb58b902271ac291b482e5931cff0650a5 Mon Sep 17 00:00:00 2001 From: Splatt581 <31417200+Splatt581@users.noreply.github.com> Date: Mon, 13 May 2024 14:16:55 +0300 Subject: [PATCH 4/8] Update sv_steam3.cpp --- rehlds/engine/sv_steam3.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rehlds/engine/sv_steam3.cpp b/rehlds/engine/sv_steam3.cpp index a5df416f..e0db3517 100644 --- a/rehlds/engine/sv_steam3.cpp +++ b/rehlds/engine/sv_steam3.cpp @@ -174,6 +174,12 @@ void CSteam3Server::OnGSClientApprove(GSClientApprove_t *pGSClientSteam2Accept) if (!cl) return; + cl->network_userid.m_SteamIDValidated = pGSClientSteam2Accept->m_SteamID.ConvertToUint64(); + host_client->network_userid.m_SteamIDValidated = pGSClientSteam2Accept->m_SteamID.ConvertToUint64(); + + Info_SetValueForStarKey(cl->userinfo, "*sid", va("%lld", cl->network_userid.m_SteamIDValidated), MAX_INFO_STRING); + Info_SetValueForStarKey(host_client->userinfo, "*sid", va("%lld", host_client->network_userid.m_SteamIDValidated), MAX_INFO_STRING); + if (SV_FilterUser(&cl->network_userid)) { char msg[256]; From 9e2ce4714f6adb39fa2c56ec81e19fb821280546 Mon Sep 17 00:00:00 2001 From: Splatt581 <31417200+Splatt581@users.noreply.github.com> Date: Mon, 13 May 2024 14:19:10 +0300 Subject: [PATCH 5/8] Update sv_main.cpp --- rehlds/engine/sv_main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index c015f49a..d557385e 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -8411,13 +8411,13 @@ char* EXT_FUNC SV_GetIDString_internal(USERID_t *id) { Q_strncpy(idstr, "STEAM_ID_LAN", ARRAYSIZE(idstr) - 1); } - else if (!id->m_SteamID) + else if (!id->m_SteamIDValidated) { Q_strncpy(idstr, "STEAM_ID_PENDING", ARRAYSIZE(idstr) - 1); } else { - TSteamGlobalUserID steam2ID = Steam_Steam3IDtoSteam2(id->m_SteamID); + TSteamGlobalUserID steam2ID = Steam_Steam3IDtoSteam2(id->m_SteamIDValidated); Q_snprintf(idstr, ARRAYSIZE(idstr) - 1, "STEAM_%u:%u:%u", steam2ID.m_SteamInstanceID, steam2ID.m_SteamLocalUserID.Split.High32bits, steam2ID.m_SteamLocalUserID.Split.Low32bits); } break; @@ -8426,13 +8426,13 @@ char* EXT_FUNC SV_GetIDString_internal(USERID_t *id) { Q_strncpy(idstr, "VALVE_ID_LAN", ARRAYSIZE(idstr) - 1); } - else if (!id->m_SteamID) + else if (!id->m_SteamIDValidated) { Q_strncpy(idstr, "VALVE_ID_PENDING", ARRAYSIZE(idstr) - 1); } else { - TSteamGlobalUserID steam2ID = Steam_Steam3IDtoSteam2(id->m_SteamID); + TSteamGlobalUserID steam2ID = Steam_Steam3IDtoSteam2(id->m_SteamIDValidated); Q_snprintf(idstr, ARRAYSIZE(idstr) - 1, "VALVE_%u:%u:%u", steam2ID.m_SteamInstanceID, steam2ID.m_SteamLocalUserID.Split.High32bits, steam2ID.m_SteamLocalUserID.Split.Low32bits); } break; From 5e4e8ef250b7886dbcded246c04d8398192c600d Mon Sep 17 00:00:00 2001 From: Splatt581 <31417200+Splatt581@users.noreply.github.com> Date: Mon, 13 May 2024 14:20:15 +0300 Subject: [PATCH 6/8] Update sv_main.cpp --- rehlds/engine/sv_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index d557385e..a7029073 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -2539,7 +2539,7 @@ void EXT_FUNC SV_ConnectClient_internal(void) host_client->userinfo[MAX_INFO_STRING - 1] = 0; SV_ExtractFromUserinfo(host_client); - Info_SetValueForStarKey(host_client->userinfo, "*sid", va("%lld", host_client->network_userid.m_SteamID), MAX_INFO_STRING); + Info_SetValueForStarKey(host_client->userinfo, "*sid", va("%lld", host_client->network_userid.m_SteamIDValidated), MAX_INFO_STRING); host_client->datagram.flags = SIZEBUF_ALLOW_OVERFLOW; host_client->datagram.data = (byte *)host_client->datagram_buf; From 5ecf4c3207aa84e7db317d7187ac0702f77b17b5 Mon Sep 17 00:00:00 2001 From: Splatt581 <31417200+Splatt581@users.noreply.github.com> Date: Mon, 13 May 2024 14:22:34 +0300 Subject: [PATCH 7/8] Update host.cpp --- rehlds/engine/host.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rehlds/engine/host.cpp b/rehlds/engine/host.cpp index 673b3297..e2ae4510 100644 --- a/rehlds/engine/host.cpp +++ b/rehlds/engine/host.cpp @@ -475,6 +475,9 @@ void SV_DropClient_internal(client_t *cl, qboolean crash, const char *string) if (!cl->fakeclient) Netchan_Transmit(&cl->netchan, i, final); + + cl->network_userid.m_SteamIDValidated = 0; + host_client->network_userid.m_SteamIDValidated = 0; } connection_time = realtime - cl->netchan.connect_time; From 1491ffe423a49ee6c46f446757404fdb3b87cc83 Mon Sep 17 00:00:00 2001 From: Splatt581 <31417200+Splatt581@users.noreply.github.com> Date: Mon, 13 May 2024 14:50:59 +0300 Subject: [PATCH 8/8] Update struct_offsets_tests.cpp --- rehlds/unittests/struct_offsets_tests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rehlds/unittests/struct_offsets_tests.cpp b/rehlds/unittests/struct_offsets_tests.cpp index 8e95371c..ac94e980 100644 --- a/rehlds/unittests/struct_offsets_tests.cpp +++ b/rehlds/unittests/struct_offsets_tests.cpp @@ -23,8 +23,8 @@ TEST(StructOffsets, ReversingChecks, 5000) CHECK_STRUCT_OFFSET(client_t, active, 0, 0); CHECK_STRUCT_OFFSET(client_t, chokecount, 0x2540, 0x2430); CHECK_STRUCT_OFFSET(client_t, datagram, 0x25C0, 0x24AC); - CHECK_STRUCT_OFFSET(client_t, m_VoiceStreams, 0x5000, 0x4EE0); - CHECK_STRUCT_OFFSET(client_t, m_lastvoicetime, 0x5008, 0x4EE8); + CHECK_STRUCT_OFFSET(client_t, m_VoiceStreams, 0x5008, 0x4EE8); + CHECK_STRUCT_OFFSET(client_t, m_lastvoicetime, 0x5010, 0x4EF0); CHECK_STRUCT_OFFSET(client_t, datagram_buf, 0x25D4, 0x24C0); CHECK_STRUCT_OFFSET(client_t, connection_started, 0x3578, 0x3460);