summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-04-16 22:51:41 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-04-16 22:51:41 +0200
commit64faca29b377185c4615c8f2e4eecedc7ad045d1 (patch)
tree16cde391dfed0b26b4d262295ebfc247f469b06c
parentc490a9061f18eceb69eb4bb5ed9eb32fd90400fe (diff)
cmd_userhost Fix +H hidden opers being shown as opers
-rw-r--r--src/commands/cmd_userhost.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/commands/cmd_userhost.cpp b/src/commands/cmd_userhost.cpp
index 79685388f..7e1efd637 100644
--- a/src/commands/cmd_userhost.cpp
+++ b/src/commands/cmd_userhost.cpp
@@ -49,6 +49,8 @@ CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, U
unsigned int max = parameters.size();
if (max > 5)
max = 5;
+
+ bool has_privs = user->HasPrivPermission("users/auspex");
for (unsigned int i = 0; i < max; i++)
{
User *u = ServerInstance->FindNickOnly(parameters[i]);
@@ -58,7 +60,12 @@ CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, U
retbuf = retbuf + u->nick;
if (IS_OPER(u))
- retbuf = retbuf + "*";
+ {
+ // XXX: +H hidden opers must not be shown as opers
+ ModeHandler* mh = ServerInstance->Modes->FindMode('H', MODETYPE_USER);
+ if ((u == user) || (has_privs) || (!mh) || (!u->IsModeSet('H')) || (mh->name != "hideoper"))
+ retbuf += '*';
+ }
retbuf = retbuf + "=";
@@ -69,7 +76,7 @@ CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, U
retbuf = retbuf + u->ident + "@";
- if (user->HasPrivPermission("users/auspex"))
+ if (has_privs)
{
retbuf = retbuf + u->host;
}