-UserResolver::UserResolver(InspIRCd* Instance, userrec* user, std::string to_resolve, bool forward) :
- Resolver(Instance, to_resolve, forward ? DNS_QUERY_FORWARD : DNS_QUERY_REVERSE), bound_user(user)
-{
- this->fwd = forward;
- this->bound_fd = user->fd;
-}
-
-void UserResolver::OnLookupComplete(const std::string &result)
-{
- if ((!this->fwd) && (ServerInstance->fd_ref_table[this->bound_fd] == this->bound_user))
- {
- log(DEBUG,"Commencing forward lookup");
- this->bound_user->stored_host = result;
- try
- {
- bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, true);
- MyServer->AddResolver(bound_user->res_forward);
- }
- catch (ModuleException& e)
- {
- log(DEBUG,"Error in resolver: %s",e.GetReason());
- }
- }
- else if ((this->fwd) && (ServerInstance->fd_ref_table[this->bound_fd] == this->bound_user))
- {
- /* Both lookups completed */
- if (this->bound_user->GetIPString() == result)
- {
- std::string hostname = this->bound_user->stored_host;
- if (hostname.length() < 65)
- {
- /* Hostnames starting with : are not a good thing (tm) */
- if (*(hostname.c_str()) == ':')
- hostname = "0" + hostname;
-
- this->bound_user->WriteServ("NOTICE Auth :*** Found your hostname (%s)", hostname.c_str());
- this->bound_user->dns_done = true;
- strlcpy(this->bound_user->dhost, hostname.c_str(),64);
- strlcpy(this->bound_user->host, hostname.c_str(),64);
- }
- else
- {
- this->bound_user->WriteServ("NOTICE Auth :*** Your hostname is longer than the maximum of 64 characters, using your IP address (%s) instead.", this->bound_user->GetIPString());
- }
- }
+ /* Special case for 4in6 (Have i mentioned i HATE 4in6?) */
+ if (!strncmp(sip, "0::ffff:", 8))
+ res_reverse = new UserResolver(this->ServerInstance, this, sip + 8, DNS_QUERY_PTR4, cached);