From b790dee4873df308247655bb8ca88be9c483b536 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 10 Feb 2010 20:53:54 +0000 Subject: Fix incorrect check of mode permissions when displaying them git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12422 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_check.cpp | 10 +++++----- src/stats.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 6f89f8cf4..461ac5a2d 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -75,6 +75,7 @@ class CommandCheck : public Command if (targuser) { + LocalUser* loctarg = IS_LOCAL(targuser); /* /check on a user */ user->SendText(checkstr + " nuh " + targuser->GetFullHost()); user->SendText(checkstr + " realnuh " + targuser->GetFullRealHost()); @@ -85,7 +86,7 @@ class CommandCheck : public Command user->SendText(checkstr + " uid " + targuser->uuid); user->SendText(checkstr + " signon " + timestring(targuser->signon)); user->SendText(checkstr + " nickts " + timestring(targuser->age)); - if (IS_LOCAL(targuser)) + if (loctarg) user->SendText(checkstr + " lastmsg " + timestring(targuser->idle_lastmsg)); if (IS_AWAY(targuser)) @@ -100,17 +101,17 @@ class CommandCheck : public Command OperInfo* oper = targuser->oper; /* user is an oper of type ____ */ user->SendText(checkstr + " opertype " + oper->NameStr()); - if (IS_LOCAL(targuser)) + if (loctarg) { std::string umodes; std::string cmodes; for(char c='A'; c < 'z'; c++) { ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER); - if (mh && mh->NeedsOper() && oper->AllowedUserModes[c]) + if (mh && mh->NeedsOper() && loctarg->HasModePermission(c, MODETYPE_USER)) umodes.push_back(c); mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL); - if (mh && mh->NeedsOper() && oper->AllowedChanModes[c]) + if (mh && mh->NeedsOper() && loctarg->HasModePermission(c, MODETYPE_CHANNEL)) cmodes.push_back(c); } user->SendText(checkstr + " modeperms user=" + umodes + " channel=" + cmodes); @@ -133,7 +134,6 @@ class CommandCheck : public Command } } - LocalUser* loctarg = IS_LOCAL(targuser); if (loctarg) { user->SendText(checkstr + " clientaddr " + irc::sockets::satouser(loctarg->client_sa)); diff --git a/src/stats.cpp b/src/stats.cpp index fb4e5e7a5..a4b9fa133 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -279,10 +279,10 @@ void InspIRCd::DoStats(char statschar, User* user, string_list &results) for(char c='A'; c < 'z'; c++) { ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER); - if (mh && mh->NeedsOper() && tag->AllowedUserModes[c]) + if (mh && mh->NeedsOper() && tag->AllowedUserModes[c - 'A']) umodes.push_back(c); mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL); - if (mh && mh->NeedsOper() && tag->AllowedChanModes[c]) + if (mh && mh->NeedsOper() && tag->AllowedChanModes[c - 'A']) cmodes.push_back(c); } results.push_back(sn+" 243 "+user->nick+" O "+tag->NameStr() + " " + umodes + " " + cmodes); -- cgit v1.2.3