From a81212e1b4721cbbb369b4512b891caf0c0a8b55 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 8 Feb 2017 18:00:38 -0600 Subject: [PATCH] Allow admin telnet connections from localhost without requiring credentials to world --- world/console.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/world/console.cpp b/world/console.cpp index a933ad56f..5f1598654 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -224,9 +224,27 @@ bool Console::Process() { } //if we have not gotten the special markers after this timer, send login prompt if(prompt_timer.Check()) { + struct in_addr in; + in.s_addr = GetIP(); + + std::string connecting_ip = inet_ntoa(in); + + SendMessage(2, StringFormat("Establishing connection from IP: %s Port: %d", inet_ntoa(in), GetPort()).c_str()); + + if (connecting_ip.find("127.0.0.1") != std::string::npos) { + SendMessage(2, StringFormat("Connecting established from local host, auto assuming admin").c_str()); + state = CONSOLE_STATE_CONNECTED; + tcpc->SetEcho(false); + admin = 255; + SendPrompt(); + } + else { + if (tcpc->GetMode() == EmuTCPConnection::modeConsole) + tcpc->Send((const uchar*) "Username: ", strlen("Username: ")); + } + prompt_timer.Disable(); - if(tcpc->GetMode() == EmuTCPConnection::modeConsole) - tcpc->Send((const uchar*) "Username: ", strlen("Username: ")); + } if (timeout_timer.Check()) {