From b7716ed57704b2b2bcc665a590aecc8f02de631d Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 13 Jul 2018 10:28:28 +0100 Subject: Initial support for listening on UNIX socket endpoints. --- src/modules/m_cloaking.cpp | 4 ++++ src/modules/m_dnsbl.cpp | 4 ++++ src/modules/m_ident.cpp | 4 ++++ src/modules/m_spanningtree/main.cpp | 8 +++++++- 4 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 87ff14a9d..75dc889f9 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -395,6 +395,10 @@ class ModuleCloaking : public Module if (cloak) return; + // TODO: decide how we are going to cloak AF_UNIX hostnames. + if (dest->client_sa.family() != AF_INET && dest->client_sa.family() != AF_INET6) + return; + cu.ext.set(dest, GenCloak(dest->client_sa, dest->GetIPString(), dest->GetRealHost())); } }; diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 95913c235..10b0e2728 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -339,6 +339,10 @@ class ModuleDNSBL : public Module, public Stats::EventListener if ((user->exempt) || !DNS) return; + // Clients can't be in a DNSBL if they aren't connected via IPv4 or IPv6. + if (user->client_sa.family() != AF_INET && user->client_sa.family() != AF_INET6) + return; + if (user->MyClass) { if (!user->MyClass->config->getBool("usednsbl", true)) diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index f645a77ff..ca12a9ba3 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -277,6 +277,10 @@ class ModuleIdent : public Module void OnUserInit(LocalUser *user) CXX11_OVERRIDE { + // The ident protocol requires that clients are connecting over a protocol with ports. + if (user->client_sa.family() != AF_INET && user->client_sa.family() != AF_INET6) + return; + ConfigTag* tag = user->MyClass->config; if (!tag->getBool("useident", true)) return; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 0b311a0bd..8bc3bfd9c 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -203,7 +203,13 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) return; } - if (strchr(x->IPAddr.c_str(),':')) + if (x->IPAddr.find('/') != std::string::npos) + { + struct stat sb; + if (stat(x->IPAddr.c_str(), &sb) == -1 || !S_ISSOCK(sb.st_mode)) + ipvalid = false; + } + if (x->IPAddr.find(':') != std::string::npos) { in6_addr n; if (inet_pton(AF_INET6, x->IPAddr.c_str(), &n) < 1) -- cgit v1.2.3