diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/cmd_pass.cpp | 10 | ||||
-rw-r--r-- | src/users.cpp | 16 |
2 files changed, 11 insertions, 15 deletions
diff --git a/src/commands/cmd_pass.cpp b/src/commands/cmd_pass.cpp index 6219118ee..21b5b2759 100644 --- a/src/commands/cmd_pass.cpp +++ b/src/commands/cmd_pass.cpp @@ -36,19 +36,13 @@ class CommandPass : public Command CmdResult CommandPass::Handle (const std::vector<std::string>& parameters, User *user) { - // Check to make sure they havnt registered -- Fix by FCS + // Check to make sure they haven't registered -- Fix by FCS if (user->registered == REG_ALL) { 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; - - user->password.assign(parameters[0], 0, 63); - if (!ServerInstance->PassCompare(user, a->pass.c_str(), parameters[0].c_str(), a->hash.c_str())) - user->haspassed = true; + user->password = parameters[0]; return CMD_SUCCESS; } diff --git a/src/users.cpp b/src/users.cpp index 324edbfdb..657225069 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -228,17 +228,16 @@ User::User(const std::string &uid) Penalty = 0; lastping = signon = idle_lastmsg = nping = registered = 0; bytes_in = bytes_out = cmds_in = cmds_out = 0; - quietquit = quitting = exempt = haspassed = dns_done = false; + quietquit = quitting = exempt = dns_done = false; fd = -1; server_sa.sa.sa_family = AF_UNSPEC; client_sa.sa.sa_family = AF_UNSPEC; - MyClass = NULL; AllowedPrivs = AllowedOperCommands = NULL; if (uid.empty()) - uuid.assign(ServerInstance->GetUID(), 0, UUID_LENGTH - 1); + uuid = ServerInstance->GetUID(); else - uuid.assign(uid, 0, UUID_LENGTH - 1); + uuid = uid; ServerInstance->Logs->Log("USERS", DEBUG,"New UUID for user: %s (%s)", uuid.c_str(), uid.empty() ? "allocated new" : "used remote"); @@ -846,10 +845,13 @@ void User::FullConnect() /* Check the password, if one is required by the user's connect class. * This CANNOT be in CheckClass(), because that is called prior to PASS as well! */ - if (this->MyClass && !this->MyClass->GetPass().empty() && !this->haspassed) + if (MyClass && !MyClass->pass.empty()) { - ServerInstance->Users->QuitUser(this, "Invalid password"); - return; + if (ServerInstance->PassCompare(this, MyClass->pass.c_str(), password.c_str(), MyClass->hash.c_str())) + { + ServerInstance->Users->QuitUser(this, "Invalid password"); + return; + } } if (this->CheckLines()) |