diff options
Diffstat (limited to 'src/dnsqueue.cpp')
-rw-r--r-- | src/dnsqueue.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp index 043ee8d4f..71ab99019 100644 --- a/src/dnsqueue.cpp +++ b/src/dnsqueue.cpp @@ -188,16 +188,19 @@ public: delete resolver; } - Lookup(std::string nick) + bool DoLookup(std::string nick) { userrec* usr = Find(nick); if (usr) { log(DEBUG,"New Lookup class for %s with DNSServer set to '%s'",nick.c_str(),DNSServer); resolver = new DNS(std::string(DNSServer)); - resolver->ReverseLookup(std::string(usr->host)); + if (!resolver->ReverseLookup(std::string(usr->host))) + return false; strlcpy(u,nick.c_str(),NICKMAX); + return true; } + return false; } bool Done() @@ -257,15 +260,22 @@ bool lookup_dns(std::string nick) // place a new user into the queue... log(DEBUG,"Queueing DNS lookup for %s",u->nick); WriteServ(u->fd,"NOTICE Auth :Looking up your hostname..."); - Lookup L(nick); - for (int j = 0; j < MAXBUF; j++) + Lookup L; + if (L.DoLookup(nick)) { - if (!dnsq[j].GetFD()) + for (int j = 0; j < MAXBUF; j++) { - dnsq[j] = L; - return true; + if (!dnsq[j].GetFD()) + { + dnsq[j] = L; + return true; + } } } + else + { + return false; + } } return false; } |