]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Hide User#host and User#dhost and use accessors to modify them.
authorPeter Powell <petpow@saberuk.com>
Sun, 22 Oct 2017 20:53:24 +0000 (21:53 +0100)
committerPeter Powell <petpow@saberuk.com>
Sat, 28 Oct 2017 15:16:10 +0000 (16:16 +0100)
This removes the need to invalidate the cache after changing a
user's hostname.

39 files changed:
include/modules/sql.h
include/users.h
src/channels.cpp
src/command_parse.cpp
src/coremods/core_hostname_lookup.cpp
src/coremods/core_oper/cmd_kill.cpp
src/coremods/core_oper/cmd_oper.cpp
src/coremods/core_stats.cpp
src/coremods/core_userhost.cpp
src/coremods/core_who.cpp
src/coremods/core_whois.cpp
src/coremods/core_whowas.cpp
src/modules/m_alias.cpp
src/modules/m_callerid.cpp
src/modules/m_cgiirc.cpp
src/modules/m_check.cpp
src/modules/m_chghost.cpp
src/modules/m_clearchan.cpp
src/modules/m_cloaking.cpp
src/modules/m_customtitle.cpp
src/modules/m_dccallow.cpp
src/modules/m_hideoper.cpp
src/modules/m_hostcycle.cpp
src/modules/m_httpd_stats.cpp
src/modules/m_ircv3_chghost.cpp
src/modules/m_ldapoper.cpp
src/modules/m_messageflood.cpp
src/modules/m_repeat.cpp
src/modules/m_rline.cpp
src/modules/m_sasl.cpp
src/modules/m_sethost.cpp
src/modules/m_showwhois.cpp
src/modules/m_spanningtree/opertype.cpp
src/modules/m_spanningtree/uid.cpp
src/modules/m_sqloper.cpp
src/modules/m_watch.cpp
src/usermanager.cpp
src/users.cpp
src/xline.cpp

