]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_pass.cpp
Fix for bug found by danieldg, where remote nicks were truncated to NICKMAX, but...
[user/henk/code/inspircd.git] / src / commands / cmd_pass.cpp
index 2333661e77c072cac7cc8d1cc7b37a0ced488329..587c0582ace7cb06e5317e3c9083fe165e27874b 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2009 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* const* parameters, int, 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->WriteNumeric(462, "%s :You may not reregister",user->nick);
+               user->WriteNumeric(ERR_ALREADYREGISTERED, "%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 (!ServerInstance->PassCompare(user, a->GetPass().c_str(), parameters[0], a->GetHash().c_str()))
-       {
+       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;
 }