Allow admin telnet connections from localhost without requiring credentials to world

This commit is contained in:
Akkadius 2017-02-08 18:00:38 -06:00
parent 57d75572b2
commit a81212e1b4

View File

@ -224,11 +224,29 @@ bool Console::Process() {
} }
//if we have not gotten the special markers after this timer, send login prompt //if we have not gotten the special markers after this timer, send login prompt
if(prompt_timer.Check()) { if(prompt_timer.Check()) {
prompt_timer.Disable(); struct in_addr in;
if(tcpc->GetMode() == EmuTCPConnection::modeConsole) 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: ")); tcpc->Send((const uchar*) "Username: ", strlen("Username: "));
} }
prompt_timer.Disable();
}
if (timeout_timer.Check()) { if (timeout_timer.Check()) {
SendMessage(1, 0); SendMessage(1, 0);
SendMessage(1, "Timeout, disconnecting..."); SendMessage(1, "Timeout, disconnecting...");