index 3f378d8b8d7f61423d01567d488abf5f61e56958..f81a85a33a746a95251c302100ddfb9c015ec2bc 100644 (file)
@@ -174,7 +174,7 @@ class SQLProvider : public DataProvider
        void PopulateUserInfo(User* user, ParamM& userinfo)
        {
                userinfo["nick"] = user->nick;
-               userinfo["host"] = user->host;
+               userinfo["host"] = user->GetRealHost();
                userinfo["ip"] = user->GetIPString();
                userinfo["gecos"] = user->fullname;
                userinfo["ident"] = user->ident;
index 03d94b28baf80b233befc7721c8ca56b8ea13c32..ef59646992a7a494c4bf117372f6b9696c412069 100644 (file)
@@ -244,6 +244,12 @@ class CoreExport User : public Extensible
         */
        std::string cachedip;
 
+       /** If set then the hostname which is displayed to users. */
+       std::string displayhost;
+
+       /** The real hostname of this user. */
+       std::string realhost;
+
        /** The user's mode list.
         * Much love to the STL for giving us an easy to use bitset, saving us RAM.
         * if (modes[modeid]) is set, then the mode is set.
@@ -270,11 +276,6 @@ class CoreExport User : public Extensible
         */
        typedef insp::intrusive_list<Membership> ChanList;
 
-       /** Hostname of connection.
-        * This should be valid as per RFC1035.
-        */
-       std::string host;
-
        /** Time that the object was instantiated (used for TS calculation etc)
        */
        time_t age;
@@ -307,11 +308,6 @@ class CoreExport User : public Extensible
         */
        std::string ident;
 
-       /** The host displayed to non-opers (used for cloaking etc).
-        * This usually matches the value of User::host.
-        */
-       std::string dhost;
-
        /** The users full name (GECOS).
         */
        std::string fullname;
@@ -364,6 +360,17 @@ class CoreExport User : public Extensible
         */
        const std::string& GetIPString();
 
+       /** Retrieves this user's hostname.
+        * @param uncloak If true then return the real host; otherwise, the display host.
+        */
+       const std::string& GetHost(bool uncloak) const;
+
+       /** Retrieves this user's displayed hostname. */
+       const std::string& GetDisplayedHost() const;
+
+       /** Retrieves this user's real hostname. */
+       const std::string& GetRealHost() const;
+
        /** Get CIDR mask, using default range, for this user
         */
        irc::sockets::cidr_mask GetCIDRMask();
@@ -675,16 +682,18 @@ class CoreExport User : public Extensible
         */
        bool SharesChannelWith(User *other);
 
-       /** Change the displayed host of a user.
-        * ALWAYS use this function, rather than writing User::dhost directly,
-        * as this triggers module events allowing the change to be syncronized to
-        * remote servers.
-        * @param host The new hostname to set
-        * @return True if the change succeeded, false if it didn't
-        * (a module vetoed the change).
+       /** Change the displayed hostname of this user.
+        * @param host The new displayed hostname of this user.
+        * @return True if the hostname was changed successfully; otherwise, false.
         */
        bool ChangeDisplayedHost(const std::string& host);
 
+       /** Change the real hostname of this user.
+        * @param host The new real hostname of this user.
+        * @param resetdisplay Whether to reset the display host to this value.
+        */
+       void ChangeRealHost(const std::string& host, bool resetdisplay);
+
        /** Change the ident (username) of a user.
         * ALWAYS use this function, rather than writing User::ident directly,
         * as this triggers module events allowing the change to be syncronized to
index bc23c680a07b309a83de482bc29ef7c1ed18dd93..1edc57693dfeb5f1345b1ee95edaa6b958bb3206 100644 (file)
@@ -381,8 +381,8 @@ bool Channel::CheckBan(User* user, const std::string& mask)
        if (InspIRCd::Match(nickIdent, prefix, NULL))
        {
                std::string suffix(mask, at + 1);
-               if (InspIRCd::Match(user->host, suffix, NULL) ||
-                       InspIRCd::Match(user->dhost, suffix, NULL) ||
+               if (InspIRCd::Match(user->GetRealHost(), suffix, NULL) ||
+                       InspIRCd::Match(user->GetDisplayedHost(), suffix, NULL) ||
                        InspIRCd::MatchCIDR(user->GetIPString(), suffix, NULL))
                        return true;
        }
index 9ffd20865236e1b7874f211fef472367958a2d86..3b3329261c1a0af2a551060a7aee95a7ab4d0390 100644 (file)
@@ -295,7 +295,7 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd)
                }
 
                ServerInstance->SNO->WriteToSnoMask('a', "%s denied for %s (%s@%s)",
-                               command.c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+                               command.c_str(), user->nick.c_str(), user->ident.c_str(), user->GetRealHost().c_str());
                return;
        }
 
index d150b85516623cab55ca27348dea23c0d6510323..2a8426be9c133523bacf1edd0d2d99218ad4e30e 100644 (file)
@@ -145,11 +145,7 @@ class UserResolver : public DNS::Request
                                                hostname->insert(0, "0");
 
                                        bound_user->WriteNotice("*** Found your hostname (" + *hostname + (r->cached ? ") -- cached" : ")"));
-                                       bound_user->host.assign(*hostname, 0, ServerInstance->Config->Limits.MaxHost);
-                                       bound_user->dhost = bound_user->host;
-
-                                       /* Invalidate cache */
-                                       bound_user->InvalidateCache();
+                                       bound_user->ChangeRealHost(hostname->substr(ServerInstance->Config->Limits.MaxHost), true);
                                }
                                else
                                {
index 8e8c4fadc5f5f08090cfda25a510ce7c03a3670c..8a453f7f1ea02947f238eb29352ca742c1b6cef0 100644 (file)
@@ -102,7 +102,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
                ServerInstance->Logs->Log("KILL", LOG_DEFAULT, "%s KILL: %s :%s!%s!%s (%s)",
                                IS_LOCAL(user) && IS_LOCAL(target) ? "LOCAL" : "REMOTE",
                                target->nick.c_str(),
-                               ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(),
+                               ServerInstance->Config->ServerName.c_str(), user->GetDisplayedHost().c_str(), user->nick.c_str(),
                                parameters[1].c_str());
 
        if (IS_LOCAL(target))
index 9c06583a8a7f595481c3ab09204d00dcfcc8d499..0322a059af0ea9da735c7d3a3d73ba093c75f466 100644 (file)
@@ -34,7 +34,7 @@ CmdResult CommandOper::HandleLocal(const std::vector<std::string>& parameters, L
        bool match_pass = false;
        bool match_hosts = false;
 
-       const std::string userHost = user->ident + "@" + user->host;
+       const std::string userHost = user->ident + "@" + user->GetRealHost();
        const std::string userIP = user->ident + "@" + user->GetIPString();
 
        ServerConfig::OperIndex::const_iterator i = ServerInstance->Config->oper_blocks.find(parameters[0]);
index 9d1fdf3fe17a19f5513c6540c12f2572e0cdbf39..7c3484917b259ae7d8d2e0a428aedd80583d057b 100644 (file)
@@ -58,7 +58,7 @@ static void GenerateStatsLl(Stats::Context& stats)
        for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
        {
                LocalUser* u = *i;
-               stats.AddRow(211, u->nick+"["+u->ident+"@"+(stats.GetSymbol() == 'l' ? u->dhost : u->GetIPString())+"] "+ConvToStr(u->eh.getSendQSize())+" "+ConvToStr(u->cmds_out)+" "+ConvToStr(u->bytes_out)+" "+ConvToStr(u->cmds_in)+" "+ConvToStr(u->bytes_in)+" "+ConvToStr(ServerInstance->Time() - u->signon));
+               stats.AddRow(211, u->nick+"["+u->ident+"@"+(stats.GetSymbol() == 'l' ? u->GetDisplayedHost() : u->GetIPString())+"] "+ConvToStr(u->eh.getSendQSize())+" "+ConvToStr(u->cmds_out)+" "+ConvToStr(u->bytes_out)+" "+ConvToStr(u->cmds_in)+" "+ConvToStr(u->bytes_in)+" "+ConvToStr(ServerInstance->Time() - u->signon));
        }
 }
 
@@ -76,7 +76,7 @@ void CommandStats::DoStats(Stats::Context& stats)
                ServerInstance->SNO->WriteToSnoMask('t',
                                "%s '%c' denied for %s (%s@%s)",
                                (IS_LOCAL(user) ? "Stats" : "Remote stats"),
-                               statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+                               statschar, user->nick.c_str(), user->ident.c_str(), user->GetRealHost().c_str());
                stats.AddRow(481, (std::string("Permission Denied - STATS ") + statschar + " requires the servers/auspex priv."));
                return;
        }
@@ -87,7 +87,7 @@ void CommandStats::DoStats(Stats::Context& stats)
        {
                stats.AddRow(219, statschar, "End of /STATS report");
                ServerInstance->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",
-                       (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+                       (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->GetRealHost().c_str());
                return;
        }
 
@@ -167,7 +167,7 @@ void CommandStats::DoStats(Stats::Context& stats)
                                if (!oper->server->IsULine())
                                {
                                        LocalUser* lu = IS_LOCAL(oper);
-                                       stats.AddRow(249, oper->nick + " (" + oper->ident + "@" + oper->dhost + ") Idle: " +
+                                       stats.AddRow(249, oper->nick + " (" + oper->ident + "@" + oper->GetDisplayedHost() + ") Idle: " +
                                                        (lu ? ConvToStr(ServerInstance->Time() - lu->idle_lastmsg) + " secs" : "unavailable"));
                                        idx++;
                                }
@@ -360,7 +360,7 @@ void CommandStats::DoStats(Stats::Context& stats)
 
        stats.AddRow(219, statschar, "End of /STATS report");
        ServerInstance->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",
-               (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+               (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->GetRealHost().c_str());
        return;
 }
 
index 3100995a82b86c76ebc3e769bf34dda168a13eb6..7ee093cdba5c86f2335dfd295751852fb9a91866 100644 (file)
@@ -72,7 +72,7 @@ CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, U
                        retbuf += (u->IsAway() ? '-' : '+');
                        retbuf += u->ident;
                        retbuf += '@';
-                       retbuf += (((u == user) || (has_privs)) ? u->host : u->dhost);
+                       retbuf += u->GetHost(u == user || has_privs);
                        retbuf += ' ';
                }
        }
