Fix how address is logged when a wrong password is supplied

- SRP: print the address only once, not twice
- Legacy: previously the address was not printed at all
- Make both messages structurally the same, to facilitate log analyzers
master
Kahrl 2015-10-12 21:25:11 +02:00
parent 7f2cefa093
commit e0b57c1140
1 changed files with 6 additions and 5 deletions

View File

@ -568,8 +568,10 @@ void Server::handleCommand_Init_Legacy(NetworkPacket* pkt)
} }
if (given_password != checkpwd) { if (given_password != checkpwd) {
actionstream << "Server: " << playername << " supplied wrong password" actionstream << "Server: User " << playername
<< std::endl; << " at " << addr_s
<< " supplied wrong password (auth mechanism: legacy)."
<< std::endl;
DenyAccess_Legacy(pkt->getPeerId(), L"Wrong password"); DenyAccess_Legacy(pkt->getPeerId(), L"Wrong password");
return; return;
} }
@ -2062,9 +2064,8 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt)
} else { } else {
actionstream << "Server: User " << client->getName() actionstream << "Server: User " << client->getName()
<< " at " << getPeerAddress(pkt->getPeerId()).serializeString() << " at " << getPeerAddress(pkt->getPeerId()).serializeString()
<< " supplied wrong (SRP) password from address " << " supplied wrong password (auth mechanism: SRP)."
<< getPeerAddress(pkt->getPeerId()).serializeString() << std::endl;
<< "." << std::endl;
DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_WRONG_PASSWORD); DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_WRONG_PASSWORD);
return; return;
} }