diff --git a/newcoin.vcxproj b/newcoin.vcxproj index 7a2042a555..9b2eec6ec3 100644 --- a/newcoin.vcxproj +++ b/newcoin.vcxproj @@ -193,9 +193,7 @@ - - @@ -218,6 +216,7 @@ Designer + diff --git a/newcoin.vcxproj.filters b/newcoin.vcxproj.filters index c83fa06654..ba656a48f4 100644 --- a/newcoin.vcxproj.filters +++ b/newcoin.vcxproj.filters @@ -281,9 +281,6 @@ Header Files - - Header Files - Header Files @@ -308,9 +305,6 @@ Header Files - - Header Files - Header Files @@ -430,6 +424,7 @@ tests\client2 + diff --git a/newcoind.cfg b/newcoind.cfg index 8f8771f3f5..a6c0ea16d7 100644 --- a/newcoind.cfg +++ b/newcoind.cfg @@ -21,6 +21,9 @@ # [rpc_port]: # Port to bind to if allowing insecure RPC connections. # +# [rpc_allow_remote]: +# 0 or 1. 0 only allows RPC connections from 127.0.0.1. [default 0] +# # [validation_seed]: # This is the seed used to generate the validation public/private key pair. # This representation has a checksum and is the recommended form for transmission. diff --git a/src/Config.cpp b/src/Config.cpp index a1e767cde1..74df508ae4 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -16,6 +16,7 @@ #define SECTION_PEER_PORT "peer_port" #define SECTION_RPC_IP "rpc_ip" #define SECTION_RPC_PORT "rpc_port" +#define SECTION_RPC_ALLOW_REMOTE "rpc_allow_remote" #define SECTION_VALIDATION_PASSWORD "validation_password" #define SECTION_VALIDATION_KEY "validation_key" #define SECTION_PEER_SSL_CIPHER_LIST "peer_ssl_cipher_list" @@ -45,6 +46,7 @@ Config::Config() RPC_USER = "admin"; RPC_PASSWORD = "pass"; + RPC_ALLOW_REMOTE = false; DATA_DIR = "db/"; @@ -99,6 +101,9 @@ void Config::load() if (sectionSingleB(secConfig, SECTION_RPC_PORT, strTemp)) RPC_PORT = boost::lexical_cast(strTemp); + if (sectionSingleB(secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp)) + RPC_ALLOW_REMOTE = boost::lexical_cast(strTemp); + (void) sectionSingleB(secConfig, SECTION_VALIDATION_PASSWORD, VALIDATION_PASSWORD); (void) sectionSingleB(secConfig, SECTION_VALIDATION_KEY, VALIDATION_KEY); diff --git a/src/Config.h b/src/Config.h index 51290f0bd8..aa00ae1756 100644 --- a/src/Config.h +++ b/src/Config.h @@ -69,6 +69,7 @@ public: int RPC_PORT; std::string RPC_USER; std::string RPC_PASSWORD; + bool RPC_ALLOW_REMOTE; // Validation std::string VALIDATION_PASSWORD; diff --git a/src/RPCDoor.cpp b/src/RPCDoor.cpp index a5b7909ed5..f12f52e77d 100644 --- a/src/RPCDoor.cpp +++ b/src/RPCDoor.cpp @@ -27,6 +27,7 @@ void RPCDoor::startListening() bool RPCDoor::isClientAllowed(const std::string& ip) { + if(theConfig.RPC_ALLOW_REMOTE) return(true); if(ip=="127.0.0.1") return(true); return(false); } diff --git a/src/uint256.h b/src/uint256.h index 356433e619..3e89222070 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -233,7 +233,7 @@ public: while (phexdigit[*pEnd] >= 0) pEnd++; - if (pEnd-pBegin > 2*size()) + if ((unsigned int)(pEnd-pBegin) > 2*size()) pBegin = pEnd - 2*size(); unsigned char* pOut = end()-((pEnd-pBegin+1)/2);