]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_oper.cpp
Fix trampling on memory in Z/G/K/ELine.
[user/henk/code/inspircd.git] / src / commands / cmd_oper.cpp
index 55277b1ba5ad3c57742a3e672d247a2f14ee729c..4d4c54932185628b10e1709ce4dbacd5e5028fe0 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -45,6 +45,7 @@ CmdResult CommandOper::Handle (const char** parameters, int, User *user)
        char ClassName[MAXBUF];
        char TheHost[MAXBUF];
        char TheIP[MAXBUF];
+       char HashType[MAXBUF];
        int j;
        bool found = false;
        bool type_invalid = false;
@@ -62,9 +63,10 @@ CmdResult CommandOper::Handle (const char** parameters, int, User *user)
                ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "password", i, Password, MAXBUF);
                ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "type", i, OperType, MAXBUF);
                ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "host", i, HostName, MAXBUF);
+               ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "hash", i, HashType, MAXBUF);
 
                match_login = !strcmp(LoginName,parameters[0]);
-               match_pass = !ServerInstance->OperPassCompare(Password,parameters[1], i);
+               match_pass = !ServerInstance->PassCompare(user, Password,parameters[1], HashType);
                match_hosts = OneOfMatches(TheHost,TheIP,HostName);
 
                if (match_login && match_pass && match_hosts)
@@ -108,7 +110,7 @@ CmdResult CommandOper::Handle (const char** parameters, int, User *user)
                ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0]);
                user->WriteServ("381 %s :You are now %s %s",user->nick, strchr("aeiouAEIOU", *OperType) ? "an" : "a", irc::Spacify(OperType));
                if (!user->IsModeSet('o'))
-                       user->Oper(OperType);
+                       user->Oper(OperType, LoginName);
        }
        else
        {