index 677a1eb6d2c796db9f09adcdfdb3bbe72370ae5f..196bf0479181da4a4bc4249b0ce3457a24d033de 100644 (file)
@@ -128,7 +128,7 @@ bool CommandWho::whomatch(User* cuser, User* user, const char* matchtext)
                else if (opt_realname)
                        match = InspIRCd::Match(user->fullname, matchtext);
                else if (opt_showrealhost)
-                       match = InspIRCd::Match(user->host, matchtext, ascii_case_insensitive_map);
+                       match = InspIRCd::Match(user->GetRealHost(), matchtext, ascii_case_insensitive_map);
                else if (opt_ident)
                        match = InspIRCd::Match(user->ident, matchtext, ascii_case_insensitive_map);
                else if (opt_port)
@@ -161,7 +161,7 @@ bool CommandWho::whomatch(User* cuser, User* user, const char* matchtext)
                 * -- w00t
                 */
                if (!match)
-                       match = InspIRCd::Match(user->dhost, matchtext, ascii_case_insensitive_map);
+                       match = InspIRCd::Match(user->GetDisplayedHost(), matchtext, ascii_case_insensitive_map);
 
                if (!match)
                        match = InspIRCd::Match(user->nick, matchtext);
@@ -198,7 +198,7 @@ void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms,
 
        Numeric::Numeric wholine(RPL_WHOREPLY);
        wholine.push(memb ? memb->chan->name : "*").push(u->ident);
-       wholine.push(opt_showrealhost ? u->host : u->dhost);
+       wholine.push(u->GetHost(opt_showrealhost));
        if (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex"))
                wholine.push(ServerInstance->Config->HideWhoisServer);
        else
index 81e62c8e5474a580e9b8f473c0bdea224576d350..c2fac75773bb1bb9efdfed2e93b90a608ea47925 100644 (file)
@@ -177,10 +177,10 @@ void CommandWhois::DoWhois(LocalUser* user, User* dest, unsigned long signon, un
 {
        WhoisContextImpl whois(user, dest, lineevprov);
 
-       whois.SendLine(311, dest->ident, dest->dhost, '*', dest->fullname);
+       whois.SendLine(311, dest->ident, dest->GetDisplayedHost(), '*', dest->fullname);
        if (whois.IsSelfWhois() || user->HasPrivPermission("users/auspex"))
        {
-               whois.SendLine(378, InspIRCd::Format("is connecting from %s@%s %s", dest->ident.c_str(), dest->host.c_str(), dest->GetIPString().c_str()));
+               whois.SendLine(378, InspIRCd::Format("is connecting from %s@%s %s", dest->ident.c_str(), dest->GetRealHost().c_str(), dest->GetIPString().c_str()));
        }
 
        SendChanList(whois);
index 0bb47b2731546bade973a8191af552d96256ffad..af1f997374c68e88f34e22cf0b080d21b61d94e7 100644 (file)
@@ -230,8 +230,8 @@ void WhoWas::Manager::PurgeNick(WhoWas::Nick* nick)
 }
 
 WhoWas::Entry::Entry(User* user)
-       : host(user->host)
-       , dhost(user->dhost)
+       : host(user->GetRealHost())
+       , dhost(user->GetDisplayedHost())
        , ident(user->ident)
        , server(user->server->GetName())
        , gecos(user->fullname)
index 95667e7ed359c9ebe57f4887eabdb4fa319ecd3c..bdb242938de2d62f1c6b7ab33b04d9570ac40324 100644 (file)
@@ -296,7 +296,7 @@ class ModuleAlias : public Module
                                }
                                else if (!newline.compare(i, 5, "$host", 5))
                                {
-                                       result.append(user->host);
+                                       result.append(user->GetRealHost());
                                        i += 4;
                                }
                                else if (!newline.compare(i, 5, "$chan", 5))
@@ -312,7 +312,7 @@ class ModuleAlias : public Module
                                }
                                else if (!newline.compare(i, 6, "$vhost", 6))
                                {
-                                       result.append(user->dhost);
+                                       result.append(user->GetDisplayedHost());
                                        i += 5;
                                }
                                else if (!newline.compare(i, 12, "$requirement", 12))
index a00da6a6f8b4b1e3098494e0afe21e9b20e783c0..d191a9fc7da0d2e94435577be4433790d259000a 100644 (file)
@@ -399,7 +399,7 @@ public:
                        if (now > (dat->lastnotify + (time_t)notify_cooldown))
                        {
                                user->WriteNumeric(RPL_TARGNOTIFY, dest->nick, "has been informed that you messaged them.");
-                               dest->WriteRemoteNumeric(RPL_UMODEGMSG, user->nick, InspIRCd::Format("%s@%s", user->ident.c_str(), user->dhost.c_str()), InspIRCd::Format("is messaging you, and you have umode +g. Use /ACCEPT +%s to allow.",
+                               dest->WriteRemoteNumeric(RPL_UMODEGMSG, user->nick, InspIRCd::Format("%s@%s", user->ident.c_str(), user->GetDisplayedHost().c_str()), InspIRCd::Format("is messaging you, and you have umode +g. Use /ACCEPT +%s to allow.",
                                                user->nick.c_str()));
                                dat->lastnotify = now;
                        }
index 21098d7a7d7ee344a8ee0c9566d05a052b4f833a..2b80f6e5c1d4389752e163de97204d7c46ced5fc 100644 (file)
@@ -70,7 +70,7 @@ class WebIRCHost
                        return false;
 
                // Does the user's hostname match our hostmask?
-               if (InspIRCd::Match(user->host, hostmask, ascii_case_insensitive_map))
+               if (InspIRCd::Match(user->GetRealHost(), hostmask, ascii_case_insensitive_map))
                        return true;
 
                // Does the user's IP address match our hostmask?
@@ -134,17 +134,16 @@ class CommandWebIRC : public SplitCommand
 
                        // The user matched a WebIRC block!
                        gateway.set(user, parameters[1]);
-                       realhost.set(user, user->host);
+                       realhost.set(user, user->GetRealHost());
                        realip.set(user, user->GetIPString());
 
                        if (notify)
                                ServerInstance->SNO->WriteGlobalSno('w', "Connecting user %s is using a WebIRC gateway; changing their IP/host from %s/%s to %s/%s.",
-                                       user->nick.c_str(), user->GetIPString().c_str(), user->host.c_str(), parameters[3].c_str(), newhost.c_str());
+                                       user->nick.c_str(), user->GetIPString().c_str(), user->GetRealHost().c_str(), parameters[3].c_str(), newhost.c_str());
 
                        // Set the IP address and hostname sent via WEBIRC.
                        ChangeIP(user, parameters[3]);
-                       user->host = user->dhost = newhost;
-                       user->InvalidateCache();
+                       user->ChangeRealHost(newhost, true);
                        return CMD_SUCCESS;
                }
 
