From 85ee55b5c37bedca98ec472439e1710277e8e4b2 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 8 Jul 2015 14:47:39 +0200 Subject: [PATCH] rpc: Remove chain-specific RequireRPCPassword I've never liked the chain-specific exception to having to set a password. It gives issues with #6388 which makes it valid to set no password in every case (as it enables random cookie authentication). This pull removes the flag, so that all chains are regarded the same. It also removes the username==password test, which doesn't provide any substantial extra security. --- src/chainparams.cpp | 3 --- src/chainparams.h | 2 -- src/rpcserver.cpp | 3 +-- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 778541751..3d172765c 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -99,7 +99,6 @@ public: vFixedSeeds = std::vector(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); - fRequireRPCPassword = true; fMiningRequiresPeers = true; fDefaultConsistencyChecks = false; fRequireStandard = true; @@ -171,7 +170,6 @@ public: vFixedSeeds = std::vector(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test)); - fRequireRPCPassword = true; fMiningRequiresPeers = true; fDefaultConsistencyChecks = false; fRequireStandard = false; @@ -218,7 +216,6 @@ public: vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds. vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds. - fRequireRPCPassword = false; fMiningRequiresPeers = false; fDefaultConsistencyChecks = true; fRequireStandard = false; diff --git a/src/chainparams.h b/src/chainparams.h index 8044b553e..8f13c2814 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -53,7 +53,6 @@ public: /** Used if GenerateBitcoins is called with a negative number of threads */ int DefaultMinerThreads() const { return nMinerThreads; } const CBlock& GenesisBlock() const { return genesis; } - bool RequireRPCPassword() const { return fRequireRPCPassword; } /** Make miner wait to have peers to avoid wasting work */ bool MiningRequiresPeers() const { return fMiningRequiresPeers; } /** Default value for -checkmempool and -checkblockindex argument */ @@ -86,7 +85,6 @@ protected: std::string strNetworkID; CBlock genesis; std::vector vFixedSeeds; - bool fRequireRPCPassword; bool fMiningRequiresPeers; bool fDefaultConsistencyChecks; bool fRequireStandard; diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 287cfb2f1..daf10736b 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -598,8 +598,7 @@ void StartRPCThreads() LogPrint("rpc", "Allowing RPC connections from: %s\n", strAllowed); strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"]; - if (((mapArgs["-rpcpassword"] == "") || - (mapArgs["-rpcuser"] == mapArgs["-rpcpassword"])) && Params().RequireRPCPassword()) + if (mapArgs["-rpcpassword"] == "") { unsigned char rand_pwd[32]; GetRandBytes(rand_pwd, 32);