[Libreoffice-commits] online.git: loolwsd.xml.in wsd/LOOLWSD.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Oct 5 14:38:47 UTC 2018
loolwsd.xml.in | 1 +
wsd/LOOLWSD.cpp | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
New commits:
commit c745732ac7337723d9a493086284d18d0364e82a
Author: Andras Timar <andras.timar at collabora.com>
AuthorDate: Mon Oct 1 20:17:35 2018 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Oct 5 16:38:28 2018 +0200
tdf#115163 allow bind to loopback interface
Change-Id: I4808fb0fd685dfe990efd5fb739ee86f1276ffad
Reviewed-on: https://gerrit.libreoffice.org/61297
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loolwsd.xml.in b/loolwsd.xml.in
index e626b98f1..621189a05 100644
--- a/loolwsd.xml.in
+++ b/loolwsd.xml.in
@@ -64,6 +64,7 @@
<net desc="Network settings">
<proto type="string" default="all" desc="Protocol to use IPv4, IPv6 or all for both">all</proto>
+ <listen type="string" default="any" desc="Listen address that loolwsd binds to. Can be 'any' or 'loopback'.">any</listen>
<service_root type="path" default="" desc="Prefix all the pages, websockets, etc. with this path."></service_root>
<post_allow desc="Allow/deny client IP address for POST(REST)." allow="true">
<host desc="The IPv4 private 192.168 block as plain IPv4 dotted decimal addresses.">192\.168\.[0-9]{1,3}\.[0-9]{1,3}</host>
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index baff3d518..49cb8c9f2 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -177,6 +177,9 @@ int ClientPortNumber = DEFAULT_CLIENT_PORT_NUMBER;
/// Protocols to listen on
Socket::Type ClientPortProto = Socket::Type::All;
+/// INET address to listen on
+ServerSocket::Type ClientListenAddr = ServerSocket::Type::Public;
+
/// Port for prisoners to connect to
int MasterPortNumber = DEFAULT_MASTER_PORT_NUMBER;
@@ -752,6 +755,7 @@ void LOOLWSD::initialize(Application& self)
{ "logging.level", "trace" },
{ "loleaflet_logging", "false" },
{ "net.proto", "all" },
+ { "net.listen", "any" },
{ "net.service_root", "" },
{ "ssl.enable", "true" },
{ "ssl.termination", "true" },
@@ -888,6 +892,16 @@ void LOOLWSD::initialize(Application& self)
LOG_WRN("Invalid protocol: " << proto);
}
+ {
+ std::string listen = getConfigValue<std::string>(conf, "net.listen", "");
+ if (!Poco::icompare(listen, "any"))
+ ClientListenAddr = ServerSocket::Type::Public;
+ else if (!Poco::icompare(listen, "loopback"))
+ ClientListenAddr = ServerSocket::Type::Local;
+ else
+ LOG_WRN("Invalid listen address: " << listen << ". Falling back to default: 'any'" );
+ }
+
// Prefix for the loolwsd pages; should not end with a '/'
ServiceRoot = getPathFromConfig("net.service_root");
while (ServiceRoot.length() > 0 && ServiceRoot[ServiceRoot.length() - 1] == '/')
@@ -2802,7 +2816,7 @@ private:
factory = std::make_shared<PlainSocketFactory>();
std::shared_ptr<ServerSocket> socket = getServerSocket(
- ServerSocket::Type::Public, port, WebServerPoll, factory);
+ ClientListenAddr, port, WebServerPoll, factory);
#ifdef MOBILEAPP
#ifdef BUILDING_TESTS
while (!socket)
More information about the Libreoffice-commits
mailing list