]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Only show the WebIRC gateway name to unprivileged users.
authorSadie Powell <sadie@witchery.services>
Sun, 11 Apr 2021 14:03:06 +0000 (15:03 +0100)
committerSadie Powell <sadie@witchery.services>
Sun, 11 Apr 2021 14:03:06 +0000 (15:03 +0100)
src/modules/m_cgiirc.cpp

index 0759854a246e120ee6978c184dd40627cd28ce9e..434043e46966edba34fd6ca66b3fdf92b86a667c 100644 (file)
@@ -532,11 +532,16 @@ class ModuleCgiIRC
        void OnWhois(Whois::Context& whois) CXX11_OVERRIDE
        {
                // If these fields are not set then the client is not using a gateway.
-               const std::string* realhost = cmdwebirc.realhost.get(whois.GetTarget());
-               const std::string* realip = cmdwebirc.realip.get(whois.GetTarget());
+               std::string* realhost = cmdwebirc.realhost.get(whois.GetTarget());
+               std::string* realip = cmdwebirc.realip.get(whois.GetTarget());
                if (!realhost || !realip)
                        return;
 
+               // If the source doesn't have the right privs then only show the gateway name.
+               std::string hidden = "*";
+               if (!whois.GetSource()->HasPrivPermission("users/auspex"))
+                       realhost = realip = &hidden;
+
                const std::string* gateway = cmdwebirc.gateway.get(whois.GetTarget());
                if (gateway)
                        whois.SendLine(RPL_WHOISGATEWAY, *realhost, *realip, "is connected via the " + *gateway + " WebIRC gateway");