From: <ps...@us...> - 2009-03-07 12:37:45
|
Revision: 1415 http://znc.svn.sourceforge.net/znc/?rev=1415&view=rev Author: psychon Date: 2009-03-07 12:37:38 +0000 (Sat, 07 Mar 2009) Log Message: ----------- Always notify the user when someone else tried to login but was rejected Before this, you only got a message from *status when someone tried to login with a bad password and no auth module (imapauth/saslauth) was loaded. With this patch every failed login will generate a message. Modified Paths: -------------- trunk/Client.cpp trunk/znc.cpp Modified: trunk/Client.cpp =================================================================== --- trunk/Client.cpp 2009-03-07 11:24:34 UTC (rev 1414) +++ trunk/Client.cpp 2009-03-07 12:37:38 UTC (rev 1415) @@ -628,6 +628,16 @@ } void CAuthBase::RefuseLogin(const CString& sReason) { + CUser* pUser = GetUser(GetUsername()); + + // If the username is valid, notify that user that someone tried to + // login. Use sReason because there are other reasons than "wrong + // password" for a login to be rejected (e.g. fail2ban). + if (pUser) { + pUser->PutStatus("Another client attempted to login as you [" + + sReason + "]."); + } + #ifdef _MODULES CZNC::Get().GetModules().OnFailedLogin(GetUsername(), GetRemoteIP()); #endif Modified: trunk/znc.cpp =================================================================== --- trunk/znc.cpp 2009-03-07 11:24:34 UTC (rev 1414) +++ trunk/znc.cpp 2009-03-07 12:37:38 UTC (rev 1415) @@ -1750,10 +1750,6 @@ CUser* pUser = GetUser(AuthClass->GetUsername()); if (!pUser || !pUser->CheckPass(AuthClass->GetPassword())) { - if (pUser) { - pUser->PutStatus("Another client attempted to login as you, with a bad password."); - } - AuthClass->RefuseLogin("Invalid Password"); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |