X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_bcrypt.cpp;h=9f02dd74c4595d03548a023ae8f11ee340b7b8f4;hb=ffacccbb6fe800950af8b5914cbf5ebd3ecad99c;hp=59ee1556cd085c5f6d50d11b4bfbacc53c33c235;hpb=b2ac8cc0a6405946a388b80df3be21bc276a61f3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_bcrypt.cpp b/src/modules/m_bcrypt.cpp index 59ee1556c..9f02dd74c 100644 --- a/src/modules/m_bcrypt.cpp +++ b/src/modules/m_bcrypt.cpp @@ -1,7 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2013 Daniel Vassdal + * Copyright (C) 2017-2018, 2020 Sadie Powell + * Copyright (C) 2014 Daniel Vassdal * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -55,15 +56,9 @@ class BCryptProvider : public HashProvider return Generate(data, Salt()); } - bool Compare(const std::string& input, const std::string& hash) CXX11_OVERRIDE + bool Compare(const std::string& input, const std::string& hash) CXX11_OVERRIDE { - std::string ret = Generate(input, hash); - if (ret.empty()) - return false; - - if (ret == hash) - return true; - return false; + return InspIRCd::TimingSafeCompare(Generate(input, hash), hash); } std::string ToPrintable(const std::string& raw) CXX11_OVERRIDE @@ -95,7 +90,7 @@ class ModuleBCrypt : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Implements bcrypt hashing", VF_VENDOR); + return Version("Allows other modules to generate bcrypt hashes.", VF_VENDOR); } };