@@ -186,10 +185,9 @@ class CGIResolver : public DNS::Request
                                return;
 
                        if (notify)
-                               ServerInstance->SNO->WriteGlobalSno('w', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s", them->nick.c_str(), them->host.c_str(), ans_record.rdata.c_str());
+                               ServerInstance->SNO->WriteGlobalSno('w', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s", them->nick.c_str(), them->GetRealHost().c_str(), ans_record.rdata.c_str());
 
-                       them->host = them->dhost = ans_record.rdata;
-                       them->InvalidateCache();
+                       them->ChangeRealHost(ans_record.rdata, true);
                        lu->CheckLines(true);
                }
        }
@@ -202,7 +200,7 @@ class CGIResolver : public DNS::Request
                User* them = ServerInstance->FindUUID(theiruid);
                if ((them) && (!them->quitting))
                {
-                       ServerInstance->SNO->WriteToSnoMask('w', "Connecting user %s detected as using CGI:IRC (%s), but their host can't be resolved!", them->nick.c_str(), them->host.c_str());
+                       ServerInstance->SNO->WriteToSnoMask('w', "Connecting user %s detected as using CGI:IRC (%s), but their host can't be resolved!", them->nick.c_str(), them->GetRealHost().c_str());
                }
        }
 
@@ -233,11 +231,10 @@ class ModuleCgiIRC : public Module, public Whois::EventListener
 
        void HandleIdent(LocalUser* user, const std::string& newip)
        {
-               cmd.realhost.set(user, user->host);
+               cmd.realhost.set(user, user->GetRealHost());
                cmd.realip.set(user, user->GetIPString());
                ChangeIP(user, newip);
-               user->host = user->dhost = user->GetIPString();
-               user->InvalidateCache();
+               user->ChangeRealHost(user->GetIPString(), true);
                RecheckClass(user);
 
                // Don't create the resolver if the core couldn't put the user in a connect class or when dns is disabled
@@ -257,7 +254,7 @@ class ModuleCgiIRC : public Module, public Whois::EventListener
                                waiting.set(user, count - 1);
                        delete r;
                        if (cmd.notify)
-                                ServerInstance->SNO->WriteToSnoMask('w', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname; %s", user->nick.c_str(), user->host.c_str(), ex.GetReason().c_str());
+                                ServerInstance->SNO->WriteToSnoMask('w', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname; %s", user->nick.c_str(), user->GetRealHost().c_str(), ex.GetReason().c_str());
                }
        }
 
@@ -364,7 +361,7 @@ public:
        {
                for (std::vector<std::string>::const_iterator iter = hosts.begin(); iter != hosts.end(); ++iter)
                {
-                       if (!InspIRCd::Match(user->host, *iter, ascii_case_insensitive_map) && !InspIRCd::MatchCIDR(user->GetIPString(), *iter, ascii_case_insensitive_map))
+                       if (!InspIRCd::Match(user->GetRealHost(), *iter, ascii_case_insensitive_map) && !InspIRCd::MatchCIDR(user->GetIPString(), *iter, ascii_case_insensitive_map))
                                continue;
 
                        CheckIdent(user); // Nothing on failure.
index 2cb45ad435cef3ceb688c0010f4ab8371dc82736..b442dea9cf6c6b6f55e4f93bb87f8f08e8c30b01 100644 (file)
@@ -265,7 +265,7 @@ class CommandCheck : public Command
                                const UserManager::CloneCounts& clonecount = ServerInstance->Users->GetCloneCounts(i->first);
                                context.Write("member", InspIRCd::Format("%-3u %s%s (%s@%s) %s ", clonecount.global,
                                        i->second->GetAllPrefixChars().c_str(), i->first->nick.c_str(),
-                                       i->first->ident.c_str(), i->first->dhost.c_str(), i->first->fullname.c_str()));
+                                       i->first->ident.c_str(), i->first->GetDisplayedHost().c_str(), i->first->fullname.c_str()));
                        }
 
                        const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes();
