mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
add RPC_ALLOW_REMOTE connections flag
This commit is contained in:
@@ -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<int>(strTemp);
|
||||
|
||||
if (sectionSingleB(secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp))
|
||||
RPC_ALLOW_REMOTE = boost::lexical_cast<bool>(strTemp);
|
||||
|
||||
(void) sectionSingleB(secConfig, SECTION_VALIDATION_PASSWORD, VALIDATION_PASSWORD);
|
||||
(void) sectionSingleB(secConfig, SECTION_VALIDATION_KEY, VALIDATION_KEY);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user