aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatoshi Nakamoto <satoshin@gmx.com>2010-08-28 00:54:37 +0000
committerGavin Andresen <gavinandresen@gmail.com>2010-08-28 00:54:37 +0000
commit87cfcfd3741e0cd38da671db79b199fe5bfb2949 (patch)
tree1583a826d3eaccb7c7103bf0f2ddd7e04d7bc12b
parent522dfe3422f562368ebdaeb2b1a13cc9ebafa333 (diff)
more rpc methods allowed in safe mode
-rw-r--r--rpc.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/rpc.cpp b/rpc.cpp
index a1151e59f8..a4297ad6b0 100644
--- a/rpc.cpp
+++ b/rpc.cpp
@@ -669,6 +669,25 @@ pair<string, rpcfn_type> pCallTable[] =
};
map<string, rpcfn_type> mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0]));
+string pAllowInSafeMode[] =
+{
+ "help",
+ "stop",
+ "getblockcount",
+ "getblocknumber",
+ "getconnectioncount",
+ "getdifficulty",
+ "getgenerate",
+ "setgenerate",
+ "gethashespersec",
+ "getinfo",
+ "getnewaddress",
+ "setlabel",
+ "getlabel",
+ "getaddressesbylabel",
+};
+set<string> setAllowInSafeMode(pAllowInSafeMode, pAllowInSafeMode + sizeof(pAllowInSafeMode)/sizeof(pAllowInSafeMode[0]));
+
@@ -974,9 +993,9 @@ void ThreadRPCServer2(void* parg)
printf("ThreadRPCServer method=%s\n", strMethod.c_str());
- // Observe lockdown
+ // Observe safe mode
string strWarning = GetWarnings("rpc");
- if (strWarning != "" && !mapArgs.count("-overridesafety") && strMethod != "getinfo" && strMethod != "help" && strMethod != "stop" && strMethod != "getgenerate" && strMethod != "setgenerate")
+ if (strWarning != "" && !mapArgs.count("-overridesafety") && !setAllowInSafeMode.count(strMethod))
throw runtime_error(strWarning);
// Execute