@@ -283,7 +283,7 @@ class CommandCheck : public Command
                        const user_hash& users = ServerInstance->Users->GetUsers();
                        for (user_hash::const_iterator a = users.begin(); a != users.end(); ++a)
                        {
-                               if (InspIRCd::Match(a->second->host, parameters[0], ascii_case_insensitive_map) || InspIRCd::Match(a->second->dhost, parameters[0], ascii_case_insensitive_map))
+                               if (InspIRCd::Match(a->second->GetRealHost(), parameters[0], ascii_case_insensitive_map) || InspIRCd::Match(a->second->GetDisplayedHost(), parameters[0], ascii_case_insensitive_map))
                                {
                                        /* host or vhost matches mask */
                                        context.Write("match", ConvToStr(++x) + " " + a->second->GetFullRealHost() + " " + a->second->GetIPString() + " " + a->second->fullname);
index ad8353cbd54191ad0efbb30da8f66512f2baf6a0..8b588b63dd5d38073c4faf0cf48ee8132dd0bc29 100644 (file)
@@ -66,7 +66,7 @@ class CommandChghost : public Command
                        if ((dest->ChangeDisplayedHost(parameters[1])) && (!user->server->IsULine()))
                        {
                                // fix by brain - ulines set hosts silently
-                               ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used CHGHOST to make the displayed host of "+dest->nick+" become "+dest->dhost);
+                               ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used CHGHOST to make the displayed host of "+dest->nick+" become "+dest->GetDisplayedHost());
                        }
                }
 
index 1b4b8724ae15319127985def89818bd8db600d30..08a7a88b542d054c23b27d4cede8cfc3d20bb26e 100644 (file)
@@ -116,7 +116,7 @@ class CommandClearChan : public Command
                                XLine* xline;
                                try
                                {
-                                       mask = ((method[0] == 'Z') ? curr->GetIPString() : "*@" + curr->host);
+                                       mask = ((method[0] == 'Z') ? curr->GetIPString() : "*@" + curr->GetRealHost());
                                        xline = xlf->Generate(ServerInstance->Time(), 60*60, user->nick, reason, mask);
                                }
                                catch (ModuleException&)
index 7e9c78b319489375e9c06138e424ec4f62782687..f9a7fa38027cc28b2b1b9e81e0d77dba00ae04a3 100644 (file)
@@ -90,7 +90,7 @@ class CloakUser : public ModeHandler
                if (adding)
                {
                        // assume this is more correct
-                       if (user->registered != REG_ALL && user->host != user->dhost)
+                       if (user->registered != REG_ALL && user->GetRealHost() != user->GetDisplayedHost())
                                return MODEACTION_DENY;
 
                        std::string* cloak = ext.get(user);
@@ -116,7 +116,7 @@ class CloakUser : public ModeHandler
                         * and make it match the displayed one.
                         */
                        user->SetMode(this, false);
-                       user->ChangeDisplayedHost(user->host.c_str());
+                       user->ChangeDisplayedHost(user->GetRealHost().c_str());
                        return MODEACTION_ALLOW;
                }
        }
@@ -281,7 +281,7 @@ class ModuleCloaking : public Module
                OnUserConnect(lu);
                std::string* cloak = cu.ext.get(user);
                /* Check if they have a cloaked host, but are not using it */
-               if (cloak && *cloak != user->dhost)
+               if (cloak && *cloak != user->GetDisplayedHost())
                {
                        const std::string cloakMask = user->nick + "!" + user->ident + "@" + *cloak;
                        if (InspIRCd::Match(cloakMask, mask))
@@ -384,7 +384,7 @@ class ModuleCloaking : public Module
                if (cloak)
                        return;
 
-               cu.ext.set(dest, GenCloak(dest->client_sa, dest->GetIPString(), dest->host));
+               cu.ext.set(dest, GenCloak(dest->client_sa, dest->GetIPString(), dest->GetRealHost()));
        }
 };
 
index 30c0aa4f2d5826093f7f98865b07f7b5f9a3cc7b..2a08592ea16bef9b3aa5fd7caed51c3338f6793e 100644 (file)
@@ -35,7 +35,7 @@ class CommandTitle : public Command
 
        CmdResult Handle(const std::vector<std::string> &parameters, User* user)
        {
-               const std::string userHost = user->ident + "@" + user->host;
+               const std::string userHost = user->ident + "@" + user->GetRealHost();
                const std::string userIP = user->ident + "@" + user->GetIPString();
 
                ConfigTagList tags = ServerInstance->Config->ConfTags("title");
index edf9d012f72277171a5803713d0341c5dd666279..e687e1341386b881888b7acd0c09fd4c8af60601 100644 (file)
@@ -181,7 +181,7 @@ class CommandDccallow : public Command
                                                }
                                        }
 
-                                       std::string mask = target->nick+"!"+target->ident+"@"+target->dhost;
+                                       std::string mask = target->nick+"!"+target->ident+"@"+target->GetDisplayedHost();
                                        std::string default_length = ServerInstance->Config->ConfValue("dccallow")->getString("length");
 
                                        unsigned long length;
@@ -382,14 +382,14 @@ class ModuleDCCAllow : public Module
                                                        return MOD_RES_PASSTHRU;
 
                                                user->WriteNotice("The user " + u->nick + " is not accepting DCC SENDs from you. Your file " + filename + " was not sent.");
-                                               u->WriteNotice(user->nick + " (" + user->ident + "@" + user->dhost + ") attempted to send you a file named " + filename + ", which was blocked.");
+                                               u->WriteNotice(user->nick + " (" + user->ident + "@" + user->GetDisplayedHost() + ") attempted to send you a file named " + filename + ", which was blocked.");
                                                u->WriteNotice("If you trust " + user->nick + " and were expecting this, you can type /DCCALLOW HELP for information on the DCCALLOW system.");
                                                return MOD_RES_DENY;
                                        }
                                        else if ((blockchat) && (stdalgo::string::equalsci(type, "CHAT")))
                                        {
                                                user->WriteNotice("The user " + u->nick + " is not accepting DCC CHAT requests from you.");
-                                               u->WriteNotice(user->nick + " (" + user->ident + "@" + user->dhost + ") attempted to initiate a DCC CHAT session, which was blocked.");
+                                               u->WriteNotice(user->nick + " (" + user->ident + "@" + user->GetDisplayedHost() + ") attempted to initiate a DCC CHAT session, which was blocked.");
                                                u->WriteNotice("If you trust " + user->nick + " and were expecting this, you can type /DCCALLOW HELP for information on the DCCALLOW system.");
                                                return MOD_RES_DENY;
                                        }
