From 82a3069c5604a8b815021532ebfcc98cb50c9c7d Mon Sep 17 00:00:00 2001 From: danieldg Date: Fri, 5 Feb 2010 15:58:58 +0000 Subject: Remove incorrect access checks from m_ojoin git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12377 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_ojoin.cpp | 63 ++++++++----------------------------------------- 1 file changed, 10 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 6e9e36812..38497f1bb 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -132,71 +132,28 @@ class NetworkPrefix : public ModeHandler } } - User* FindAndVerify(std::string ¶meter, Channel* channel) + unsigned int GetPrefixRank() { - User* theuser = ServerInstance->FindNick(parameter); - if ((!theuser) || (!channel->HasUser(theuser))) - { - parameter.clear(); - return NULL; - } - return theuser; + return NETWORK_VALUE; } - ModeAction HandleChange(User* source, User* theuser, bool adding, Channel* channel, std::string ¶meter) + void RemoveMode(User* user, irc::modestacker* stack) { - Membership* m = channel->GetUser(theuser); - if (m && adding) - { - if (!m->hasMode('Y')) - { - parameter = theuser->nick; - return MODEACTION_ALLOW; - } - } - else if (m && !adding) - { - if (m->hasMode('Y')) - { - parameter = theuser->nick; - return MODEACTION_ALLOW; - } - } - return MODEACTION_DENY; } - unsigned int GetPrefixRank() + ModResult AccessCheck(User* source, Channel* channel, std::string ¶meter, bool adding) { - return NETWORK_VALUE; - } + User* theuser = ServerInstance->FindNick(parameter); + // remove own privs? + if (source == theuser && !adding) + return MOD_RES_ALLOW; - void RemoveMode(User* user, irc::modestacker* stack) - { + return MOD_RES_PASSTHRU; } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { - User* theuser = FindAndVerify(parameter, channel); - - if (!theuser) - return MODEACTION_DENY; - - // source is a server, or ulined, we'll let them +-Y the user. - if (source == ServerInstance->FakeClient || - ((source == theuser) && (!adding)) || - (ServerInstance->ULine(source->nick.c_str())) || - (ServerInstance->ULine(source->server)) || - (!IS_LOCAL(source)) - ) - { - return HandleChange(source, theuser, adding, channel, parameter); - } - else - { - // bzzzt, wrong answer! - source->WriteNumeric(482, "%s %s :Only servers may change this mode.", source->nick.c_str(), channel->name.c_str()); - return MODEACTION_DENY; - } + return MODEACTION_ALLOW; } }; -- cgit v1.2.3