From 64faca29b377185c4615c8f2e4eecedc7ad045d1 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Thu, 16 Apr 2015 22:51:41 +0200 Subject: [PATCH] cmd_userhost Fix +H hidden opers being shown as opers --- src/commands/cmd_userhost.cpp | 11 +++++++++-- 1 file 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& 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& 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& parameters, U retbuf = retbuf + u->ident + "@"; - if (user->HasPrivPermission("users/auspex")) + if (has_privs) { retbuf = retbuf + u->host; } -- 2.39.2