]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/dns.cpp
Decide that it wasn't quite appropriate :(
[user/henk/code/inspircd.git] / src / dns.cpp
index f9411234dd21797b53cc69fb856120bb58e778a3..3b8f8cc95426a7cf23febdb329b3aa384b5d9505 100644 (file)
@@ -665,10 +665,10 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS
                                alist->next = NULL;
                                break;
                        }
-                       goto defaultcase;
+                       memcpy(res,&h.payload[i],rr.rdlength);
+                       res[rr.rdlength] = '\0';
                        break;
                default:
-               defaultcase:
                        memcpy(res,&h.payload[i],rr.rdlength);
                        res[rr.rdlength] = '\0';
                        break;
@@ -735,6 +735,20 @@ bool DNS::ForwardLookup(std::string host)
        return true;
 }
 
+bool DNS::ForwardLookupWithFD(std::string host, int &fd)
+{
+       ServerInstance->stats->statsDns++;
+       this->myfd = dns_getip4(host.c_str());
+       fd = this->myfd;
+       if (this->myfd == -1)
+       {
+               
+       }
+       log(DEBUG,"DNS: ForwardLookupWithFD, fd=%d",this->myfd);
+       ServerInstance->SE->AddFd(this->myfd,true,X_ESTAB_MODULE);
+       return true;
+}
+
 bool DNS::HasResult(int fd)
 {
        return (fd == this->myfd);
@@ -819,7 +833,7 @@ void* dns_task(void* arg)
         DNS dns2;
         std::string host;
         std::string ip;
-        if (dns1.ReverseLookup(u->ip))
+        if (dns1.ReverseLookup((char*)inet_ntoa(u->ip4)))
         {
                 while (!dns1.HasResult())
                 {
@@ -835,7 +849,7 @@ void* dns_task(void* arg)
                                         usleep(100);
                                 }
                                 ip = dns2.GetResultIP();
-                                if (ip == std::string(u->ip))
+                                if (ip == std::string((char*)inet_ntoa(u->ip4)))
                                 {
                                         if (host.length() < 160)
                                         {