mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Don't allow /who to match servers when HideWhoisServer is enabled (unless the user has the privilege)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11692 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
dc88f5153a
commit
933c31331b
@ -54,7 +54,7 @@ class CommandWho : public Command
|
|||||||
* @return A value from CmdResult to indicate command success or failure.
|
* @return A value from CmdResult to indicate command success or failure.
|
||||||
*/
|
*/
|
||||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||||
bool whomatch(User* user, const char* matchtext);
|
bool whomatch(User* cuser, User* user, const char* matchtext);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -74,7 +74,7 @@ static const std::string& get_first_visible_channel(User *u)
|
|||||||
return star;
|
return star;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandWho::whomatch(User* user, const char* matchtext)
|
bool CommandWho::whomatch(User* cuser, User* user, const char* matchtext)
|
||||||
{
|
{
|
||||||
bool match = false;
|
bool match = false;
|
||||||
bool positive = false;
|
bool positive = false;
|
||||||
@ -157,7 +157,8 @@ bool CommandWho::whomatch(User* user, const char* matchtext)
|
|||||||
if (!match)
|
if (!match)
|
||||||
match = InspIRCd::Match(user->nick, matchtext);
|
match = InspIRCd::Match(user->nick, matchtext);
|
||||||
|
|
||||||
if (!match)
|
/* Don't allow server name matches if HideWhoisServer is enabled, unless the command user has the priv */
|
||||||
|
if (!match && (!*ServerInstance->Config->HideWhoisServer || cuser->HasPrivPermission("users/auspex")))
|
||||||
match = InspIRCd::Match(user->server, matchtext);
|
match = InspIRCd::Match(user->server, matchtext);
|
||||||
|
|
||||||
return match;
|
return match;
|
||||||
@ -364,7 +365,7 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
|
|||||||
{
|
{
|
||||||
User* oper = *i;
|
User* oper = *i;
|
||||||
|
|
||||||
if (whomatch(oper, matchtext))
|
if (whomatch(user, oper, matchtext))
|
||||||
{
|
{
|
||||||
if (!user->SharesChannelWith(oper))
|
if (!user->SharesChannelWith(oper))
|
||||||
{
|
{
|
||||||
@ -380,7 +381,7 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
|
|||||||
{
|
{
|
||||||
for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); i++)
|
for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); i++)
|
||||||
{
|
{
|
||||||
if (whomatch(i->second, matchtext))
|
if (whomatch(user, i->second, matchtext))
|
||||||
{
|
{
|
||||||
if (!user->SharesChannelWith(i->second))
|
if (!user->SharesChannelWith(i->second))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user