index ff9e78ca23d1a512e31a9e8350572485f3dc76e5..6650b7f16d26df98a0eca2d988f51ff848a89808 100644 (file)
@@ -138,7 +138,7 @@ class ModuleHideOper : public Module, public Whois::LineEventListener
                        if (!oper->server->IsULine() && (stats.GetSource()->IsOper() || !oper->IsModeSet(hm)))
                        {
                                LocalUser* lu = IS_LOCAL(oper);
-                               stats.AddRow(249, oper->nick + " (" + oper->ident + "@" + oper->dhost + ") Idle: " +
+                               stats.AddRow(249, oper->nick + " (" + oper->ident + "@" + oper->GetDisplayedHost() + ") Idle: " +
                                                (lu ? ConvToStr(ServerInstance->Time() - lu->idle_lastmsg) + " secs" : "unavailable"));
                                count++;
                        }
index 621f06a279e53e715feaa36c58a053603fd0e93c..0f7405dcc8b83f45ca93428cffeadc97c3f343c0 100644 (file)
@@ -109,7 +109,7 @@ class ModuleHostCycle : public Module
 
        void OnChangeIdent(User* user, const std::string& newident) CXX11_OVERRIDE
        {
-               DoHostCycle(user, newident, user->dhost, "Changing ident");
+               DoHostCycle(user, newident, user->GetDisplayedHost(), "Changing ident");
        }
 
        void OnChangeHost(User* user, const std::string& newhost) CXX11_OVERRIDE
index de5a61e4dc29972e07ea6e8ead15d6b7f8ef45e3..00cab319790fb769a56911d2dd14b1509a3164d9 100644 (file)
@@ -183,7 +183,7 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener
 
                                        data << "<user>";
                                        data << "<nickname>" << u->nick << "</nickname><uuid>" << u->uuid << "</uuid><realhost>"
-                                               << u->host << "</realhost><displayhost>" << u->dhost << "</displayhost><gecos>"
+                                               << u->GetRealHost() << "</realhost><displayhost>" << u->GetDisplayedHost() << "</displayhost><gecos>"
                                                << Sanitize(u->fullname) << "</gecos><server>" << u->server->GetName() << "</server>";
                                        if (u->IsAway())
                                                data << "<away>" << Sanitize(u->awaymsg) << "</away><awaytime>" << u->awaytime << "</awaytime>";
index af3503108a556b58aed417e9981c68dcfe7e22fd..0a9e055b4d32a089de0c52f773331cc2fa251f42 100644 (file)
@@ -40,7 +40,7 @@ class ModuleIRCv3ChgHost : public Module
 
        void OnChangeIdent(User* user, const std::string& newident) CXX11_OVERRIDE
        {
-               DoChgHost(user, newident, user->dhost);
+               DoChgHost(user, newident, user->GetDisplayedHost());
        }
 
        void OnChangeHost(User* user, const std::string& newhost) CXX11_OVERRIDE
index 9deb9a203790b703dde614651c00312271ff900f..45e83333afd890e09ab05a96d7de0d4d49f2e44e 100644 (file)
@@ -217,7 +217,7 @@ class ModuleLDAPAuth : public Module
                                return MOD_RES_PASSTHRU;
 
                        std::string acceptedhosts = tag->getString("host");
-                       std::string hostname = user->ident + "@" + user->host;
+                       std::string hostname = user->ident + "@" + user->GetRealHost();
                        if (!InspIRCd::MatchMask(acceptedhosts, hostname, user->GetIPString()))
                                return MOD_RES_PASSTHRU;
 
index 404c9b861a2e88ffc661010499f5c7d30ece3d23..fa929294c9a8427add9809e12d4ea4527613ea23 100644 (file)
@@ -138,7 +138,7 @@ class ModuleMsgFlood : public Module
                                if (f->ban)
                                {
                                        Modes::ChangeList changelist;
-                                       changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->dhost);
+                                       changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->GetDisplayedHost());
                                        ServerInstance->Modes->Process(ServerInstance->FakeClient, dest, NULL, changelist);
                                }
 
index aa7dc762bbd1ce18c7f54e210426e50bbd5887a6..f1ebe18e5b4adc1cf5f4b1870245babd6db6a37d 100644 (file)
@@ -384,7 +384,7 @@ class RepeatModule : public Module
                        if (settings->Action == ChannelSettings::ACT_BAN)
                        {
                                Modes::ChangeList changelist;
-                               changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->dhost);
+                               changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->GetDisplayedHost());
                                ServerInstance->Modes->Process(ServerInstance->FakeClient, chan, NULL, changelist);
                        }
 
index eb54e56b71f411119b08bb9bf54df31867d91a9b..6fd7b832c568b190633aa1d80551a688b5dc423f 100644 (file)
@@ -62,7 +62,7 @@ class RLine : public XLine
                if (lu && lu->exempt)
                        return false;
 
-               const std::string host = u->nick + "!" + u->ident + "@" + u->host + " " + u->fullname;
+               const std::string host = u->nick + "!" + u->ident + "@" + u->GetRealHost() + " " + u->fullname;
                const std::string ip = u->nick + "!" + u->ident + "@" + u->GetIPString() + " " + u->fullname;
                return (regex->Matches(host) || regex->Matches(ip));
        }
