Reject packets sent before a connection has been fully established

This commit is contained in:
2022-07-23 02:00:40 +02:00
parent 129d1c2fe3
commit 998b12617e
2 changed files with 35 additions and 4 deletions

View File

@@ -19,6 +19,17 @@ CNLoginServer::CNLoginServer(uint16_t p) {
void CNLoginServer::handlePacket(CNSocket* sock, CNPacketData* data) {
printPacket(data);
if (loginSessions.find(sock) == loginSessions.end() &&
data->type != P_CL2LS_REQ_LOGIN && data->type != P_CL2LS_REP_LIVE_CHECK) {
if (settings::VERBOSITY > 0) {
std::cerr << "OpenFusion: LOGIN PKT OUT-OF-SEQ. PacketType: " <<
Packets::p2str(data->type) << " (" << data->type << ")" << std::endl;
}
return;
}
switch (data->type) {
case P_CL2LS_REQ_LOGIN: {
login(sock, data);