Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115785
D4640.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D4640.diff
View Options
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -306,7 +306,7 @@
std::vector<std::pair<std::string, uint16_t>> endpoints;
// Determine what addresses to bind to
- if (!gArgs.IsArgSet("-rpcallowip")) {
+ if (!(gArgs.IsArgSet("-rpcallowip") && gArgs.IsArgSet("-rpcbind")) {
// Default to loopback if not allowing external IPs.
endpoints.push_back(std::make_pair("::1", defaultPort));
endpoints.push_back(std::make_pair("127.0.0.1", defaultPort));
@@ -315,6 +315,10 @@
"-rpcallowip was not specified, refusing to allow "
"everyone to connect\n");
}
+ if (gArgs.IsArgSet("-rpcallowip")) {
+ LogPrintf("WARNING: option -rpcallowip was specified without"
+ "-rpcbind; this doesn't usually make sense\n");
+ }
} else if (gArgs.IsArgSet("-rpcbind")) {
// Specific bind address.
for (const std::string &strRPCBind : gArgs.GetArgs("-rpcbind")) {
@@ -323,10 +327,6 @@
SplitHostPort(strRPCBind, port, host);
endpoints.push_back(std::make_pair(host, port));
}
- } else {
- // No specific bind address specified, bind to any.
- endpoints.push_back(std::make_pair("::", defaultPort));
- endpoints.push_back(std::make_pair("0.0.0.0", defaultPort));
}
// Bind addresses
@@ -339,8 +339,11 @@
http, i->first.empty() ? nullptr : i->first.c_str(), i->second);
if (bind_handle) {
CNetAddr addr;
- if (i->first.empty() || (LookupHost(i->first.c_str(), addr, false) && addr.IsBindAny())) {
- LogPrintf("WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet\n");
+ if (i->first.empty() ||
+ (LookupHost(i->first.c_str(), addr, false) &&
+ addr.IsBindAny())) {
+ LogPrintf("WARNING: the RPC server is not safe to expose to "
+ "untrusted networks such as the public internet\n");
}
boundSockets.push_back(bind_handle);
} else {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 12:04 (1 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187765
Default Alt Text
D4640.diff (2 KB)
Attached To
D4640: [Backport] Never bind INADDR_ANY by default, and warn when doing so explicitly
Event Timeline
Log In to Comment