diff options
author | Pieter Wuille <pieter@wuille.net> | 2022-04-04 13:52:06 -0400 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-04-27 14:12:55 +0200 |
commit | 78f3ac51b7d073d12da6a3b9b7d80d91e04ce3a7 (patch) | |
tree | 60a138e61a7281fbba6391da8d0d73bd0c1f9fee /src/httprpc.cpp | |
parent | a65931e3ce66d87b8f83d67ecdbb46f137e6a670 (diff) |
Make DecodeBase{32,64} return optional instead of taking bool*
Diffstat (limited to 'src/httprpc.cpp')
-rw-r--r-- | src/httprpc.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/httprpc.cpp b/src/httprpc.cpp index 96cccd8de9..b9041227be 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -132,10 +132,10 @@ static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUserna if (strAuth.substr(0, 6) != "Basic ") return false; std::string strUserPass64 = TrimString(strAuth.substr(6)); - bool invalid; - std::vector<unsigned char> userpass_data = DecodeBase64(strUserPass64, &invalid); - if (invalid) return false; - std::string strUserPass(userpass_data.begin(), userpass_data.end()); + auto userpass_data = DecodeBase64(strUserPass64); + std::string strUserPass; + if (!userpass_data) return false; + strUserPass.assign(userpass_data->begin(), userpass_data->end()); if (strUserPass.find(':') != std::string::npos) strAuthUsernameOut = strUserPass.substr(0, strUserPass.find(':')); |