changeset 261:2d2a3af91981 draft

more rpc methods allowed in safe mode git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@143 1a98c847-1fd6-4fd8-948a-caf3550aa51b
author s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>
date Wed, 25 Aug 2010 14:18:56 +0000
parents eceee9912324
children 208b358fe49d
files rpc.cpp
diffstat 1 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rpc.cpp
+++ b/rpc.cpp
@@ -669,6 +669,25 @@
 };
 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 @@
 
                 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