]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_oper.cpp
Fix OnSetAway hook denying remote users' change rather than local users
[user/henk/code/inspircd.git] / src / commands / cmd_oper.cpp
index 1ce7dc49de541ed2295674966455a91e810fc063..a98db6ca42b593cf02545a795b8217ae6a740a13 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -12,7 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "wildcard.h"
 #include "commands/cmd_oper.h"
 #include "hashcomp.h"
 
@@ -22,7 +21,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
        std::string xhost;
        while (hl >> xhost)
        {
-               if (match(host, xhost) || match(ip,xhost, true))
+               if (InspIRCd::Match(host, xhost, ascii_case_insensitive_map) || InspIRCd::MatchCIDR(ip, xhost, ascii_case_insensitive_map))
                {
                        return true;
                }
@@ -80,7 +79,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
                                if (!strcmp(TypeName,OperType))
                                {
                                        /* found this oper's opertype */
-                                       if (!ServerInstance->IsNick(TypeName))
+                                       if (!ServerInstance->IsNick(TypeName, ServerInstance->Config->Limits.NickMax))
                                        {
                                                user->WriteNumeric(491, "%s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick.c_str());
                                                ServerInstance->SNO->WriteToSnoMask('o',"CONFIGURATION ERROR! Oper type '%s' contains invalid characters",OperType);
@@ -107,10 +106,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
        if (found)
        {
                /* correct oper credentials */
-               ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), irc::Spacify(OperType), parameters[0].c_str());
-               user->WriteNumeric(381, "%s :You are now %s %s",user->nick.c_str(), strchr("aeiouAEIOU", *OperType) ? "an" : "a", irc::Spacify(OperType));
-               if (!user->IsModeSet('o'))
-                       user->Oper(OperType, LoginName);
+               user->Oper(OperType, LoginName);
        }
        else
        {
@@ -132,7 +128,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
                        // tell them they suck, and lag them up to help prevent brute-force attacks
                        user->WriteNumeric(491, "%s :Invalid oper credentials",user->nick.c_str());
                        user->IncreasePenalty(10);
-                       
+
                        snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str(), fields.c_str());
                        ServerInstance->SNO->WriteToSnoMask('o',std::string(broadcast));
                        ServerInstance->PI->SendSNONotice("o", std::string("OPER: ") + broadcast);
@@ -154,4 +150,3 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
        }
        return CMD_SUCCESS;
 }
-