aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortdb3 <106488469+tdb3@users.noreply.github.com>2024-08-06 20:54:59 -0400
committertdb3 <106488469+tdb3@users.noreply.github.com>2024-08-12 20:28:11 -0400
commit27c976d11a68d66db97d9a7a30c6a6a71c6ab586 (patch)
tree201a6c6960ded6edb195fb24ede46d83cb1bfa4d /src
parent2ad3689512a36eaff957df9ac28e65b2fedbc36c (diff)
fix: increase consistency of rpcauth parsing
Previous rpcauth behavior was to sometimes ignore empty -rpcauth= settings, and other times treat them as errors. Empty rpcauth is now consistently treated as an error and prevents bitcoind from starting. Updates associated test cases. Also updates to non-deprecated logging macro. Co-Authored-By: Luke Dashjr <luke-jr+git@utopios.org> Co-Authored-By: Ryan Ofsky <ryan@ofsky.org>
Diffstat (limited to 'src')
-rw-r--r--src/httprpc.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/httprpc.cpp b/src/httprpc.cpp
index af809eaf38..1457b0cea3 100644
--- a/src/httprpc.cpp
+++ b/src/httprpc.cpp
@@ -314,8 +314,9 @@ static bool InitRPCAuthentication()
LogPrintf("Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.\n");
strRPCUserColonPass = gArgs.GetArg("-rpcuser", "") + ":" + gArgs.GetArg("-rpcpassword", "");
}
- if (gArgs.GetArg("-rpcauth", "") != "") {
- LogPrintf("Using rpcauth authentication.\n");
+
+ if (!gArgs.GetArgs("-rpcauth").empty()) {
+ LogInfo("Using rpcauth authentication.\n");
for (const std::string& rpcauth : gArgs.GetArgs("-rpcauth")) {
std::vector<std::string> fields{SplitString(rpcauth, ':')};
const std::vector<std::string> salt_hmac{SplitString(fields.back(), '$')};