summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-01-20 09:51:12 +0000
committerPeter Powell <petpow@saberuk.com>2019-01-20 09:51:12 +0000
commit0a9c72335a3d3dea286382ad3e7635a05713d7cc (patch)
tree1d1204eb1ac29a5d8876a9faa2862cc5ed49c55a /src
parent25b3686f43d2a0dcc40157d7119a80b783a07f8f (diff)
Move ident lookups to the OnSetUserIP hook.
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_ident.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index ca12a9ba3..803c19846 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -275,12 +275,24 @@ class ModuleIdent : public Module
NoLookupPrefix = tag->getBool("nolookupprefix", false);
}
- void OnUserInit(LocalUser *user) CXX11_OVERRIDE
+ void OnSetUserIP(LocalUser* user) CXX11_OVERRIDE
{
+ IdentRequestSocket* isock = ext.get(user);
+ if (isock)
+ {
+ // If an ident lookup request was in progress then cancel it.
+ isock->Close();
+ ext.unset(user);
+ }
+
// 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;
+ // We don't want to look this up once the user has connected.
+ if (user->registered == REG_ALL)
+ return;
+
ConfigTag* tag = user->MyClass->config;
if (!tag->getBool("useident", true))
return;
@@ -289,7 +301,7 @@ class ModuleIdent : public Module
try
{
- IdentRequestSocket *isock = new IdentRequestSocket(user);
+ isock = new IdentRequestSocket(user);
ext.set(user, isock);
}
catch (ModuleException &e)