Indentation after 'Remove redundant calls to gArgs.IsArgSet()'
This commit is contained in:
parent
506b700dcb
commit
ed866ab923
3 changed files with 61 additions and 61 deletions
|
@ -94,31 +94,31 @@ static bool multiUserAuthorized(std::string strUserPass)
|
|||
|
||||
for (const std::string& strRPCAuth : gArgs.GetArgs("-rpcauth")) {
|
||||
//Search for multi-user login/pass "rpcauth" from config
|
||||
std::vector<std::string> vFields;
|
||||
boost::split(vFields, strRPCAuth, boost::is_any_of(":$"));
|
||||
if (vFields.size() != 3) {
|
||||
//Incorrect formatting in config file
|
||||
continue;
|
||||
}
|
||||
std::vector<std::string> vFields;
|
||||
boost::split(vFields, strRPCAuth, boost::is_any_of(":$"));
|
||||
if (vFields.size() != 3) {
|
||||
//Incorrect formatting in config file
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string strName = vFields[0];
|
||||
if (!TimingResistantEqual(strName, strUser)) {
|
||||
continue;
|
||||
}
|
||||
std::string strName = vFields[0];
|
||||
if (!TimingResistantEqual(strName, strUser)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string strSalt = vFields[1];
|
||||
std::string strHash = vFields[2];
|
||||
std::string strSalt = vFields[1];
|
||||
std::string strHash = vFields[2];
|
||||
|
||||
static const unsigned int KEY_SIZE = 32;
|
||||
unsigned char out[KEY_SIZE];
|
||||
static const unsigned int KEY_SIZE = 32;
|
||||
unsigned char out[KEY_SIZE];
|
||||
|
||||
CHMAC_SHA256(reinterpret_cast<const unsigned char*>(strSalt.c_str()), strSalt.size()).Write(reinterpret_cast<const unsigned char*>(strPass.c_str()), strPass.size()).Finalize(out);
|
||||
std::vector<unsigned char> hexvec(out, out+KEY_SIZE);
|
||||
std::string strHashFromPass = HexStr(hexvec);
|
||||
CHMAC_SHA256(reinterpret_cast<const unsigned char*>(strSalt.c_str()), strSalt.size()).Write(reinterpret_cast<const unsigned char*>(strPass.c_str()), strPass.size()).Finalize(out);
|
||||
std::vector<unsigned char> hexvec(out, out+KEY_SIZE);
|
||||
std::string strHashFromPass = HexStr(hexvec);
|
||||
|
||||
if (TimingResistantEqual(strHashFromPass, strHash)) {
|
||||
return true;
|
||||
}
|
||||
if (TimingResistantEqual(strHashFromPass, strHash)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -197,15 +197,15 @@ static bool InitHTTPAllowList()
|
|||
rpc_allow_subnets.push_back(CSubNet(localv4, 8)); // always allow IPv4 local subnet
|
||||
rpc_allow_subnets.push_back(CSubNet(localv6)); // always allow IPv6 localhost
|
||||
for (const std::string& strAllow : gArgs.GetArgs("-rpcallowip")) {
|
||||
CSubNet subnet;
|
||||
LookupSubNet(strAllow.c_str(), subnet);
|
||||
if (!subnet.IsValid()) {
|
||||
uiInterface.ThreadSafeMessageBox(
|
||||
strprintf("Invalid -rpcallowip subnet specification: %s. Valid are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24).", strAllow),
|
||||
"", CClientUIInterface::MSG_ERROR);
|
||||
return false;
|
||||
}
|
||||
rpc_allow_subnets.push_back(subnet);
|
||||
CSubNet subnet;
|
||||
LookupSubNet(strAllow.c_str(), subnet);
|
||||
if (!subnet.IsValid()) {
|
||||
uiInterface.ThreadSafeMessageBox(
|
||||
strprintf("Invalid -rpcallowip subnet specification: %s. Valid are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24).", strAllow),
|
||||
"", CClientUIInterface::MSG_ERROR);
|
||||
return false;
|
||||
}
|
||||
rpc_allow_subnets.push_back(subnet);
|
||||
}
|
||||
std::string strAllowed;
|
||||
for (const CSubNet& subnet : rpc_allow_subnets)
|
||||
|
|
64
src/init.cpp
64
src/init.cpp
|
@ -919,12 +919,12 @@ bool AppInitParameterInteraction()
|
|||
|
||||
// Now remove the logging categories which were explicitly excluded
|
||||
for (const std::string& cat : gArgs.GetArgs("-debugexclude")) {
|
||||
uint32_t flag = 0;
|
||||
if (!GetLogCategory(&flag, &cat)) {
|
||||
InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat));
|
||||
continue;
|
||||
}
|
||||
logCategories &= ~flag;
|
||||
uint32_t flag = 0;
|
||||
if (!GetLogCategory(&flag, &cat)) {
|
||||
InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat));
|
||||
continue;
|
||||
}
|
||||
logCategories &= ~flag;
|
||||
}
|
||||
|
||||
// Check for -debugnet
|
||||
|
@ -1235,9 +1235,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
// sanitize comments per BIP-0014, format user agent and check total size
|
||||
std::vector<std::string> uacomments;
|
||||
for (const std::string& cmt : gArgs.GetArgs("-uacomment")) {
|
||||
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
|
||||
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
|
||||
uacomments.push_back(cmt);
|
||||
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
|
||||
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
|
||||
uacomments.push_back(cmt);
|
||||
}
|
||||
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
|
||||
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) {
|
||||
|
@ -1311,11 +1311,11 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
fRelayTxes = !GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
|
||||
|
||||
for (const std::string& strAddr : gArgs.GetArgs("-externalip")) {
|
||||
CService addrLocal;
|
||||
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
|
||||
AddLocal(addrLocal, LOCAL_MANUAL);
|
||||
else
|
||||
return InitError(ResolveErrMsg("externalip", strAddr));
|
||||
CService addrLocal;
|
||||
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
|
||||
AddLocal(addrLocal, LOCAL_MANUAL);
|
||||
else
|
||||
return InitError(ResolveErrMsg("externalip", strAddr));
|
||||
}
|
||||
|
||||
#if ENABLE_ZMQ
|
||||
|
@ -1588,29 +1588,29 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
connOptions.nMaxOutboundLimit = nMaxOutboundLimit;
|
||||
|
||||
for (const std::string& strBind : gArgs.GetArgs("-bind")) {
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) {
|
||||
return InitError(ResolveErrMsg("bind", strBind));
|
||||
}
|
||||
connOptions.vBinds.push_back(addrBind);
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) {
|
||||
return InitError(ResolveErrMsg("bind", strBind));
|
||||
}
|
||||
connOptions.vBinds.push_back(addrBind);
|
||||
}
|
||||
for (const std::string& strBind : gArgs.GetArgs("-whitebind")) {
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind.c_str(), addrBind, 0, false)) {
|
||||
return InitError(ResolveErrMsg("whitebind", strBind));
|
||||
}
|
||||
if (addrBind.GetPort() == 0) {
|
||||
return InitError(strprintf(_("Need to specify a port with -whitebind: '%s'"), strBind));
|
||||
}
|
||||
connOptions.vWhiteBinds.push_back(addrBind);
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind.c_str(), addrBind, 0, false)) {
|
||||
return InitError(ResolveErrMsg("whitebind", strBind));
|
||||
}
|
||||
if (addrBind.GetPort() == 0) {
|
||||
return InitError(strprintf(_("Need to specify a port with -whitebind: '%s'"), strBind));
|
||||
}
|
||||
connOptions.vWhiteBinds.push_back(addrBind);
|
||||
}
|
||||
|
||||
for (const auto& net : gArgs.GetArgs("-whitelist")) {
|
||||
CSubNet subnet;
|
||||
LookupSubNet(net.c_str(), subnet);
|
||||
if (!subnet.IsValid())
|
||||
return InitError(strprintf(_("Invalid netmask specified in -whitelist: '%s'"), net));
|
||||
connOptions.vWhitelistedRange.push_back(subnet);
|
||||
CSubNet subnet;
|
||||
LookupSubNet(net.c_str(), subnet);
|
||||
if (!subnet.IsValid())
|
||||
return InitError(strprintf(_("Invalid netmask specified in -whitelist: '%s'"), net));
|
||||
connOptions.vWhitelistedRange.push_back(subnet);
|
||||
}
|
||||
|
||||
if (gArgs.IsArgSet("-seednode")) {
|
||||
|
|
Loading…
Reference in a new issue