From: Peter Powell Date: Sat, 16 Nov 2019 22:04:08 +0000 (+0000) Subject: Close connections when an I/O hook is configured but not loaded. X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=b443df39386c77cf2d027e2b45c4d629261e0100;hp=d15e3bd110ea3e53fe1242c7d253bac685d0fca9;p=user%2Fhenk%2Fcode%2Finspircd.git Close connections when an I/O hook is configured but not loaded. --- diff --git a/include/dynref.h b/include/dynref.h index 6e2e17423..44829164b 100644 --- a/include/dynref.h +++ b/include/dynref.h @@ -43,7 +43,7 @@ class CoreExport dynamic_reference_base : public interfacebase, public insp::int ModuleRef creator; dynamic_reference_base(Module* Creator, const std::string& Name); ~dynamic_reference_base(); - inline const std::string& GetProvider() { return name; } + inline const std::string& GetProvider() const { return name; } void SetProvider(const std::string& newname); /** Set handler to call when the target object becomes available diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 4f65994aa..bcb831858 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -149,10 +149,23 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs { ListenSocket::IOHookProvRef& iohookprovref = *i; if (!iohookprovref) + { + if (!iohookprovref.GetProvider().empty()) + { + ServerInstance->Logs->Log("USERS", LOG_DEBUG, "Non-existent I/O hook '%s' in tag at %s", + iohookprovref.GetProvider().c_str(), + i == via->iohookprovs.begin() ? "hook" : "ssl", + via->bind_tag->getTagLocation().c_str()); + this->QuitUser(New, "Internal error handling connection"); + return; + } continue; + } iohookprovref->OnAccept(eh, client, server); - // IOHook could have encountered a fatal error, e.g. if the TLS ClientHello was already in the queue and there was no common TLS version + + // IOHook could have encountered a fatal error, e.g. if the TLS ClientHello + // was already in the queue and there was no common TLS version. if (!eh->getError().empty()) { QuitUser(New, eh->getError());