From c7795d6b93297ec5d1ce5d9d998a42aec575502e Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 6 Mar 2021 02:13:10 +0000 Subject: Fix not always incrementing the DNSBL stats. --- src/modules/m_dnsbl.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 6712e2674..57a780ff2 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -84,7 +84,10 @@ class DNSBLResolver : public DNS::Request /* Check the user still exists */ LocalUser* them = IS_LOCAL(ServerInstance->FindUUID(theiruid)); if (!them || them->client_sa != theirsa) + { + ConfEntry->stats_misses++; return; + } int i = countExt.get(them); if (i) @@ -242,6 +245,20 @@ class DNSBLResolver : public DNS::Request void OnError(const DNS::Query *q) CXX11_OVERRIDE { + bool is_miss = true; + switch (q->error) + { + case DNS::ERROR_NO_RECORDS: + case DNS::ERROR_DOMAIN_NOT_FOUND: + ConfEntry->stats_misses++; + break; + + default: + ConfEntry->stats_errors++; + is_miss = false; + break; + } + LocalUser* them = IS_LOCAL(ServerInstance->FindUUID(theiruid)); if (!them || them->client_sa != theirsa) return; @@ -250,13 +267,9 @@ class DNSBLResolver : public DNS::Request if (i) countExt.set(them, i - 1); - if (q->error == DNS::ERROR_NO_RECORDS || q->error == DNS::ERROR_DOMAIN_NOT_FOUND) - { - ConfEntry->stats_misses++; + if (is_miss) return; - } - ConfEntry->stats_errors++; ServerInstance->SNO->WriteGlobalSno('d', "An error occurred whilst checking whether %s (%s) is on the '%s' DNS blacklist: %s", them->GetFullRealHost().c_str(), them->GetIPString().c_str(), ConfEntry->name.c_str(), this->manager->GetErrorStr(q->error).c_str()); } -- cgit v1.3.1-10-gc9f91 From 6c2b6fa23d3a65ecdcebbf9154b8daa2e55727e9 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 9 Mar 2021 01:00:16 +0000 Subject: Add a subclass of IOHookProvider for SSL modules. --- include/modules/ssl.h | 10 ++++++++++ src/modules/extra/m_ssl_gnutls.cpp | 4 ++-- src/modules/extra/m_ssl_mbedtls.cpp | 4 ++-- src/modules/extra/m_ssl_openssl.cpp | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src/modules') diff --git a/include/modules/ssl.h b/include/modules/ssl.h index ac2e367fd..c9229cf9d 100644 --- a/include/modules/ssl.h +++ b/include/modules/ssl.h @@ -151,6 +151,16 @@ class ssl_cert : public refcountbase } }; +/** I/O hook provider for SSL modules. */ +class SSLIOHookProvider : public IOHookProvider +{ +public: + SSLIOHookProvider(Module* mod, const std::string& Name) + : IOHookProvider(mod, "ssl/" + Name, IOH_SSL) + { + } +}; + class SSLIOHook : public IOHook { protected: diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index b6eee5836..4e6b09564 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -1243,13 +1243,13 @@ int GnuTLS::X509Credentials::cert_callback(gnutls_session_t sess, const gnutls_d return 0; } -class GnuTLSIOHookProvider : public IOHookProvider +class GnuTLSIOHookProvider : public SSLIOHookProvider { GnuTLS::Profile profile; public: GnuTLSIOHookProvider(Module* mod, GnuTLS::Profile::Config& config) - : IOHookProvider(mod, "ssl/" + config.name, IOHookProvider::IOH_SSL) + : SSLIOHookProvider(mod, config.name) , profile(config) { ServerInstance->Modules->AddService(*this); diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index 9c2a535ae..77c81b7fa 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -817,13 +817,13 @@ class mbedTLSIOHook : public SSLIOHook bool IsHandshakeDone() const { return (status == ISSL_HANDSHAKEN); } }; -class mbedTLSIOHookProvider : public IOHookProvider +class mbedTLSIOHookProvider : public SSLIOHookProvider { mbedTLS::Profile profile; public: mbedTLSIOHookProvider(Module* mod, mbedTLS::Profile::Config& config) - : IOHookProvider(mod, "ssl/" + config.name, IOHookProvider::IOH_SSL) + : SSLIOHookProvider(mod, config.name) , profile(config) { ServerInstance->Modules->AddService(*this); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 55efd2dd6..fb965a5ab 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -936,13 +936,13 @@ static int OpenSSL::BIOMethod::read(BIO* bio, char* buffer, int size) return ret; } -class OpenSSLIOHookProvider : public IOHookProvider +class OpenSSLIOHookProvider : public SSLIOHookProvider { OpenSSL::Profile profile; public: OpenSSLIOHookProvider(Module* mod, const std::string& profilename, ConfigTag* tag) - : IOHookProvider(mod, "ssl/" + profilename, IOHookProvider::IOH_SSL) + : SSLIOHookProvider(mod, profilename) , profile(profilename, tag) { ServerInstance->Modules->AddService(*this); -- cgit v1.3.1-10-gc9f91 From b3449b8763139602efc568f46631299476d5979f Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 9 Mar 2021 09:39:12 +0000 Subject: Space-delimit the human readable callerid extensible data. --- src/modules/m_callerid.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index b575491d6..2f47912ae 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -67,8 +67,10 @@ class callerid_data for (UserSet::const_iterator i = accepting.begin(); i != accepting.end(); ++i) { User* u = *i; - // Encode UIDs. - oss << "," << (human ? u->nick : u->uuid); + if (human) + oss << ' ' << u->nick; + else + oss << ',' << u->uuid; } return oss.str(); } -- cgit v1.3.1-10-gc9f91 From ba501ffb59ec5b147bfdcdc89a20b6ed2acaba70 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 9 Mar 2021 10:26:19 +0000 Subject: Add a human-readable version of the cloak list. --- src/modules/m_cloaking.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 1e266908c..b964dedca 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -81,13 +81,25 @@ struct CloakInfo typedef std::vector CloakList; -/** Handles user mode +x - */ +class CloakExtItem : public SimpleExtItem +{ + public: + CloakExtItem(Module* Creator) + : SimpleExtItem("cloaks", ExtensionItem::EXT_USER, Creator) + { + } + + std::string ToHuman(const Extensible* container, void* item) const override + { + return stdalgo::string::join(*static_cast(item), ' '); + } +}; + class CloakUser : public ModeHandler { public: bool active; - SimpleExtItem ext; + CloakExtItem ext; std::string debounce_uid; time_t debounce_ts; int debounce_count; @@ -95,7 +107,7 @@ class CloakUser : public ModeHandler CloakUser(Module* source) : ModeHandler(source, "cloak", 'x', PARAM_NONE, MODETYPE_USER) , active(false) - , ext("cloaked_host", ExtensionItem::EXT_USER, source) + , ext(source) , debounce_ts(0) , debounce_count(0) { -- cgit v1.3.1-10-gc9f91 From 80e81e3b81b779901fd9d67f8ae030ee30c0bcec Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 10 Mar 2021 04:17:09 +0000 Subject: Fix the cloaking module on C++98 compilers. --- src/modules/m_cloaking.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index b964dedca..daa04cf9b 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -89,7 +89,7 @@ class CloakExtItem : public SimpleExtItem { } - std::string ToHuman(const Extensible* container, void* item) const override + std::string ToHuman(const Extensible* container, void* item) const CXX11_OVERRIDE { return stdalgo::string::join(*static_cast(item), ' '); } -- cgit v1.3.1-10-gc9f91 From 085777cf272cd74e44abec70c0a87003429e2fd3 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 10 Mar 2021 03:30:50 +0000 Subject: Rename `` to ``. --- docs/conf/links.conf.example | 4 ++-- src/modules/m_spanningtree/utils.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/modules') diff --git a/docs/conf/links.conf.example b/docs/conf/links.conf.example index 3b25e86f4..7ced7170e 100644 --- a/docs/conf/links.conf.example +++ b/docs/conf/links.conf.example @@ -56,7 +56,7 @@ # failover (see above). timeout="5m" - # ssl: If defined, this states the TLS (SSL) profile that will be used + # sslprofile: If defined, this states the TLS (SSL) profile that will be used # when making an outbound connection to the server. See the docs page for # the TLS (SSL) module you are using for more details: # @@ -67,7 +67,7 @@ # You will need to load the ssl_openssl module for OpenSSL, ssl_gnutls # for GnuTLS and ssl_mbedtls for mbedTLS. The server port that you # connect to must be capable of accepting this type of connection. - ssl="Servers" + sslprofile="Servers" # fingerprint: If defined, this option will force servers to be # authenticated using TLS (SSL) certificate fingerprints. See diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index cd5cb508d..daafa7efe 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -274,7 +274,7 @@ void SpanningTreeUtilities::ReadConfiguration() L->Fingerprint = tag->getString("fingerprint"); L->HiddenFromStats = tag->getBool("statshidden"); L->Timeout = tag->getDuration("timeout", 30); - L->Hook = tag->getString("ssl"); + L->Hook = tag->getString("sslprofile", tag->getString("ssl")); L->Bind = tag->getString("bind"); L->Hidden = tag->getBool("hidden"); -- cgit v1.3.1-10-gc9f91 From e0dc7691c4cff3a38bc12adf10b3709d8c4901ba Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 10 Mar 2021 03:43:56 +0000 Subject: Rename `` to ``. --- docs/conf/inspircd.conf.example | 4 ++-- docs/conf/links.conf.example | 4 ++-- docs/conf/modules.conf.example | 2 +- src/coremods/core_stats.cpp | 2 +- src/listensocket.cpp | 5 +++-- src/modules/m_flashpolicyd.cpp | 2 +- src/modules/m_ircv3_sts.cpp | 2 +- src/usermanager.cpp | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/modules') diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index cdfb6f3c2..f07f21cdd 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -141,7 +141,7 @@ # to this bind section. type="clients" - # ssl: If you want the port(s) in this bind tag to use TLS (SSL), set this + # sslprofile: If you want the port(s) in this bind tag to use TLS (SSL), set this # to the name of a custom tag that you have defined. See the # docs page for the TLS (SSL) module you are using for more details: # @@ -151,7 +151,7 @@ # # You will need to load the ssl_openssl module for OpenSSL, ssl_gnutls # for GnuTLS and ssl_mbedtls for mbedTLS. - ssl="Clients" + sslprofile="Clients" # defer: When this is non-zero, connections will not be handed over to # the daemon from the operating system before data is ready. diff --git a/docs/conf/links.conf.example b/docs/conf/links.conf.example index 7ced7170e..19d770d35 100644 --- a/docs/conf/links.conf.example +++ b/docs/conf/links.conf.example @@ -10,7 +10,7 @@ + sslprofile="Servers"> # Plaintext listener that binds on a TCP/IP endpoint: