Skip to content

Commit ed866ab

Browse files
committed
Indentation after 'Remove redundant calls to gArgs.IsArgSet()'
1 parent 506b700 commit ed866ab

File tree

3 files changed

+66
-66
lines changed

3 files changed

+66
-66
lines changed

src/httprpc.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -94,31 +94,31 @@ static bool multiUserAuthorized(std::string strUserPass)
9494

9595
for (const std::string& strRPCAuth : gArgs.GetArgs("-rpcauth")) {
9696
//Search for multi-user login/pass "rpcauth" from config
97-
std::vector<std::string> vFields;
98-
boost::split(vFields, strRPCAuth, boost::is_any_of(":$"));
99-
if (vFields.size() != 3) {
100-
//Incorrect formatting in config file
101-
continue;
102-
}
103-
104-
std::string strName = vFields[0];
105-
if (!TimingResistantEqual(strName, strUser)) {
106-
continue;
107-
}
108-
109-
std::string strSalt = vFields[1];
110-
std::string strHash = vFields[2];
111-
112-
static const unsigned int KEY_SIZE = 32;
113-
unsigned char out[KEY_SIZE];
114-
115-
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);
116-
std::vector<unsigned char> hexvec(out, out+KEY_SIZE);
117-
std::string strHashFromPass = HexStr(hexvec);
118-
119-
if (TimingResistantEqual(strHashFromPass, strHash)) {
120-
return true;
121-
}
97+
std::vector<std::string> vFields;
98+
boost::split(vFields, strRPCAuth, boost::is_any_of(":$"));
99+
if (vFields.size() != 3) {
100+
//Incorrect formatting in config file
101+
continue;
102+
}
103+
104+
std::string strName = vFields[0];
105+
if (!TimingResistantEqual(strName, strUser)) {
106+
continue;
107+
}
108+
109+
std::string strSalt = vFields[1];
110+
std::string strHash = vFields[2];
111+
112+
static const unsigned int KEY_SIZE = 32;
113+
unsigned char out[KEY_SIZE];
114+
115+
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);
116+
std::vector<unsigned char> hexvec(out, out+KEY_SIZE);
117+
std::string strHashFromPass = HexStr(hexvec);
118+
119+
if (TimingResistantEqual(strHashFromPass, strHash)) {
120+
return true;
121+
}
122122
}
123123
return false;
124124
}

src/httpserver.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,15 @@ static bool InitHTTPAllowList()
197197
rpc_allow_subnets.push_back(CSubNet(localv4, 8)); // always allow IPv4 local subnet
198198
rpc_allow_subnets.push_back(CSubNet(localv6)); // always allow IPv6 localhost
199199
for (const std::string& strAllow : gArgs.GetArgs("-rpcallowip")) {
200-
CSubNet subnet;
201-
LookupSubNet(strAllow.c_str(), subnet);
202-
if (!subnet.IsValid()) {
203-
uiInterface.ThreadSafeMessageBox(
204-
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),
205-
"", CClientUIInterface::MSG_ERROR);
206-
return false;
207-
}
208-
rpc_allow_subnets.push_back(subnet);
200+
CSubNet subnet;
201+
LookupSubNet(strAllow.c_str(), subnet);
202+
if (!subnet.IsValid()) {
203+
uiInterface.ThreadSafeMessageBox(
204+
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),
205+
"", CClientUIInterface::MSG_ERROR);
206+
return false;
207+
}
208+
rpc_allow_subnets.push_back(subnet);
209209
}
210210
std::string strAllowed;
211211
for (const CSubNet& subnet : rpc_allow_subnets)

src/init.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -919,12 +919,12 @@ bool AppInitParameterInteraction()
919919

