Use CZNC::Auth() to authenticate IRC clients

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1115 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-07-07 18:35:41 +00:00
parent 0bd4927d2c
commit 31feec2c9f
2 changed files with 2 additions and 31 deletions

View File

@@ -1825,27 +1825,7 @@ void CClient::AuthUser() {
m_spAuth = new CClientAuth(this, m_sUser, m_sPass);
CClientAuth::AuthUser(m_spAuth);
}
void CAuthBase::AuthUser(CSmartPtr<CAuthBase> AuthClass) {
#ifdef _MODULES
if (CZNC::Get().GetModules().OnLoginAttempt(AuthClass)) {
return;
}
#endif
CUser* pUser = CZNC::Get().GetUser(AuthClass->GetUsername());
if (pUser && pUser->CheckPass(AuthClass->GetPassword())) {
AuthClass->AcceptLogin(*pUser);
} else {
if (pUser) {
pUser->PutStatus("Another client attempted to login as you, with a bad password.");
}
AuthClass->RefuseLogin("Invalid Password");
}
CZNC::Get().AuthUser(m_spAuth);
}
CClientAuth::CClientAuth(CClient* pClient, const CString& sUsername, const CString& sPassword)
@@ -1858,7 +1838,7 @@ void CClientAuth::RefuseLogin(const CString& sReason) {
m_pClient->RefuseLogin(sReason);
}
#ifdef _MODULES
CZNC::Get().GetModules().OnFailedLogin(GetUsername(), ((m_pClient) ? m_pClient->GetRemoteIP() : CString("")));
CZNC::Get().GetModules().OnFailedLogin(GetUsername(), GetRemoteIP());
#endif
}
@@ -1888,13 +1868,6 @@ void CClient::AcceptLogin(CUser& User) {
m_pTimeout = NULL;
}
if (!m_pUser->IsHostAllowed(GetRemoteIP())) {
PutClient(":irc.znc.com 463 " + GetNick() + " :Your host ("
+ GetRemoteIP() + ") is not allowed");
Close();
return;
}
SetSockName("USR::" + m_pUser->GetUserName());
m_pIRCSock = (CIRCSock*) CZNC::Get().FindSockByName("IRC::" + m_pUser->GetUserName());