index eedf968b404a5af062ca01030006eaabebf7a350..e8a0e12a908b2bcbf79f60bb044b1c8d7d038e9f 100644 (file)
@@ -172,7 +172,7 @@ class SaslAuthenticator
        void SendHostIP()
        {
                parameterlist params;
-               params.push_back(user->host);
+               params.push_back(user->GetRealHost());
                params.push_back(user->GetIPString());
                params.push_back(SSLIOHook::IsSSL(&user->eh) ? "S" : "P");
 
index e2a5dc281b603b38c8a5e9afd831956e7a9113f8..b37207b4fa7e93020aa3bb13ac0d795c9225bc52 100644 (file)
@@ -53,7 +53,7 @@ class CommandSethost : public Command
 
                if (user->ChangeDisplayedHost(parameters[0]))
                {
-                       ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SETHOST to change their displayed host to "+user->dhost);
+                       ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SETHOST to change their displayed host to "+user->GetDisplayedHost());
                        return CMD_SUCCESS;
                }
 
index 3cb85f3fb1b18d502ee393cddbc1c01d9694351f..99774563d3d827a7b7612210afb8eb8962c7e87d 100644 (file)
@@ -50,7 +50,7 @@ class WhoisNoticeCmd : public Command
        void HandleFast(User* dest, User* src)
        {
                dest->WriteNotice("*** " + src->nick + " (" + src->ident + "@" +
-                       (dest->HasPrivPermission("users/auspex") ? src->host : src->dhost) +
+                       src->GetHost(dest->HasPrivPermission("users/auspex")) + 
                        ") did a /whois on you");
        }
 
index b1d0c327e3b693fd8082c6c87ca62d73bf27b68c..4b1dce23c9794d76241f3a63de170c72749a37dd 100644 (file)
@@ -52,7 +52,7 @@ CmdResult CommandOpertype::HandleRemote(RemoteUser* u, std::vector<std::string>&
                        return CMD_SUCCESS;
        }
 
-       ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server->GetName().c_str(), u->nick.c_str(),u->ident.c_str(), u->host.c_str(), opertype.c_str());
+       ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server->GetName().c_str(), u->nick.c_str(),u->ident.c_str(), u->GetRealHost().c_str(), opertype.c_str());
        return CMD_SUCCESS;
 }
 
index 2a17943e9876934d3ee288ef116cc401c60997c2..905061cc73e6877d7a59db0af98027e69b766b4b 100644 (file)
@@ -73,8 +73,8 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st
        RemoteUser* _new = new SpanningTree::RemoteUser(params[0], remoteserver);
        ServerInstance->Users->clientlist[params[2]] = _new;
        _new->nick = params[2];
-       _new->host = params[3];
-       _new->dhost = params[4];
+       _new->ChangeRealHost(params[3], false);
+       _new->ChangeDisplayedHost(params[4]);
        _new->ident = params[5];
        _new->fullname = params.back();
        _new->registered = REG_ALL;
@@ -157,8 +157,8 @@ CommandUID::Builder::Builder(User* user)
        push(user->uuid);
        push_int(user->age);
        push(user->nick);
-       push(user->host);
-       push(user->dhost);
+       push(user->GetRealHost());
+       push(user->GetDisplayedHost());
        push(user->ident);
        push(user->GetIPString());
        push_int(user->signon);
index b5f0d6c470968f4f09c7f7d57f03d1077043adfd..b6aa90f490f080819611a27795a463c95c45bfca 100644 (file)
@@ -88,7 +88,7 @@ class OpMeQuery : public SQLQuery
 
                std::string hostname(user->ident);
 
-               hostname.append("@").append(user->host);
+               hostname.append("@").append(user->GetRealHost());
 
                if (InspIRCd::MatchMask(pattern, hostname, user->GetIPString()))
                {
index 6e9a6f9ed716be97ee34dcf1953e8214bccce1f1..7fa8ad8f48cc1f010dfa96be2bb4f6069255423b 100644 (file)
@@ -53,9 +53,9 @@ class CommandWatch : public SplitCommand
                {
                        // The away state should only be sent if the client requests away notifications for a nick but 2.0 always sends them so we do that too
                        if (target->IsAway())
-                               user->WriteNumeric(RPL_NOWISAWAY, target->nick, target->ident, target->dhost, (unsigned long)target->awaytime, "is away");
+                               user->WriteNumeric(RPL_NOWISAWAY, target->nick, target->ident, target->GetDisplayedHost(), (unsigned long)target->awaytime, "is away");
                        else
-                               user->WriteNumeric(RPL_NOWON, target->nick, target->ident, target->dhost, (unsigned long)target->age, "is online");
+                               user->WriteNumeric(RPL_NOWON, target->nick, target->ident, target->GetDisplayedHost(), (unsigned long)target->age, "is online");
                }
                else if (show_offline)
                        user->WriteNumeric(RPL_NOWOFF, nick, "*", "*", "0", "is offline");
@@ -88,7 +88,7 @@ class CommandWatch : public SplitCommand
 
                User* target = IRCv3::Monitor::Manager::FindNick(nick);
                if (target)
-                       user->WriteNumeric(RPL_WATCHOFF, target->nick, target->ident, target->dhost, (unsigned long)target->age, "stopped watching");
+                       user->WriteNumeric(RPL_WATCHOFF, target->nick, target->ident, target->GetDisplayedHost(), (unsigned long)target->age, "stopped watching");
                else
                        user->WriteNumeric(RPL_WATCHOFF, nick, "*", "*", "0", "stopped watching");
        }
@@ -190,7 +190,7 @@ class ModuleWatch : public Module
                        return;
 
                Numeric::Numeric num(numeric);
