summaryrefslogtreecommitdiff
path: root/src/modules/m_cgiirc.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-12 22:30:27 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-12 22:30:27 +0000
commit69e28c67dddd8b74ee4c321667d286111e09e5da (patch)
treeb5de7bc4ab8abfc93b1adc0721f62ba5d54e5760 /src/modules/m_cgiirc.cpp
parent39cf323606a311b3b7f59a9c9f39a21d42520c24 (diff)
Remove possible references to deleted User objects due to DNS lookups
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12445 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_cgiirc.cpp')
-rw-r--r--src/modules/m_cgiirc.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 27309e677..618eec9f5 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -102,17 +102,17 @@ class CommandWebirc : public Command
class CGIResolver : public Resolver
{
std::string typ;
- int theirfd;
- LocalUser* them;
+ std::string theiruid;
bool notify;
public:
- CGIResolver(Module* me, bool NotifyOpers, const std::string &source, bool forward, LocalUser* u, int userfd, const std::string &type, bool &cached)
- : Resolver(source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { }
+ CGIResolver(Module* me, bool NotifyOpers, const std::string &source, bool forward, LocalUser* u, const std::string &type, bool &cached)
+ : Resolver(source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theiruid(u->uuid), notify(NotifyOpers) { }
virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)
{
/* Check the user still exists */
- if ((them) && (&them->eh == ServerInstance->SE->GetRef(theirfd)))
+ User* them = ServerInstance->FindUUID(theiruid);
+ if (them)
{
if (notify)
ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", them->nick.c_str(), them->host.c_str(), result.c_str(), typ.c_str());
@@ -128,7 +128,9 @@ class CGIResolver : public Resolver
virtual void OnError(ResolverError e, const std::string &errormessage)
{
- if ((them) && (&them->eh == ServerInstance->SE->GetRef(theirfd)))
+ User* them = ServerInstance->FindUUID(theiruid);
+ if (them)
+ if (them)
{
if (notify)
ServerInstance->SNO->WriteToSnoMask('a', "Connecting user %s detected as using CGI:IRC (%s), but their host can't be resolved from their %s!", them->nick.c_str(), them->host.c_str(), typ.c_str());
@@ -298,7 +300,7 @@ public:
{
bool cached;
- CGIResolver* r = new CGIResolver(this, NotifyOpers, user->password, false, user, user->GetFd(), "PASS", cached);
+ CGIResolver* r = new CGIResolver(this, NotifyOpers, user->password, false, user, "PASS", cached);
ServerInstance->AddResolver(r, cached);
}
catch (...)
@@ -349,7 +351,7 @@ public:
{
bool cached;
- CGIResolver* r = new CGIResolver(this, NotifyOpers, newipstr, false, user, user->GetFd(), "IDENT", cached);
+ CGIResolver* r = new CGIResolver(this, NotifyOpers, newipstr, false, user, "IDENT", cached);
ServerInstance->AddResolver(r, cached);
}
catch (...)