From c8266aafda211af2bcd277b16f2c35f5d02b33e3 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Thu, 13 Feb 2025 21:22:09 +0000 Subject: [PATCH] Rename new callback, fix build --- include/znc/Modules.h | 6 +++--- modules/modpython/functions.in | 2 +- modules/modpython/module.h | 2 +- modules/modpython/znc.py | 2 +- modules/saslplain.cpp | 4 ++-- src/Client.cpp | 2 +- src/Modules.cpp | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/znc/Modules.h b/include/znc/Modules.h index 41d1c0b2..d773cda9 100644 --- a/include/znc/Modules.h +++ b/include/znc/Modules.h @@ -1364,10 +1364,10 @@ class CModule { virtual void OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState); /** Called when a client requests SASL authentication. Use ssMechanisms.insert("mechanism") - * for announcing sASL mechanisms which your module supports. + * for announcing SASL mechanisms which your module supports. * @param ssMechanisms The set of supported SASL mechanisms to append to. */ - virtual void OnGetSASLMechanisms(SCString& ssMechanisms); + virtual void OnClientGetSASLMechanisms(SCString& ssMechanisms); /** Called when a client has selected a SASL mechanism for SASL authentication. * If implementing a SASL authentication mechanism, set sResponse to specify an initial challenge * message to send to the client. Otherwise, an empty response will be sent. @@ -1694,7 +1694,7 @@ class CModules : public std::vector, private CCoreTranslationMixin { bool IsClientCapSupported(CClient* pClient, const CString& sCap, bool bState); bool OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState); - bool OnGetSASLMechanisms(SCString& ssMechanisms); + bool OnClientGetSASLMechanisms(SCString& ssMechanisms); bool OnSASLServerChallenge(const CString& sMechanism, CString& sResponse); bool OnClientSASLAuthenticate(const CString& sMechanism, diff --git a/modules/modpython/functions.in b/modules/modpython/functions.in index 8333769d..8615f4bf 100644 --- a/modules/modpython/functions.in +++ b/modules/modpython/functions.in @@ -112,7 +112,7 @@ EModRet OnUnknownUserRaw(CClient* pClient, CString& sLine) EModRet OnUnknownUserRawMessage(CMessage& Message) bool IsClientCapSupported(CClient* pClient, const CString& sCap, bool bState) void OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState) -void OnGetSASLMechanisms(SCString& ssMechanisms) +void OnClientGetSASLMechanisms(SCString& ssMechanisms) EModRet OnSASLServerChallenge(const CString& sMechanism, CString& sResponse) EModRet OnClientSASLAuthenticate(const CString& sMechanism, const CString& sBuffer, CString& sUser, CString& sMechanismResponse, bool& bAuthenticationSuccess) EModRet OnModuleLoading(const CString& sModName, const CString& sArgs, CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg) diff --git a/modules/modpython/module.h b/modules/modpython/module.h index f2891e04..54244b53 100644 --- a/modules/modpython/module.h +++ b/modules/modpython/module.h @@ -194,7 +194,7 @@ class ZNC_EXPORT_LIB_EXPORT CPyModule : public CModule { bool bState) override; void OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState) override; - void OnGetSASLMechanisms(SCString& ssMechanisms) override; + void OnClientGetSASLMechanisms(SCString& ssMechanisms) override; EModRet OnSASLServerChallenge(const CString& sMechanism, CString& sResponse) override; EModRet OnClientSASLAuthenticate(const CString& sMechanism, diff --git a/modules/modpython/znc.py b/modules/modpython/znc.py index 69fe3d0d..ca8f3617 100644 --- a/modules/modpython/znc.py +++ b/modules/modpython/znc.py @@ -478,7 +478,7 @@ class Module: def OnClientCapRequest(self, pClient, sCap, bState): pass - def OnGetSASLMechanisms(self, ssMechanisms): + def OnClientGetSASLMechanisms(self, ssMechanisms): pass def OnSASLServerChallenge(self, sMechanism, sResponse): diff --git a/modules/saslplain.cpp b/modules/saslplain.cpp index 264f7643..732038f0 100644 --- a/modules/saslplain.cpp +++ b/modules/saslplain.cpp @@ -41,12 +41,12 @@ class CSASLMechanismPlain : public CModule { return HALTMODS; } - auto spAuth = std::make_shared(this, sAuthcId, sPassword); + auto spAuth = std::make_shared(GetClient(), sAuthcId, sPassword); CZNC::Get().AuthUser(spAuth); return HALTMODS; } - void OnGetSASLMechanisms(SCString& ssMechanisms) override { + void OnClientGetSASLMechanisms(SCString& ssMechanisms) override { ssMechanisms.insert("PLAIN"); } }; diff --git a/src/Client.cpp b/src/Client.cpp index 4206cd7f..f2c1fd5e 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -1210,7 +1210,7 @@ void CClient::OnAuthenticateMessage(CAuthenticateMessage& Message) { CString CClient::EnumerateSASLMechanisms(SCString& ssMechanisms) { CString sMechanisms; - GLOBALMODULECALL(OnGetSASLMechanisms(ssMechanisms), NOTHING); + GLOBALMODULECALL(OnClientGetSASLMechanisms(ssMechanisms), NOTHING); if (ssMechanisms.size()) { sMechanisms = diff --git a/src/Modules.cpp b/src/Modules.cpp index eef2d3ce..8a9b0f2f 100644 --- a/src/Modules.cpp +++ b/src/Modules.cpp @@ -1213,7 +1213,7 @@ CModule::EModRet CModule::OnSASLServerChallenge(const CString& sMechanism, return CONTINUE; } -void CModule::OnGetSASLMechanisms(SCString& ssMechanisms) {} +void CModule::OnClientGetSASLMechanisms(SCString& ssMechanisms) {} CModule::EModRet CModule::OnModuleLoading(const CString& sModName, const CString& sArgs, @@ -1774,8 +1774,8 @@ bool CModules::OnSASLServerChallenge(const CString& sMechanism, MODHALTCHK(OnSASLServerChallenge(sMechanism, sResponse)); } -bool CModules::OnGetSASLMechanisms(SCString& ssMechanisms) { - MODUNLOADCHK(OnGetSASLMechanisms(ssMechanisms)); +bool CModules::OnClientGetSASLMechanisms(SCString& ssMechanisms) { + MODUNLOADCHK(OnClientGetSASLMechanisms(ssMechanisms)); return false; }