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:
@@ -193,9 +193,7 @@
|
||||
<ClInclude Include="Peer.h" />
|
||||
<ClInclude Include="RequestParser.h" />
|
||||
<ClInclude Include="RPC.h" />
|
||||
<ClInclude Include="RPCServer.h" />
|
||||
<ClInclude Include="RPCCommands.h" />
|
||||
<ClInclude Include="RPCDoor.h" />
|
||||
<ClInclude Include="script.h" />
|
||||
<ClInclude Include="SecureAllocator.h" />
|
||||
<ClInclude Include="Serializer.h" />
|
||||
@@ -218,6 +216,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Makefile" />
|
||||
<None Include="newcoind.cfg" />
|
||||
<None Include="nodes.xml" />
|
||||
<None Include="notes.txt" />
|
||||
<CustomBuild Include="src\newcoin.proto">
|
||||
|
||||
@@ -281,9 +281,6 @@
|
||||
<ClInclude Include="NetworkThread.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RPCDoor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PeerDoor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -308,9 +305,6 @@
|
||||
<ClInclude Include="RPCCommands.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RPCServer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TransactionBundle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -430,6 +424,7 @@
|
||||
<Filter>tests\client2</Filter>
|
||||
</None>
|
||||
<None Include="SConstruct" />
|
||||
<None Include="newcoind.cfg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="src\newcoin.proto" />
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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