summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/dns.h12
-rw-r--r--include/users.h1
-rw-r--r--src/dns.cpp7
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/modules/extra/m_pgsql.cpp2
-rw-r--r--src/modules/m_cgiirc.cpp10
-rw-r--r--src/modules/m_spanningtree.cpp4
-rw-r--r--src/modules/m_testcommand.cpp4
-rw-r--r--src/users.cpp2
9 files changed, 24 insertions, 20 deletions
diff --git a/include/dns.h b/include/dns.h
index f66d2d3c4..ebe628bb9 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -40,6 +40,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "socket.h"
#include "base.h"
+class InspIRCd;
+
/**
* Result status, used internally
*/
@@ -133,6 +135,10 @@ class Resolver : public Extensible
{
protected:
/**
+ * Pointer to creator
+ */
+ InspIRCd* ServerInstance;
+ /**
* The input data, either a host or an IP address
*/
std::string input;
@@ -180,7 +186,7 @@ class Resolver : public Extensible
* the network being down. This will also be thrown if an invalid IP address is
* passed when resolving a 'PTR' record.
*/
- Resolver(const std::string &source, QueryType qt);
+ Resolver(InspIRCd* Instance, const std::string &source, QueryType qt);
/**
* The default destructor does nothing.
*/
@@ -217,6 +223,8 @@ class DNS : public Extensible
{
private:
+ InspIRCd* ServerInstance;
+
/**
* The maximum value of a dns request id,
* 16 bits wide, 0xFFFF.
@@ -340,7 +348,7 @@ class DNS : public Extensible
* The constructor initialises the dns socket,
* and clears the request lists.
*/
- DNS();
+ DNS(InspIRCd* Instance);
/**
* Destructor
diff --git a/include/users.h b/include/users.h
index 8e3fddfcd..d0ed021a6 100644
--- a/include/users.h
+++ b/include/users.h
@@ -78,7 +78,6 @@ class UserResolver : public Resolver
userrec* bound_user;
int bound_fd;
bool fwd;
- InspIRCd* ServerInstance;
public:
UserResolver(InspIRCd* Instance, userrec* user, std::string to_resolve, bool forward);
diff --git a/src/dns.cpp b/src/dns.cpp
index 5e6499dc0..f7a2d62e2 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -43,9 +43,6 @@ using namespace std;
#include "socketengine.h"
#include "configreader.h"
-/* We need these */
-extern InspIRCd* ServerInstance;
-
/* Master file descriptor */
int DNS::MasterSocket;
@@ -242,7 +239,7 @@ int DNS::GetMasterSocket()
}
/* Initialise the DNS UDP socket so that we can send requests */
-DNS::DNS()
+DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance)
{
insp_inaddr addr;
@@ -834,7 +831,7 @@ DNS::~DNS()
}
/* High level abstraction of dns used by application at large */
-Resolver::Resolver(const std::string &source, QueryType qt) : input(source), querytype(qt)
+Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt) : ServerInstance(Instance), input(source), querytype(qt)
{
insp_inaddr binip;
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index b0e6b1073..3a4952cc4 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -884,7 +884,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
int InspIRCd::Run()
{
- this->Res = new DNS();
+ this->Res = new DNS(this);
LoadAllModules(this);
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 9c27a28f7..51217bb71 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -96,7 +96,7 @@ class SQLresolver : public Resolver
ModulePgSQL* mod;
public:
SQLresolver(ModulePgSQL* m, Server* srv, const SQLhost& hi)
- : Resolver(hi.host, DNS_QUERY_FORWARD), host(hi), mod(m)
+ : Resolver(ServerInstance, hi.host, DNS_QUERY_FORWARD), host(hi), mod(m)
{
}
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 4fcb0be13..31b5dc092 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -29,9 +29,7 @@
/* $ModDesc: Change user's hosts connecting from known CGI:IRC hosts */
-
-/* We need this for checking our user hasnt /quit before we finish our lookup */
-extern userrec* fd_ref_table[MAX_DESCRIPTORS];
+extern InspIRCd* ServerInstance;
enum CGItype { PASS, IDENT, PASSFIRST, IDENTFIRST };
@@ -57,12 +55,12 @@ class CGIResolver : public Resolver
bool notify;
public:
CGIResolver(bool NotifyOpers, const std::string &source, bool forward, userrec* u, int userfd, const std::string &type)
- : Resolver(source, forward ? DNS_QUERY_FORWARD : DNS_QUERY_REVERSE), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { }
+ : Resolver(ServerInstance, source, forward ? DNS_QUERY_FORWARD : DNS_QUERY_REVERSE), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { }
virtual void OnLookupComplete(const std::string &result)
{
/* Check the user still exists */
- if ((them) && (them == fd_ref_table[theirfd]))
+ if ((them) && (them == ServerInstance->fd_ref_table[theirfd]))
{
if (notify)
WriteOpers("*** Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", them->nick, them->host, result.c_str(), typ.c_str());
@@ -75,7 +73,7 @@ class CGIResolver : public Resolver
virtual void OnError(ResolverError e, const std::string &errormessage)
{
- if ((them) && (them == fd_ref_table[theirfd]))
+ if ((them) && (them == ServerInstance->fd_ref_table[theirfd]))
{
if (notify)
WriteOpers("*** Connecting user %s detected as using CGI:IRC (%s), but their host can't be resolved from their %s!", them->nick, them->host,typ.c_str());
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 75fa76489..2eb46d420 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -3081,7 +3081,7 @@ class ServernameResolver : public Resolver
*/
Link MyLink;
public:
- ServernameResolver(const std::string &hostname, Link x) : Resolver(hostname, DNS_QUERY_FORWARD), MyLink(x)
+ ServernameResolver(const std::string &hostname, Link x) : Resolver(ServerInstance, hostname, DNS_QUERY_FORWARD), MyLink(x)
{
/* Nothing in here, folks */
}
@@ -3122,7 +3122,7 @@ class SecurityIPResolver : public Resolver
private:
Link MyLink;
public:
- SecurityIPResolver(const std::string &hostname, Link x) : Resolver(hostname, DNS_QUERY_FORWARD), MyLink(x)
+ SecurityIPResolver(const std::string &hostname, Link x) : Resolver(ServerInstance, hostname, DNS_QUERY_FORWARD), MyLink(x)
{
}
diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp
index 9b3509f8d..8daabe889 100644
--- a/src/modules/m_testcommand.cpp
+++ b/src/modules/m_testcommand.cpp
@@ -26,11 +26,13 @@ using namespace std;
/* $ModDesc: Povides a proof-of-concept test /WOOT command */
+extern InspIRCd* ServerInstance;
+
class MyV6Resolver : public Resolver
{
bool fw;
public:
- MyV6Resolver(const std::string &source, bool forward) : Resolver(source, forward ? DNS_QUERY_AAAA : DNS_QUERY_PTR6)
+ MyV6Resolver(const std::string &source, bool forward) : Resolver(ServerInstance, source, forward ? DNS_QUERY_AAAA : DNS_QUERY_PTR6)
{
fw = forward;
}
diff --git a/src/users.cpp b/src/users.cpp
index e35c5cab8..35aea8b0f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -142,7 +142,7 @@ void userrec::StartDNSLookup()
}
UserResolver::UserResolver(InspIRCd* Instance, userrec* user, std::string to_resolve, bool forward) :
- Resolver(to_resolve, forward ? DNS_QUERY_FORWARD : DNS_QUERY_REVERSE), bound_user(user), ServerInstance(Instance)
+ Resolver(ServerInstance, to_resolve, forward ? DNS_QUERY_FORWARD : DNS_QUERY_REVERSE), bound_user(user)
{
this->fwd = forward;
this->bound_fd = user->fd;