]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_pass.cpp
NEVER use the two-param assign unless you want your string padding to len bytes with \0!
[user/henk/code/inspircd.git] / src / commands / cmd_pass.cpp
index 801d9923b173357226eedc3c9fe671df90e739b8..b9b55d007aba5a7bdf5e7d96eda6740f862dafda 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
@@ -19,23 +19,21 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
        return new CommandPass(Instance);
 }
 
-CmdResult CommandPass::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandPass::Handle (const std::vector<std::string>& parameters, User *user)
 {
        // Check to make sure they havnt registered -- Fix by FCS
        if (user->registered == REG_ALL)
        {
-               user->WriteServ("462 %s :You may not reregister",user->nick);
+               user->WriteNumeric(462, "%s :You may not reregister",user->nick.c_str());
                return CMD_FAILURE;
        }
        ConnectClass* a = user->GetClass();
        if (!a)
                return CMD_FAILURE;
 
-       strlcpy(user->password,parameters[0],63);
-       if (a->GetPass() == parameters[0])
-       {
+       user->password.assign(parameters[0], 0, 63);
+       if (!ServerInstance->PassCompare(user, a->GetPass().c_str(), parameters[0].c_str(), a->GetHash().c_str()))
                user->haspassed = true;
-       }
 
        return CMD_SUCCESS;
 }