Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864648
D1753.id.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
D1753.id.diff
View Options
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1865,6 +1865,10 @@
}
}
+ // Check for host lookup allowed before parsing any network related
+ // parameters
+ fNameLookup = gArgs.GetBoolArg("-dns", DEFAULT_NAME_LOOKUP);
+
bool proxyRandomize =
gArgs.GetBoolArg("-proxyrandomize", DEFAULT_PROXYRANDOMIZE);
// -proxy sets a proxy for all outgoing network traffic
@@ -1873,11 +1877,16 @@
std::string proxyArg = gArgs.GetArg("-proxy", "");
SetLimited(NET_TOR);
if (proxyArg != "" && proxyArg != "0") {
- CService resolved(LookupNumeric(proxyArg.c_str(), 9050));
- proxyType addrProxy = proxyType(resolved, proxyRandomize);
+ CService proxyAddr;
+ if (!Lookup(proxyArg.c_str(), proxyAddr, 9050, fNameLookup)) {
+ return InitError(strprintf(
+ _("Invalid -proxy address or hostname: '%s'"), proxyArg));
+ }
+
+ proxyType addrProxy = proxyType(proxyAddr, proxyRandomize);
if (!addrProxy.IsValid()) {
- return InitError(
- strprintf(_("Invalid -proxy address: '%s'"), proxyArg));
+ return InitError(strprintf(
+ _("Invalid -proxy address or hostname: '%s'"), proxyArg));
}
SetProxy(NET_IPV4, addrProxy);
@@ -1898,11 +1907,15 @@
if (onionArg == "0") { // Handle -noonion/-onion=0
SetLimited(NET_TOR); // set onions as unreachable
} else {
- CService resolved(LookupNumeric(onionArg.c_str(), 9050));
- proxyType addrOnion = proxyType(resolved, proxyRandomize);
+ CService onionProxy;
+ if (!Lookup(onionArg.c_str(), onionProxy, 9050, fNameLookup)) {
+ return InitError(strprintf(
+ _("Invalid -onion address or hostname: '%s'"), onionArg));
+ }
+ proxyType addrOnion = proxyType(onionProxy, proxyRandomize);
if (!addrOnion.IsValid()) {
- return InitError(
- strprintf(_("Invalid -onion address: '%s'"), onionArg));
+ return InitError(strprintf(
+ _("Invalid -onion address or hostname: '%s'"), onionArg));
}
SetProxy(NET_TOR, addrOnion);
SetLimited(NET_TOR, false);
@@ -1912,7 +1925,6 @@
// see Step 2: parameter interactions for more information about these
fListen = gArgs.GetBoolArg("-listen", DEFAULT_LISTEN);
fDiscover = gArgs.GetBoolArg("-discover", true);
- fNameLookup = gArgs.GetBoolArg("-dns", DEFAULT_NAME_LOOKUP);
fRelayTxes = !gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
if (fListen) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 21:27 (15 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865953
Default Alt Text
D1753.id.diff (2 KB)
Attached To
D1753: Enable host lookups for -proxy and -onion parameters
Event Timeline
Log In to Comment