]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/dns.cpp
Fixed to not allow :Abc NICK Abc, where the case of the old and new nick are *identical*
[user/henk/code/inspircd.git] / src / dns.cpp
index d8018656e47dd281b54ca66090f54611a56ac029..efb690dc248cd90f6eb0860c298d25b8ee6e7e4c 100644 (file)
@@ -36,12 +36,12 @@ using namespace std;
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include "dns.h"
+#include "inspircd.h"
 #include "helperfuncs.h"
 #include "socketengine.h"
 
-extern SocketEngine* SE;
+extern InspIRCd* ServerInstance;
 extern ServerConfig* Config;
-serverstats* stats;
 
 #define max(a,b) (a > b ? a : b)
 #define DNS_MAX              8                    /* max number of nameservers used */
@@ -655,7 +655,7 @@ DNS::~DNS()
 
 bool DNS::ReverseLookup(std::string ip)
 {
-       stats->statsDns++;
+       ServerInstance->stats->statsDns++;
         binip = dns_aton4(ip.c_str());
         if (binip == NULL) {
                 return false;
@@ -668,14 +668,14 @@ bool DNS::ReverseLookup(std::string ip)
        }
        log(DEBUG,"DNS: ReverseLookup, fd=%d",this->myfd);
 #ifndef THREADED_DNS
-       SE->AddFd(this->myfd,true,X_ESTAB_DNS);
+       ServerInstance->SE->AddFd(this->myfd,true,X_ESTAB_DNS);
 #endif
        return true;
 }
 
 bool DNS::ForwardLookup(std::string host)
 {
-       stats->statsDns++;
+       ServerInstance->stats->statsDns++;
        this->myfd = dns_getip4(host.c_str());
        if (this->myfd == -1)
        {
@@ -683,7 +683,7 @@ bool DNS::ForwardLookup(std::string host)
        }
        log(DEBUG,"DNS: ForwardLookup, fd=%d",this->myfd);
 #ifndef THREADED_DNS
-       SE->AddFd(this->myfd,true,X_ESTAB_DNS);
+       ServerInstance->SE->AddFd(this->myfd,true,X_ESTAB_DNS);
 #endif
        return true;
 }
@@ -718,14 +718,14 @@ std::string DNS::GetResult()
        log(DEBUG,"DNS: GetResult()");
         result = dns_getresult(this->myfd);
 #ifndef THREADED_DNS
-       SE->DelFd(this->myfd);
+       ServerInstance->SE->DelFd(this->myfd);
 #endif
         if (result) {
-               stats->statsDnsGood++;
+               ServerInstance->stats->statsDnsGood++;
                dns_close(this->myfd);
                return result;
         } else {
-               stats->statsDnsBad++;
+               ServerInstance->stats->statsDnsBad++;
                if (this->myfd != -1)
                {
                        dns_close(this->myfd);
@@ -742,13 +742,13 @@ std::string DNS::GetResultIP()
        if (this->myfd != -1)
        {
 #ifndef THREADED_DNS
-               SE->DelFd(this->myfd);
+               ServerInstance->SE->DelFd(this->myfd);
 #endif
                dns_close(this->myfd);
        }
        if (result)
        {
-               stats->statsDnsGood++;
+               ServerInstance->stats->statsDnsGood++;
                unsigned char a = (unsigned)result[0];
                unsigned char b = (unsigned)result[1];
                unsigned char c = (unsigned)result[2];
@@ -758,7 +758,7 @@ std::string DNS::GetResultIP()
        }
        else
        {
-               stats->statsDnsBad++;
+               ServerInstance->stats->statsDnsBad++;
                log(DEBUG,"DANGER WILL ROBINSON! NXDOMAIN for forward lookup, but we got a reverse lookup!");
                return "";
        }