mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-06-18 23:40:54 +00:00
TNetwork: Fix crash when auth response is not a JSON object
This commit is contained in:
+18
-17
@@ -295,23 +295,24 @@ void TNetwork::Authentication(SOCKET TCPSock) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AuthResponse.IsObject() && Rc != "0") {
|
if (!AuthResponse.IsObject()) {
|
||||||
ClientKick(*Client, "Backend returned invalid auth response format.");
|
if (Rc == "0") {
|
||||||
error("Backend returned invalid auth response format. This should never happen.");
|
auto Lock = Sentry.CreateExclusiveContext();
|
||||||
auto Lock = Sentry.CreateExclusiveContext();
|
Sentry.SetContext("auth",
|
||||||
Sentry.SetContext("auth",
|
{ { "response-body", Rc },
|
||||||
{ { "response-body", Rc },
|
{ "key", RequestString } });
|
||||||
{ "key", RequestString } });
|
Sentry.SetTransaction(Application::GetBackendUrlForAuth() + Target);
|
||||||
Sentry.SetTransaction(Application::GetBackendUrlForAuth() + Target);
|
Sentry.Log(SentryLevel::Info, "default", "backend returned 0 instead of json (" + std::to_string(ResponseCode) + ")");
|
||||||
Sentry.Log(SentryLevel::Error, "default", "unexpected backend response (" + std::to_string(ResponseCode) + ")");
|
} else { // Rc != "0"
|
||||||
return;
|
ClientKick(*Client, "Backend returned invalid auth response format.");
|
||||||
} else if (Rc == "0") {
|
error("Backend returned invalid auth response format. This should never happen.");
|
||||||
auto Lock = Sentry.CreateExclusiveContext();
|
auto Lock = Sentry.CreateExclusiveContext();
|
||||||
Sentry.SetContext("auth",
|
Sentry.SetContext("auth",
|
||||||
{ { "response-body", Rc },
|
{ { "response-body", Rc },
|
||||||
{ "key", RequestString } });
|
{ "key", RequestString } });
|
||||||
Sentry.SetTransaction(Application::GetBackendUrlForAuth() + Target);
|
Sentry.SetTransaction(Application::GetBackendUrlForAuth() + Target);
|
||||||
Sentry.Log(SentryLevel::Info, "default", "backend returned 0 instead of json (" + std::to_string(ResponseCode) + ")");
|
Sentry.Log(SentryLevel::Error, "default", "unexpected backend response (" + std::to_string(ResponseCode) + ")");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user