]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/dns.cpp
Remove check that very rarely equates to true
[user/henk/code/inspircd.git] / src / dns.cpp
index 42db21424474a16d505494003ac862e3f8ea0945..0436095b6bd30afc315837138fd0f7402a4c1891 100644 (file)
@@ -453,7 +453,7 @@ int DNS::GetNameForce(const char *ip, ForceProtocol fp)
        DNSHeader h;
        int id;
        int length;
-
+#ifdef SUPPORT_IP6LINKS
        if (fp == PROTOCOL_IPV6)
        {
                in6_addr i;
@@ -466,6 +466,7 @@ int DNS::GetNameForce(const char *ip, ForceProtocol fp)
                        return -1;
        }
        else
+#endif
        {
                in_addr i;
                if (inet_aton(ip, &i))
@@ -493,6 +494,7 @@ int DNS::GetNameForce(const char *ip, ForceProtocol fp)
 
 void DNS::MakeIP6Int(char* query, const in6_addr *ip)
 {
+#ifdef SUPPORT_IP6LINKS
        const char* hex = "0123456789abcdef";
        for (int index = 31; index >= 0; index--) /* for() loop steps twice per byte */
        {
@@ -505,6 +507,9 @@ void DNS::MakeIP6Int(char* query, const in6_addr *ip)
                *query++ = '.'; /* Seperator */
        }
        strcpy(query,"ip6.arpa"); /* Suffix the string */
+#else
+       *query = 0;
+#endif
 }
 
 /* Return the next id which is ready, and the result attached to it */
@@ -640,6 +645,14 @@ DNSResult DNS::GetResult()
                                                memmove(formatted,formatted + 1, strlen(formatted + 1) + 1);
                                }
                                resultstr = formatted;
+
+                               /* Special case. Sending ::1 around between servers
+                                * and to clients is dangerous, because the : on the
+                                * start makes the client or server interpret the IP
+                                * as the last parameter on the line with a value ":1".
+                                */
+                               if (*formatted == ':')
+                                       resultstr = "0" + resultstr;
                        }
                        break;