rpcauthfile: Support multiple lines each with a different auth config

This commit is contained in:
Luke Dashjr 2021-01-30 16:09:07 +00:00
parent 732efacf78
commit 07bdd6864a
2 changed files with 10 additions and 9 deletions

View File

@ -40,8 +40,8 @@ def main():
rpcauth = f'{args.username}:{salt}${password_hmac}'
if args.output:
file = open(args.output, "x", encoding="utf8")
file.write(rpcauth)
file = open(args.output, "a", encoding="utf8")
file.write(rpcauth + "\n")
if args.json:
odict={'username':args.username, 'password':args.password}

View File

@ -335,7 +335,7 @@ static bool InitRPCAuthentication()
file.open(path);
if (!file.is_open()) continue;
std::string rpcauth;
std::getline(file, rpcauth);
while (std::getline(file, rpcauth)) {
std::vector<std::string> fields{SplitString(rpcauth, ':')};
const std::vector<std::string> salt_hmac{SplitString(fields.back(), '$')};
if (fields.size() == 2 && salt_hmac.size() == 2) {
@ -345,6 +345,7 @@ static bool InitRPCAuthentication()
}
}
}
}
g_rpc_whitelist_default = gArgs.GetBoolArg("-rpcwhitelistdefault", gArgs.IsArgSet("-rpcwhitelist"));
for (const std::string& strRPCWhitelist : gArgs.GetArgs("-rpcwhitelist")) {