* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
* E-mail:
* <brain@chatspike.net>
* <Craig@chatspike.net>
Lookup()
{
*u = 0;
+ hostname = "";
}
void Reset()
{
*u = 0;
+ hostname = "";
}
~Lookup()
{
return false;
}
- strlcpy(u,nick.c_str(),NICKMAX);
+ strlcpy(u,nick.c_str(),NICKMAX-1);
/* ASSOCIATE WITH DNS LOOKUP LIST */
if (resolver1.GetFD() != -1)
}
if ((hostname != "") && (usr->registered != 7))
{
- if (std::string(usr->ip) == ip)
+ if ((std::string((char*)inet_ntoa(usr->ip4)) == ip) && (hostname.length() < 65))
{
strlcpy(usr->host,hostname.c_str(),MAXBUF);
strlcpy(usr->dhost,hostname.c_str(),MAXBUF);
+ /*address_cache::iterator address = addrcache.find(usr->ip4);
+ if (address == addrcache.end())
+ {
+ log(DEBUG,"Caching hostname %s -> %s",(char*)inet_ntoa(usr->ip4),hostname.c_str());
+ addrcache[usr->ip4] = new std::string(hostname);
+ }*/
+ WriteServ(usr->fd,"NOTICE Auth :*** Found your hostname");
}
usr->dns_done = true;
return true;
{
if ((usr->registered > 3) || (hostname == ""))
{
+ WriteServ(usr->fd,"NOTICE Auth :*** Could not resolve your hostname -- Using your IP address instead");
usr->dns_done = true;
return true;
}
}
};
-bool lookup_dns(std::string nick)
+bool lookup_dns(const std::string &nick)
{
/* First attempt to find the nickname */
userrec* u = Find(nick);
if (u)
{
+ /* Check the cache */
+ /*address_cache::iterator address = addrcache.find(u->ip4);
+ if (address != addrcache.end())
+ {
+ WriteServ(u->fd,"NOTICE Auth :*** Found your hostname (cached)");
+ log(DEBUG,"Found cached host");
+ strlcpy(u->host,address->second->c_str(),MAXBUF);
+ strlcpy(u->dhost,address->second->c_str(),MAXBUF);
+ u->dns_done = true;
+ return true;
+ }*/
/* If the user exists, create a new
* lookup object, and associate it
* with the user. The lookup object