From 1c3edbaaaa29bf0dac7629fc61b136654a693a70 Mon Sep 17 00:00:00 2001 From: Kai Philipp Date: Sun, 19 Jun 2016 17:35:11 +0200 Subject: [PATCH] limit guest logins - temporary simulation of guest logins for testing purposes --- src/net/common/serverlobbythread.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 5ad45628..d3b54b13 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -1053,9 +1053,17 @@ ServerLobbyThread::HandleNetPacketInit(boost::shared_ptr session, c MD5Buf avatarMD5; bool noAuth = false; bool validGuest = false; - if (initMessage.login() == InitMessage::guestLogin) { + // @XXX: debug: unauthenticatedLogin - that is standard for dedicated server without auth! + // if (initMessage.login() == InitMessage::unauthenticatedLogin) { + // @XXX: productive + // if (initMessage.login() == InitMessage::guestLogin) { + if (initMessage.login() == InitMessage::unauthenticatedLogin) { playerName = initMessage.nickname(); + // @XXX: debug + LOG_ERROR("Guest " << playerName << " trys to connect."); // Verify guest player name. + // @XXX: debug - accept every playername - e.g. if(true){ + /* if (playerName.length() > sizeof(SERVER_GUEST_PLAYER_NAME - 1) && playerName.substr(0, sizeof(SERVER_GUEST_PLAYER_NAME) - 1) == SERVER_GUEST_PLAYER_NAME) { string guestId(playerName.substr(sizeof(SERVER_GUEST_PLAYER_NAME))); @@ -1063,10 +1071,15 @@ ServerLobbyThread::HandleNetPacketInit(boost::shared_ptr session, c validGuest = true; noAuth = true; } + */ + validGuest = true; // needed for guest login simulation + noAuth = true; // needed for guest login simulation + if(true){ // @XXX: check if a guest session with same ip is already connected - decline if true if(m_sessionManager.IsGuestConnectedMultiple(session->GetClientAddr())){ //LOG_ERROR("Guest with IP " << session->GetClientAddr() << " already connected! Decline!"); - validGuest = false; + SessionError(session, ERR_NET_PLAYER_BANNED); + return; } } if (!validGuest) {