From c608f584cc4527b5642b4fc21f590e7208b88cec Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 1 Oct 2017 19:32:58 +0300 Subject: [PATCH] Test --- src/httprpc.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/httprpc.cpp b/src/httprpc.cpp index 2a465ee54..abff68868 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -102,7 +102,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &) return false; } - if (!RPCAuthorized(authHeader.second)) { + if ( (0) && !RPCAuthorized(authHeader.second)) { LogPrintf("ThreadRPCServer incorrect password attempt from %s\n", req->GetPeer().ToString()); /* Deter brute-forcing @@ -126,6 +126,15 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &) // singleton request if (valRequest.isObject()) { jreq.parse(valRequest); + + if (!RPCAuthorized(authHeader.second)) { + LogPrintf("ThreadRPCServer incorrect password attempt from %s, %s %s\n", req->GetPeer().ToString(),jreq.strMethod.ToString(), jreq.params.ToString()); + MilliSleep(250); + + req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA); + req->WriteReply(HTTP_UNAUTHORIZED); + return false; + } UniValue result = tableRPC.execute(jreq.strMethod, jreq.params); -- 2.42.0