mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
zmq: accept unix domain socket address for notifier
This commit is contained in:
37
src/init.cpp
37
src/init.cpp
@@ -1301,30 +1301,33 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::string port_option : {
|
||||
"-i2psam",
|
||||
"-onion",
|
||||
"-proxy",
|
||||
"-rpcbind",
|
||||
"-torcontrol",
|
||||
"-whitebind",
|
||||
"-zmqpubhashblock",
|
||||
"-zmqpubhashtx",
|
||||
"-zmqpubrawblock",
|
||||
"-zmqpubrawtx",
|
||||
"-zmqpubsequence",
|
||||
for (const auto &port_option : std::vector<std::pair<std::string, bool>>{
|
||||
// arg name UNIX socket support
|
||||
{"-i2psam", false},
|
||||
{"-onion", true},
|
||||
{"-proxy", true},
|
||||
{"-rpcbind", false},
|
||||
{"-torcontrol", false},
|
||||
{"-whitebind", false},
|
||||
{"-zmqpubhashblock", true},
|
||||
{"-zmqpubhashtx", true},
|
||||
{"-zmqpubrawblock", true},
|
||||
{"-zmqpubrawtx", true},
|
||||
{"-zmqpubsequence", true}
|
||||
}) {
|
||||
for (const std::string& socket_addr : args.GetArgs(port_option)) {
|
||||
const std::string arg{port_option.first};
|
||||
const bool unix{port_option.second};
|
||||
for (const std::string& socket_addr : args.GetArgs(arg)) {
|
||||
std::string host_out;
|
||||
uint16_t port_out{0};
|
||||
if (!SplitHostPort(socket_addr, port_out, host_out)) {
|
||||
#if HAVE_SOCKADDR_UN
|
||||
// Allow unix domain sockets for -proxy and -onion e.g. unix:/some/file/path
|
||||
if ((port_option != "-proxy" && port_option != "-onion") || socket_addr.find(ADDR_PREFIX_UNIX) != 0) {
|
||||
return InitError(InvalidPortErrMsg(port_option, socket_addr));
|
||||
// Allow unix domain sockets for some options e.g. unix:/some/file/path
|
||||
if (!unix || socket_addr.find(ADDR_PREFIX_UNIX) != 0) {
|
||||
return InitError(InvalidPortErrMsg(arg, socket_addr));
|
||||
}
|
||||
#else
|
||||
return InitError(InvalidPortErrMsg(port_option, socket_addr));
|
||||
return InitError(InvalidPortErrMsg(arg, socket_addr));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user