From 31feec2c9ff19ebdbb89c258e019518068e9c502 Mon Sep 17 00:00:00 2001 From: psychon Date: Mon, 7 Jul 2008 18:35:41 +0000 Subject: [PATCH] Use CZNC::Auth() to authenticate IRC clients git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1115 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 31 ++----------------------------- Client.h | 2 -- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/Client.cpp b/Client.cpp index bf6dfb81..d269e414 100644 --- a/Client.cpp +++ b/Client.cpp @@ -1825,27 +1825,7 @@ void CClient::AuthUser() { m_spAuth = new CClientAuth(this, m_sUser, m_sPass); - CClientAuth::AuthUser(m_spAuth); -} - -void CAuthBase::AuthUser(CSmartPtr 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()); diff --git a/Client.h b/Client.h index a8da5149..24b247cf 100644 --- a/Client.h +++ b/Client.h @@ -43,8 +43,6 @@ public: virtual const CString& GetPassword() const { return m_sPassword; } virtual const CString& GetRemoteIP() const { return m_sRemoteIP; } - static void AuthUser(CSmartPtr AuthClass); - private: CString m_sUsername; CString m_sPassword;