-               num.push(nick).push(user->ident).push(user->dhost).push(ConvToStr(shownts)).push(numerictext);
+               num.push(nick).push(user->ident).push(user->GetDisplayedHost()).push(ConvToStr(shownts)).push(numerictext);
                for (IRCv3::Monitor::WatcherList::const_iterator i = list->begin(); i != list->end(); ++i)
                {
                        LocalUser* curr = *i;
index 12ec36ec7ce16d0db4477c5978c241508c1563cd..02c030a42434b1c1414deebe2705e8e05532e432 100644 (file)
@@ -177,7 +177,7 @@ void UserManager::QuitUser(User* user, const std::string& quitreason, const std:
        user->quitting = true;
 
        ServerInstance->Logs->Log("USERS", LOG_DEBUG, "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitreason.c_str());
-       user->Write("ERROR :Closing link: (%s@%s) [%s]", user->ident.c_str(), user->host.c_str(), operreason ? operreason->c_str() : quitreason.c_str());
+       user->Write("ERROR :Closing link: (%s@%s) [%s]", user->ident.c_str(), user->GetRealHost().c_str(), operreason ? operreason->c_str() : quitreason.c_str());
 
        std::string reason;
        reason.assign(quitreason, 0, ServerInstance->Config->Limits.MaxQuit);
index 9fef906d16d83de783acfe89e93de293563443bf..aa5031b2b1632bdda7c885f0ad3b3d1935d6da83 100644 (file)
@@ -106,7 +106,7 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so
        eh.SetFd(myfd);
        memcpy(&client_sa, client, sizeof(irc::sockets::sockaddrs));
        memcpy(&server_sa, servaddr, sizeof(irc::sockets::sockaddrs));
-       dhost = host = GetIPString();
+       ChangeRealHost(GetIPString(), true);
 }
 
 User::~User()
@@ -119,7 +119,7 @@ const std::string& User::MakeHost()
                return this->cached_makehost;
 
        // XXX: Is there really a need to cache this?
-       this->cached_makehost = ident + "@" + host;
+       this->cached_makehost = ident + "@" + GetRealHost();
        return this->cached_makehost;
 }
 
@@ -139,7 +139,7 @@ const std::string& User::GetFullHost()
                return this->cached_fullhost;
 
        // XXX: Is there really a need to cache this?
-       this->cached_fullhost = nick + "!" + ident + "@" + dhost;
+       this->cached_fullhost = nick + "!" + ident + "@" + GetDisplayedHost();
        return this->cached_fullhost;
 }
 
@@ -149,7 +149,7 @@ const std::string& User::GetFullRealHost()
                return this->cached_fullrealhost;
 
        // XXX: Is there really a need to cache this?
-       this->cached_fullrealhost = nick + "!" + ident + "@" + host;
+       this->cached_fullrealhost = nick + "!" + ident + "@" + GetRealHost();
        return this->cached_fullrealhost;
 }
 
@@ -360,7 +360,7 @@ void User::Oper(OperInfo* info)
        }
 
        ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",
-               nick.c_str(), ident.c_str(), host.c_str(), oper->name.c_str(), opername.c_str());
+               nick.c_str(), ident.c_str(), GetRealHost().c_str(), oper->name.c_str(), opername.c_str());
        this->WriteNumeric(RPL_YOUAREOPER, InspIRCd::Format("You are now %s %s", strchr("aeiouAEIOU", oper->name[0]) ? "an" : "a", oper->name.c_str()));
 
        ServerInstance->Logs->Log("OPER", LOG_DEFAULT, "%s opered as type: %s", GetFullRealHost().c_str(), oper->name.c_str());
@@ -692,6 +692,21 @@ const std::string& User::GetIPString()
        return cachedip;
 }
 
+const std::string& User::GetHost(bool uncloak) const
+{
+       return uncloak ? GetRealHost() : GetDisplayedHost();
+}
+
+const std::string& User::GetDisplayedHost() const
+{
+       return displayhost.empty() ? realhost : displayhost;
+}
+
+const std::string& User::GetRealHost() const
+{
+       return realhost;
+}
+
 irc::sockets::cidr_mask User::GetCIDRMask()
 {
        int range = 0;
@@ -997,7 +1012,7 @@ bool User::ChangeName(const std::string& gecos)
 
 bool User::ChangeDisplayedHost(const std::string& shost)
 {
-       if (dhost == shost)
+       if (GetDisplayedHost() == shost)
                return true;
 
        if (IS_LOCAL(this))
@@ -1010,15 +1025,34 @@ bool User::ChangeDisplayedHost(const std::string& shost)
 
        FOREACH_MOD(OnChangeHost, (this,shost));
 
-       this->dhost.assign(shost, 0, ServerInstance->Config->Limits.MaxHost);
+       if (realhost == shost)
+               this->displayhost.clear();
+       else
+               this->displayhost.assign(shost, 0, ServerInstance->Config->Limits.MaxHost);
+
        this->InvalidateCache();
 
        if (IS_LOCAL(this))
-               this->WriteNumeric(RPL_YOURDISPLAYEDHOST, this->dhost, "is now your displayed host");
+               this->WriteNumeric(RPL_YOURDISPLAYEDHOST, this->GetDisplayedHost(), "is now your displayed host");
 
        return true;
 }
 
+void User::ChangeRealHost(const std::string& host, bool resetdisplay)
+{
+       if (displayhost == host)
+               return;
+       
+       if (displayhost.empty() && !resetdisplay)
+               displayhost = realhost;
+
+       else if (displayhost == host || resetdisplay)
+               displayhost.clear();
+
+       realhost = host;
+       this->InvalidateCache();
+}
+
 bool User::ChangeIdent(const std::string& newident)
 {
        if (this->ident == newident)
@@ -1085,7 +1119,7 @@ void LocalUser::SetClass(const std::string &explicit_name)
 
                        /* check if host matches.. */
                        if (!InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) &&
-                           !InspIRCd::MatchCIDR(this->host, c->GetHost(), NULL))
+                           !InspIRCd::MatchCIDR(this->GetRealHost(), c->GetHost(), NULL))
                        {
                                ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "No host match (for %s)", c->GetHost().c_str());
                                continue;
index 257af9ca7a72ba4a63b6b64a8910fa722761e3ad..f21b2b4fb5d4bc623a32d5cf3b611baf5652ca95 100644 (file)
@@ -548,7 +548,7 @@ bool KLine::Matches(User *u)
 
        if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map))
        {
-               if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) ||
+               if (InspIRCd::MatchCIDR(u->GetRealHost(), this->hostmask, ascii_case_insensitive_map) ||
                    InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map))
                {
                        return true;
@@ -571,7 +571,7 @@ bool GLine::Matches(User *u)
 
        if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map))
        {
-               if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) ||
+               if (InspIRCd::MatchCIDR(u->GetRealHost(), this->hostmask, ascii_case_insensitive_map) ||
                    InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map))
                {
                        return true;
@@ -594,7 +594,7 @@ bool ELine::Matches(User *u)
 
        if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map))
        {
-               if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) ||
+               if (InspIRCd::MatchCIDR(u->GetRealHost(), this->hostmask, ascii_case_insensitive_map) ||
                    InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map))
                {
                        return true;