920920
// Now remove the logging categories which were explicitly excluded
921921
for (const std::string& cat : gArgs.GetArgs("-debugexclude")) {
922-
uint32_t flag = 0;
923-
if (!GetLogCategory(&flag, &cat)) {
924-
InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat));
925-
continue;
926-
}
927-
logCategories &= ~flag;
922+
uint32_t flag = 0;
923+
if (!GetLogCategory(&flag, &cat)) {
924+
InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat));
925+
continue;
926+
}
927+
logCategories &= ~flag;
928928
}
929929

930930
// Check for -debugnet
@@ -1235,9 +1235,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12351235
// sanitize comments per BIP-0014, format user agent and check total size
12361236
std::vector<std::string> uacomments;
12371237
for (const std::string& cmt : gArgs.GetArgs("-uacomment")) {
1238-
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
1239-
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
1240-
uacomments.push_back(cmt);
1238+
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
1239+
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
1240+
uacomments.push_back(cmt);
12411241
}
12421242
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
12431243
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) {
@@ -1311,11 +1311,11 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
13111311
fRelayTxes = !GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
13121312

13131313
for (const std::string& strAddr : gArgs.GetArgs("-externalip")) {
1314-
CService addrLocal;
1315-
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
1316-
AddLocal(addrLocal, LOCAL_MANUAL);
1317-
else
1318-
return InitError(ResolveErrMsg("externalip", strAddr));
1314+
CService addrLocal;
1315+
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
1316+
AddLocal(addrLocal, LOCAL_MANUAL);
1317+
else
1318+
return InitError(ResolveErrMsg("externalip", strAddr));
13191319
}
13201320

13211321
#if ENABLE_ZMQ
@@ -1588,29 +1588,29 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
15881588
connOptions.nMaxOutboundLimit = nMaxOutboundLimit;
15891589

15901590
for (const std::string& strBind : gArgs.GetArgs("-bind")) {
1591-
CService addrBind;
1592-
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) {
1593-
return InitError(ResolveErrMsg("bind", strBind));
1594-
}
1595-
connOptions.vBinds.push_back(addrBind);
1591+
CService addrBind;
1592+
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) {
1593+
return InitError(ResolveErrMsg("bind", strBind));
1594+
}
1595+
connOptions.vBinds.push_back(addrBind);
15961596
}
15971597
for (const std::string& strBind : gArgs.GetArgs("-whitebind")) {
1598-
CService addrBind;
1599-
if (!Lookup(strBind.c_str(), addrBind, 0, false)) {
1600-
return InitError(ResolveErrMsg("whitebind", strBind));
1601-
}
1602-
if (addrBind.GetPort() == 0) {
1603-
return InitError(strprintf(_("Need to specify a port with -whitebind: '%s'"), strBind));
1604-
}
1605-
connOptions.vWhiteBinds.push_back(addrBind);
1598+
CService addrBind;
1599+
if (!Lookup(strBind.c_str(), addrBind, 0, false)) {
1600+
return InitError(ResolveErrMsg("whitebind", strBind));
1601+
}
1602+
if (addrBind.GetPort() == 0) {
1603+
return InitError(strprintf(_("Need to specify a port with -whitebind: '%s'"), strBind));
1604+
}
1605+
connOptions.vWhiteBinds.push_back(addrBind);
16061606
}
16071607

16081608
for (const auto& net : gArgs.GetArgs("-whitelist")) {
1609-
CSubNet subnet;
1610-
LookupSubNet(net.c_str(), subnet);
1611-
if (!subnet.IsValid())
1612-
return InitError(strprintf(_("Invalid netmask specified in -whitelist: '%s'"), net));
1613-
connOptions.vWhitelistedRange.push_back(subnet);
1609+
CSubNet subnet;
1610+
LookupSubNet(net.c_str(), subnet);
1611+
if (!subnet.IsValid())
1612+
return InitError(strprintf(_("Invalid netmask specified in -whitelist: '%s'"), net));
1613+
connOptions.vWhitelistedRange.push_back(subnet);
16141614
}
16151615

16161616
if (gArgs.IsArgSet("-seednode")) {

0 commit comments

Comments
 (0)