From 69e28c67dddd8b74ee4c321667d286111e09e5da Mon Sep 17 00:00:00 2001 From: danieldg Date: Fri, 12 Feb 2010 22:30:27 +0000 Subject: 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 --- src/modules/m_dnsbl.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/modules/m_dnsbl.cpp') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 8fa627ab8..818450b79 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -45,17 +45,15 @@ class DNSBLConfEntry */ class DNSBLResolver : public Resolver { - int theirfd; - LocalUser* them; + std::string theiruid; DNSBLConfEntry *ConfEntry; public: - DNSBLResolver(Module *me, const std::string &hostname, LocalUser* u, int userfd, DNSBLConfEntry *conf, bool &cached) + DNSBLResolver(Module *me, const std::string &hostname, LocalUser* u, DNSBLConfEntry *conf, bool &cached) : Resolver(hostname, DNS_QUERY_A, cached, me) { - theirfd = userfd; - them = u; + theiruid = u->uuid; ConfEntry = conf; } @@ -63,7 +61,8 @@ class DNSBLResolver : public Resolver 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) { // Now we calculate the bitmask: 256*(256*(256*a+b)+c)+d if(result.length()) @@ -352,7 +351,7 @@ class ModuleDNSBL : public Module /* now we'd need to fire off lookups for `hostname'. */ bool cached; - DNSBLResolver *r = new DNSBLResolver(this, hostname, user, user->GetFd(), *i, cached); + DNSBLResolver *r = new DNSBLResolver(this, hostname, user, *i, cached); ServerInstance->AddResolver(r, cached); } -- cgit v1.2.3