diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-03-03 23:13:54 +0100 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-03-11 20:48:58 +0100 |
commit | fe9e5947552cc8b044a7ce47ffbee06ee7283886 (patch) | |
tree | 55a81f48ccfe503d4d6ed84798d042ee87b92ca8 | |
parent | 2bdbb2878efb600af81513147983aeac7bd62331 (diff) |
Fix m_dnsbl not checking cgiirc users when the cgiirc address is elined
-rw-r--r-- | include/modules.h | 2 | ||||
-rw-r--r-- | include/users.h | 8 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 8 | ||||
-rw-r--r-- | src/users.cpp | 13 |
4 files changed, 17 insertions, 14 deletions
diff --git a/include/modules.h b/include/modules.h index 2b9237a5d..e450233da 100644 --- a/include/modules.h +++ b/include/modules.h @@ -116,7 +116,7 @@ struct ModResult { * and numerical comparisons in preprocessor macros if they wish to support * multiple versions of InspIRCd in one file. */ -#define INSPIRCD_VERSION_API 3 +#define INSPIRCD_VERSION_API 4 /** * This #define allows us to call a method in all diff --git a/include/users.h b/include/users.h index 0fc63c9b8..88abfbcd1 100644 --- a/include/users.h +++ b/include/users.h @@ -393,9 +393,9 @@ class CoreExport User : public Extensible /** Sets the client IP for this user * @return true if the conversion was successful */ - virtual bool SetClientIP(const char* sip); + virtual bool SetClientIP(const char* sip, bool recheck_eline = true); - virtual void SetClientIP(const irc::sockets::sockaddrs& sa); + virtual void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true); /** Constructor * @throw CoreException if the UID allocated to the user already exists @@ -825,9 +825,9 @@ class CoreExport LocalUser : public User, public InviteBase */ void SetClass(const std::string &explicit_name = ""); - bool SetClientIP(const char* sip); + bool SetClientIP(const char* sip, bool recheck_eline = true); - void SetClientIP(const irc::sockets::sockaddrs& sa); + void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true); void SendText(const std::string& line); void Write(const std::string& text); diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 63efd6bae..d4ef602b3 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -176,9 +176,9 @@ class ModuleCgiIRC : public Module CommandWebirc cmd; LocalIntExt waiting; - static void RecheckElineAndClass(LocalUser* user) + static void RecheckClass(LocalUser* user) { - user->exempt = (ServerInstance->XLines->MatchesLine("E", user) != NULL); + user->MyClass = NULL; user->SetClass(); user->CheckClass(); } @@ -198,7 +198,7 @@ class ModuleCgiIRC : public Module ChangeIP(user, newip); user->host = user->dhost = user->GetIPString(); user->InvalidateCache(); - RecheckElineAndClass(user); + RecheckClass(user); // Don't create the resolver if the core couldn't put the user in a connect class or when dns is disabled if (user->quitting || ServerInstance->Config->NoUserDns) return; @@ -295,7 +295,7 @@ public: std::string* webirc_hostname = cmd.webirc_hostname.get(user); user->host = user->dhost = (webirc_hostname ? *webirc_hostname : user->GetIPString()); - RecheckElineAndClass(user); + RecheckClass(user); if (user->quitting) return MOD_RES_DENY; diff --git a/src/users.cpp b/src/users.cpp index 30df3c153..adfa7642c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -987,36 +987,39 @@ irc::sockets::cidr_mask User::GetCIDRMask() return irc::sockets::cidr_mask(client_sa, range); } -bool User::SetClientIP(const char* sip) +bool User::SetClientIP(const char* sip, bool recheck_eline) { cachedip.clear(); cached_hostip.clear(); return irc::sockets::aptosa(sip, 0, client_sa); } -void User::SetClientIP(const irc::sockets::sockaddrs& sa) +void User::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline) { cachedip.clear(); cached_hostip.clear(); memcpy(&client_sa, &sa, sizeof(irc::sockets::sockaddrs)); } -bool LocalUser::SetClientIP(const char* sip) +bool LocalUser::SetClientIP(const char* sip, bool recheck_eline) { irc::sockets::sockaddrs sa; if (!irc::sockets::aptosa(sip, 0, sa)) // Invalid return false; - LocalUser::SetClientIP(sa); + LocalUser::SetClientIP(sa, recheck_eline); return true; } -void LocalUser::SetClientIP(const irc::sockets::sockaddrs& sa) +void LocalUser::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline) { if (sa != client_sa) { User::SetClientIP(sa); + if (recheck_eline) + this->exempt = (ServerInstance->XLines->MatchesLine("E", this) != NULL); + FOREACH_MOD(I_OnSetUserIP,OnSetUserIP(this)); } } |