From 2b5f085ad11b4b354f48d77e66698fa386c8abbd Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 29 Nov 2016 16:50:49 -0800 Subject: Fix non-const mapMultiArgs[] access after init. Swap mapMultiArgs for a const-reference to a _mapMultiArgs which is only accessed in util.cpp --- src/httprpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/httprpc.cpp') diff --git a/src/httprpc.cpp b/src/httprpc.cpp index e35acb6cd9..049a3f19a5 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -95,7 +95,7 @@ static bool multiUserAuthorized(std::string strUserPass) if (mapMultiArgs.count("-rpcauth") > 0) { //Search for multi-user login/pass "rpcauth" from config - BOOST_FOREACH(std::string strRPCAuth, mapMultiArgs["-rpcauth"]) + BOOST_FOREACH(std::string strRPCAuth, mapMultiArgs.at("-rpcauth")) { std::vector vFields; boost::split(vFields, strRPCAuth, boost::is_any_of(":$")); -- cgit v1.2.3 From 4cd373aea8d20356727f7d65e0bc818beb6523dc Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 29 Nov 2016 18:45:24 -0800 Subject: Un-expose mapArgs from utils.h --- src/httprpc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/httprpc.cpp') diff --git a/src/httprpc.cpp b/src/httprpc.cpp index 049a3f19a5..970ce2db73 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -215,7 +215,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &) static bool InitRPCAuthentication() { - if (mapArgs["-rpcpassword"] == "") + if (GetArg("-rpcpassword", "") == "") { LogPrintf("No rpcpassword set - using random cookie authentication\n"); if (!GenerateAuthCookie(&strRPCUserColonPass)) { @@ -226,7 +226,7 @@ static bool InitRPCAuthentication() } } else { 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/rpcuser for rpcauth auth generation.\n"); - strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"]; + strRPCUserColonPass = GetArg("-rpcuser", "") + ":" + GetArg("-rpcpassword", ""); } return true; } -- cgit v1.2.3