summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/configreader.h4
-rw-r--r--src/cmd_nick.cpp22
-rw-r--r--src/configreader.cpp3
3 files changed, 20 insertions, 9 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 598fbef81..b37838cf1 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -344,6 +344,10 @@ class ServerConfig : public Extensible
*/
std::map<std::string,int> maxbans;
+ /** If set to true, no user DNS lookups are to be performed
+ */
+ bool NoUserDns;
+
ServerConfig();
/** Clears the include stack in preperation for
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp
index 432c2e814..3eeb37663 100644
--- a/src/cmd_nick.cpp
+++ b/src/cmd_nick.cpp
@@ -143,18 +143,24 @@ void cmd_nick::Handle (char **parameters, int pcnt, userrec *user)
//if (user->dns_done)
// log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
-#ifdef THREADED_DNS
- // initialize their dns lookup thread
- if (pthread_create(&user->dnsthread, NULL, dns_task, (void *)user) != 0)
+ if (Config->NoUserDns)
{
- log(DEBUG,"Failed to create DNS lookup thread for user %s",user->nick);
+ user->dns_done = true;
}
+ else
+ {
+#ifdef THREADED_DNS
+ // initialize their dns lookup thread
+ if (pthread_create(&user->dnsthread, NULL, dns_task, (void *)user) != 0)
+ {
+ log(DEBUG,"Failed to create DNS lookup thread for user %s",user->nick);
+ }
#else
- user->dns_done = (!lookup_dns(user->nick));
- if (user->dns_done)
- log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
+ user->dns_done = (!lookup_dns(user->nick));
+ if (user->dns_done)
+ log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
#endif
-
+ }
}
if (user->registered == 3)
{
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 2cc1cd9c1..04918e7cf 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -45,7 +45,7 @@ ServerConfig::ServerConfig()
*CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0';
*OperOnlyStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0';
log_file = NULL;
- forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = false;
+ NoUserDns = forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = false;
writelog = AllowHalfop = true;
dns_timeout = DieDelay = 5;
MaxTargets = 20;
@@ -545,6 +545,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{"options", "hidewhois", &this->HideWhoisServer, DT_CHARPTR, NoValidation},
{"options", "operspywhois", &this->OperSpyWhois, DT_BOOLEAN, NoValidation},
{"options", "tempdir", &this->TempDir, DT_CHARPTR, ValidateTempDir},
+ {"options", "nouserdns", &this->NoUserDns, DT_BOOLEAN, NoValidation},
{"pid", "file", &this->PID, DT_CHARPTR, NoValidation},
{NULL}
};