diff --git a/include/znc/IRCNetwork.h b/include/znc/IRCNetwork.h index 77ddec1c..d5016af4 100644 --- a/include/znc/IRCNetwork.h +++ b/include/znc/IRCNetwork.h @@ -127,6 +127,7 @@ public: const SCString& GetTrustedFingerprints() const { return m_ssTrustedFingerprints; } void AddTrustedFingerprint(const CString& sFP) { m_ssTrustedFingerprints.insert(sFP.Escape_n(CString::EHEXCOLON, CString::EHEXCOLON)); } void DelTrustedFingerprint(const CString& sFP) { m_ssTrustedFingerprints.erase(sFP); } + void ClearTrustedFingerprints() { m_ssTrustedFingerprints.clear(); } void SetIRCConnectEnabled(bool b); bool GetIRCConnectEnabled() const { return m_bIRCConnectEnabled; } diff --git a/include/znc/User.h b/include/znc/User.h index de7b7a5b..84018e45 100644 --- a/include/znc/User.h +++ b/include/znc/User.h @@ -63,6 +63,8 @@ public: CConfig ToConfig() const; bool CheckPass(const CString& sPass) const; bool AddAllowedHost(const CString& sHostMask); + bool RemAllowedHost(const CString& sHostMask); + void ClearAllowedHosts(); bool IsHostAllowed(const CString& sHostMask) const; bool IsValid(CString& sErrMsg, bool bSkipPass = false) const; static bool IsValidUserName(const CString& sUserName); diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index 8bd3043f..dc1a6170 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -1049,9 +1049,7 @@ public: } WebSock.GetRawParam("fingerprints").Split("\n", vsArgs); - while (!pNetwork->GetTrustedFingerprints().empty()) { - pNetwork->DelTrustedFingerprint(*pNetwork->GetTrustedFingerprints().begin()); - } + pNetwork->ClearTrustedFingerprints(); for (const CString& sFP : vsArgs) { pNetwork->AddTrustedFingerprint(sFP); } diff --git a/src/User.cpp b/src/User.cpp index b1e2b9d9..f3b5b91a 100644 --- a/src/User.cpp +++ b/src/User.cpp @@ -791,6 +791,12 @@ bool CUser::AddAllowedHost(const CString& sHostMask) { m_ssAllowedHosts.insert(sHostMask); return true; } +bool CUser::RemAllowedHost(const CString& sHostMask) { + return m_ssAllowedHosts.erase(sHostMask) > 0; +} +void CUser::ClearAllowedHosts() { + m_ssAllowedHosts.clear(); +} bool CUser::IsHostAllowed(const CString& sHostMask) const { if (m_ssAllowedHosts.empty()) {