From 7021dc0a123dd291ae4c3cfe67e41107c52d7792 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 25 Dec 2022 23:10:19 +0000 Subject: Include the WebSocket fail reason in the body of the HTTP response. --- src/modules/m_websocket.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/modules/m_websocket.cpp b/src/modules/m_websocket.cpp index 47e12362a..a88af2df5 100644 --- a/src/modules/m_websocket.cpp +++ b/src/modules/m_websocket.cpp @@ -362,6 +362,7 @@ class WebSocketHook : public IOHookMiddle void FailHandshake(StreamSocket* sock, const char* httpreply, const char* sockerror) { GetSendQ().push_back(StreamSocket::SendQueue::Element(httpreply)); + GetSendQ().push_back(StreamSocket::SendQueue::Element(sockerror)); sock->DoWrite(); sock->SetError(sockerror); } -- cgit v1.3.1-10-gc9f91 From 946cb66aac6124f11dfc59a895e6196038c5492f Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 26 Dec 2022 19:59:53 +0000 Subject: Fix overwriting marks from earlier DNSBLs. --- src/modules/m_dnsbl.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 1b18866ed..506003c70 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -57,6 +57,7 @@ class DNSBLConfEntry : public refcountbase } }; +typedef SimpleExtItem> MarkExtItem; /** Resolver for CGI:IRC hostnames encoded in ident/real name */ @@ -65,12 +66,12 @@ class DNSBLResolver : public DNS::Request private: irc::sockets::sockaddrs theirsa; std::string theiruid; - LocalStringExt& nameExt; + MarkExtItem& nameExt; LocalIntExt& countExt; reference ConfEntry; public: - DNSBLResolver(DNS::Manager *mgr, Module *me, LocalStringExt& match, LocalIntExt& ctr, const std::string &hostname, LocalUser* u, reference conf) + DNSBLResolver(DNS::Manager *mgr, Module *me, MarkExtItem& match, LocalIntExt& ctr, const std::string &hostname, LocalUser* u, reference conf) : DNS::Request(mgr, me, hostname, DNS::QUERY_A, true, conf->timeout) , theirsa(u->client_sa) , theiruid(u->uuid) @@ -176,7 +177,13 @@ class DNSBLResolver : public DNS::Request them->ChangeDisplayedHost(ConfEntry->host); } - nameExt.set(them, ConfEntry->name); + std::vector* marks = nameExt.get(them); + if (!marks) + { + marks = new std::vector(); + nameExt.set(them, marks); + } + marks->push_back(ConfEntry->name); break; } case DNSBLConfEntry::I_KLINE: @@ -283,7 +290,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener { DNSBLConfList DNSBLConfEntries; dynamic_reference DNS; - LocalStringExt nameExt; + MarkExtItem nameExt; LocalIntExt countExt; /* @@ -473,7 +480,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener if (!myclass->config->readString("dnsbl", dnsbl)) return MOD_RES_PASSTHRU; - std::string* match = nameExt.get(user); + std::vector* match = nameExt.get(user); if (!match) { ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it requires a DNSBL mark", @@ -481,14 +488,16 @@ class ModuleDNSBL : public Module, public Stats::EventListener return MOD_RES_DENY; } - if (!InspIRCd::Match(*match, dnsbl)) + for (std::vector::const_iterator it = match->begin(); it != match->end(); ++it) { - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as the DNSBL mark (%s) does not match %s", - myclass->GetName().c_str(), match->c_str(), dnsbl.c_str()); - return MOD_RES_DENY; + if (InspIRCd::Match(*it, dnsbl)) + return MOD_RES_PASSTHRU; } - return MOD_RES_PASSTHRU; + const std::string marks = stdalgo::string::join(dnsbl); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as the DNSBL marks (%s) do not match %s", + myclass->GetName().c_str(), marks.c_str(), dnsbl.c_str()); + return MOD_RES_DENY; } ModResult OnCheckReady(LocalUser *user) CXX11_OVERRIDE -- cgit v1.3.1-10-gc9f91 From beb9c2475c071e882957b41bf57afc2db1a6f0fe Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 26 Dec 2022 20:04:17 +0000 Subject: Fix a C++11-ism in the dnsbl module. --- src/modules/m_dnsbl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 506003c70..c90dab39e 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -57,7 +57,7 @@ class DNSBLConfEntry : public refcountbase } }; -typedef SimpleExtItem> MarkExtItem; +typedef SimpleExtItem > MarkExtItem; /** Resolver for CGI:IRC hostnames encoded in ident/real name */ -- cgit v1.3.1-10-gc9f91