MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / RPCAuthorized

Function RPCAuthorized

src/httprpc.cpp:127–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUsernameOut)
128{
129 if (strRPCUserColonPass.empty()) // Belt-and-suspenders measure if InitRPCAuthentication was not called
130 return false;
131 if (strAuth.substr(0, 6) != "Basic ")
132 return false;
133 std::string strUserPass64 = strAuth.substr(6);
134 boost::trim(strUserPass64);
135 std::string strUserPass = DecodeBase64(strUserPass64);
136
137 if (strUserPass.find(':') != std::string::npos)
138 strAuthUsernameOut = strUserPass.substr(0, strUserPass.find(':'));
139
140 //Check if authorized under single-user field
141 if (TimingResistantEqual(strUserPass, strRPCUserColonPass)) {
142 return true;
143 }
144 return multiUserAuthorized(strUserPass);
145}
146
147static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
148{

Callers 1

HTTPReq_JSONRPCFunction · 0.85

Calls 5

DecodeBase64Function · 0.85
TimingResistantEqualFunction · 0.85
multiUserAuthorizedFunction · 0.85
emptyMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected