From dc84b22c9916f92f9255f97c9d65123d1a04ce42 Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Fri, 17 Feb 2017 16:22:14 +0100 Subject: [PATCH] code cleanup --- MongoDB/src/Database.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/MongoDB/src/Database.cpp b/MongoDB/src/Database.cpp index 76b8d31bd..cebb24772 100644 --- a/MongoDB/src/Database.cpp +++ b/MongoDB/src/Database.cpp @@ -60,15 +60,6 @@ namespace return kvm; } - std::string hashCredentials(const std::string& username, const std::string& password) - { - Poco::MD5Engine md5; - md5.update(username); - md5.update(std::string(":mongo:")); - md5.update(password); - return Poco::DigestEngine::digestToHex(md5.digest()); - } - std::string decodeBase64(const std::string& base64) { Poco::MemoryInputStream istr(base64.data(), base64.size()); @@ -104,7 +95,16 @@ namespace { return encodeBase64(digestToBinaryString(engine)); } - + + std::string hashCredentials(const std::string& username, const std::string& password) + { + Poco::MD5Engine md5; + md5.update(username); + md5.update(std::string(":mongo:")); + md5.update(password); + return digestToHexString(md5); + } + std::string createNonce() { Poco::MD5Engine md5; @@ -267,7 +267,7 @@ bool Database::authSCRAM(Connection& connection, const std::string& username, co if (pDoc->getInteger("ok") == 1) { Binary::Ptr pPayload = pDoc->get("payload"); - serverSecondMsg.assign(reinterpret_cast(pPayload->buffer().begin()), pPayload->buffer().size()); + serverSecondMsg = pPayload->toRawString(); } else return false; }