[Libreoffice-commits] online.git: Branch 'libreoffice-5-4' - 17 commits - common/Protocol.cpp configure.ac debian/control .gitignore loleaflet/dist loleaflet/reference.html Makefile.am test/httpwstest.cpp wsd/DocumentBroker.cpp wsd/FileServer.cpp wsd/LOOLWSD.cpp wsd/Storage.cpp

Andras Timar andras.timar at collabora.com
Wed Jun 28 08:07:04 UTC 2017


 .gitignore                        |    3 ++
 Makefile.am                       |    4 ++
 common/Protocol.cpp               |    3 +-
 configure.ac                      |    2 -
 debian/control                    |    2 -
 loleaflet/dist/toolbar/toolbar.js |    4 --
 loleaflet/reference.html          |    4 +-
 test/httpwstest.cpp               |   56 +++++++++++++++++++++++++++++++-------
 wsd/DocumentBroker.cpp            |   22 +++++++++++---
 wsd/FileServer.cpp                |    8 +++--
 wsd/LOOLWSD.cpp                   |    4 +-
 wsd/Storage.cpp                   |    4 +-
 12 files changed, 87 insertions(+), 29 deletions(-)

New commits:
commit f2b7928629d0929826ef2b8c0a4af7f7427ff40d
Author: Andras Timar <andras.timar at collabora.com>
Date:   Wed Jun 28 08:53:09 2017 +0200

    Bump version to 5.4.0.1
    
    Change-Id: I3f8a2066c584a559c7b267a6355e633b583a057f

diff --git a/configure.ac b/configure.ac
index 446c1f08..b3f72066 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
 
 AC_PREREQ([2.69])
 
-AC_INIT([libreoffice-online], [5.4.0.0.beta2], [libreoffice at lists.freedesktop.org])
+AC_INIT([libreoffice-online], [5.4.0.1], [libreoffice at lists.freedesktop.org])
 LT_INIT([shared, disable-static, dlopen])
 
 AM_INIT_AUTOMAKE([1.11 silent-rules subdir-objects tar-pax -Wno-portability])
commit 504cdba7545d3d04b5b0e057d656d4152e4d872c
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Jun 22 17:04:59 2017 +0530

    Update PostMessageOrigin if SSL termination is on too
    
    Change-Id: I887ab368fec62a5efefde4da3762c47dd0bf66d7
    Reviewed-on: https://gerrit.libreoffice.org/39100
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit a03f69a16a05aba90de600f0f92e2b89af2bf591)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 6d6db2b6..f26c5a57 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -414,6 +414,14 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
         Object::Ptr wopiInfo = new Object();
         if (!wopifileinfo->_postMessageOrigin.empty())
         {
+            // Update the scheme to https if ssl or ssl termination is on
+            if (wopifileinfo->_postMessageOrigin.substr(0, 7) == "http://" &&
+                (LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()))
+            {
+                wopifileinfo->_postMessageOrigin.replace(0, 4, "https");
+                LOG_DBG("Updating PostMessageOrgin scheme to HTTPS. Updated origin is [" << wopifileinfo->_postMessageOrigin << "].");
+            }
+
             wopiInfo->set("PostMessageOrigin", wopifileinfo->_postMessageOrigin);
         }
 
commit 25d27d3764c0c4de8aa95b26e6068e3cb144442c
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon Jun 26 11:43:23 2017 +0200

    tdf#108753 postinstall script uses setcap, package should depend on libcap2-bin
    
    Change-Id: I60ed36ad83d31925055ff5529da89c5c93f84403
    (cherry picked from commit f55d3583bec6d579b3aedef226552c070c022c0d)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/debian/control b/debian/control
index 1f38edf1..d85c95d0 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Standards-Version: 3.9.7
 Package: loolwsd
 Section: web
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, fontconfig, libsm6, libssl1.0.0, libodbc1, libxinerama1, libcairo2, libgl1-mesa-glx, libcups2, libdbus-glib-1-2, cpio, ${lo:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, fontconfig, libsm6, libssl1.0.0, libodbc1, libxinerama1, libcairo2, libgl1-mesa-glx, libcups2, libdbus-glib-1-2, cpio, libcap2-bin, ${lo:Depends}
 Description: LibreOffice Online WebSocket Daemon
  LOOLWSD is a daemon that talks to web browser clients and provides LibreOffice
  services.
commit 8c9953c321dcf474212e92e3e7913a8bddea6c69
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Jun 20 21:49:02 2017 +0100

    Protocol - only match complete token names.
    
    Change-Id: I027e29da8cc6c48a0d896fa41516934a3ff71b43
    (cherry picked from commit 8fb48811eccbf8f6d77919ce91c3cd918de15f56)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/common/Protocol.cpp b/common/Protocol.cpp
index 0aa50c47..be1a0b4c 100644
--- a/common/Protocol.cpp
+++ b/common/Protocol.cpp
@@ -188,8 +188,9 @@ namespace LOOLProtocol
             auto pos = message.find(name);
             while (pos != std::string::npos)
             {
+                bool spaceBefore = pos == 0 || message[pos-1] == ' ';
                 const auto beg = pos + name.size();
-                if (message[beg] == '=')
+                if (spaceBefore && message[beg] == '=')
                 {
                     const auto end = message.find_first_of(" \n", beg);
                     value = message.substr(beg + 1, end - beg - 1);
commit 742e03529d8cb13c55a8f6124c584d8963bcda74
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Jun 20 17:14:11 2017 +0530

    Its Host_PostmessageReady, not Host_PostMessageReady according to specs
    
    https://wopi.readthedocs.io/en/latest/scenarios/postmessage.html
    
    Change-Id: Id01b84417dbc8f9226cab05c08e0d566f0305534
    (cherry picked from commit 483f600f22305bd5b40e789b206c1e147a7eb6c3)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index 0db570d3..2392a648 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -2725,7 +2725,7 @@ The <code>id</code> property of ErrorEvent can have the following values:
 
 <p>It is to be noted that as mentioned in WOPI specs, loleaflet frame will
   ignore all post messages coming from the host frame
-  if <code>Host_PostMessageReady</code> has not been received. Further, no post
+  if <code>Host_PostmessageReady</code> has not been received. Further, no post
   messages will be emitted if 'PostMessageOrigin' property is missing from
   server response.</p>
 
@@ -2776,7 +2776,7 @@ WOPI host to editor
 		<th>Description</th>
 	</tr>
 	<tr>
-		<td><code><b>Host_PostMessageReady</b></code></td>
+		<td><code><b>Host_PostmessageReady</b></code></td>
 		<td><code>
 		</code></td>
 		<td>
commit 586f8d514b1fc38508225cd27bb85e828a89cab1
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon Jun 19 22:15:59 2017 -0400

    wsd: avoid deadlock when restoring forkit
    
    LOOLWSD::checkAndRestoreForKit() eventually takes
    NewChildrenLock, which is also taken in getNewChild_Blocks().
    
    Luckily, we can defer that to the Prisoner poll, which we do.
    
    Change-Id: Ib65c0be08870d1c4c68efd72192dac2e73c79f7c
    Reviewed-on: https://gerrit.libreoffice.org/38992
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit c28992758d1db7f23b477178d93c2b84e9f48c06)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 7c188f17..e77c3dd4 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -398,9 +398,9 @@ std::shared_ptr<ChildProcess> getNewChild_Blocks()
     ++numPreSpawn; // Replace the one we'll dispatch just now.
     if (rebalanceChildren(numPreSpawn) < 0)
     {
-        LOG_DBG("getNewChild: rebalancing of children failed. Checking and restoring forkit.");
+        LOG_DBG("getNewChild: rebalancing of children failed. Scheduling housekeeping to recover.");
 
-        LOOLWSD::checkAndRestoreForKit();
+        LOOLWSD::doHousekeeping();
 
         // Let the caller retry after a while.
         return nullptr;
commit 11b935ca3d88ee88b789f07a7f99ab9e2ad5794c
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon Jun 19 21:53:58 2017 -0400

    wsd: fix access-after-free error
    
    Valgrind spotted one case, and the other is possible but
    not common it seems.
    
    Change-Id: Id5e41145f597c3564263adb25b7b765db1c90bf7
    Reviewed-on: https://gerrit.libreoffice.org/38991
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit 7ae37aff0d2d6a337551b8b5a3d9daadc93d128c)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index ea40f44d..6d6db2b6 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -897,9 +897,8 @@ size_t DocumentBroker::removeSessionInternal(const std::string& id)
 
             const auto readonly = (it->second ? it->second->isReadOnly() : false);
 
-            //FIXME: We might be called from the session we are removing,
-            //FIXME: and if this is the last/only reference, we destroy it.
-            //FIXME: Should flag and remove from the poll thread.
+            // Remove. The caller must have a reference to the session
+            // in question, lest we destroy from underneith them.
             _sessions.erase(it);
 
             const auto count = _sessions.size();
@@ -1295,7 +1294,9 @@ bool DocumentBroker::forwardToClient(const std::shared_ptr<Message>& payload)
         if (sid == "all")
         {
             // Broadcast to all.
-            for (const auto& pair : _sessions)
+            // Events could cause the removal of sessions.
+            std::map<std::string, std::shared_ptr<ClientSession>> sessions(_sessions);
+            for (const auto& pair : sessions)
             {
                 pair.second->handleKitToClientMessage(data, size);
             }
@@ -1305,7 +1306,10 @@ bool DocumentBroker::forwardToClient(const std::shared_ptr<Message>& payload)
             const auto it = _sessions.find(sid);
             if (it != _sessions.end())
             {
-                return it->second->handleKitToClientMessage(data, size);
+                // Take a ref as the session could be removed from _sessions
+                // if it's the save confirmation keeping a stopped session alive.
+                std::shared_ptr<ClientSession> session = it->second;
+                return session->handleKitToClientMessage(data, size);
             }
             else
             {
commit 62be6719818cc906afb9dd63dc89eca88851143c
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Jun 19 17:27:10 2017 +0100

    Make the slideshow SVG validation somewhat less lame.
    
    Change-Id: Ie4853359ba3b43aabe629d0dcabb635d260627b6
    (cherry picked from commit 7f08458d959e1df28aa8dcefa714296a475c6b16)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp
index 3df78569..79c64fa4 100644
--- a/test/httpwstest.cpp
+++ b/test/httpwstest.cpp
@@ -31,6 +31,12 @@
 #include <Poco/StreamCopier.h>
 #include <Poco/StringTokenizer.h>
 #include <Poco/URI.h>
+#include <Poco/DOM/Node.h>
+#include <Poco/DOM/Document.h>
+#include <Poco/DOM/NodeFilter.h>
+#include <Poco/DOM/NodeIterator.h>
+#include <Poco/DOM/DOMParser.h>
+#include <Poco/SAX/InputSource.h>
 
 #include <cppunit/extensions/HelperMacros.h>
 
@@ -1204,6 +1210,27 @@ void HTTPWSTest::testInsertDelete()
     }
 }
 
+static int findInDOM(Poco::XML::Document *doc, const char *string, bool checkName,
+                     unsigned long nodeFilter = Poco::XML::NodeFilter::SHOW_ALL)
+{
+    int count = 0;
+    Poco::XML::NodeIterator itCode(doc, nodeFilter);
+    while (Poco::XML::Node* pNode = itCode.nextNode())
+    {
+        if (checkName)
+        {
+            if (pNode->nodeName() == string)
+                count++;
+        }
+        else
+        {
+            if (pNode->getNodeValue().find(string) != std::string::npos)
+                count++;
+        }
+    }
+    return count;
+}
+
 void HTTPWSTest::testSlideShow()
 {
     const auto testname = "slideshow ";
@@ -1250,15 +1277,26 @@ void HTTPWSTest::testSlideShow()
         CPPUNIT_ASSERT_EQUAL(Poco::Net::HTTPResponse::HTTP_OK, responseSVG.getStatus());
         CPPUNIT_ASSERT_EQUAL(std::string("image/svg+xml"), responseSVG.getContentType());
         std::cerr << "SVG file size: " << responseSVG.getContentLength() << std::endl;
-        // std::ofstream ofs("/tmp/slide.svg");
-        // Poco::StreamCopier::copyStream(rs, ofs);
-        // ofs.close();
-        (void)rs;
-        // Some setups render differently; recognize these two valid output sizes for now.
-        // Seems LO generates different svg content, even though visually identical.
-        // Current known sizes: 434748, 451329, 467345, 468653, 483882.
-        CPPUNIT_ASSERT(responseSVG.getContentLength() >= std::streamsize(430000) &&
-                       responseSVG.getContentLength() <= std::streamsize(490000));
+
+//        std::ofstream ofs("/tmp/slide.svg");
+//        Poco::StreamCopier::copyStream(rs, ofs);
+//        ofs.close();
+
+        // Asserting on the size of the stream is really unhelpful;
+        // lets checkout the contents instead ...
+        Poco::XML::DOMParser parser;
+        Poco::XML::InputSource svgSrc(rs);
+        Poco::AutoPtr<Poco::XML::Document> doc = parser.parse(&svgSrc);
+
+        // Do we have our automation / scripting
+        CPPUNIT_ASSERT(findInDOM(doc, "jessyinkstart",    false, Poco::XML::NodeFilter::SHOW_CDATA_SECTION));
+        CPPUNIT_ASSERT(findInDOM(doc, "jessyinkend",      false, Poco::XML::NodeFilter::SHOW_CDATA_SECTION));
+        CPPUNIT_ASSERT(findInDOM(doc, "libreofficestart", false, Poco::XML::NodeFilter::SHOW_CDATA_SECTION));
+        CPPUNIT_ASSERT(findInDOM(doc, "libreofficeend",   false, Poco::XML::NodeFilter::SHOW_CDATA_SECTION));
+
+        // Do we have plausible content ?
+        int countText = findInDOM(doc, "text", true, Poco::XML::NodeFilter::SHOW_ELEMENT);
+        CPPUNIT_ASSERT_EQUAL(countText, 93);
     }
     catch (const Poco::Exception& exc)
     {
commit 5ffef4b9a7999a25845be0d73f0797dc358e0cc3
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jun 16 20:40:55 2017 +0530

    .gitignore tags files
    
    Change-Id: I004e55ed6b2ba94071824c95a6c4d508f9c56ef8
    (cherry picked from commit a24475f5dd842a3b345d2a0ce5593b129304ab74)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/.gitignore b/.gitignore
index 723bd61b..fdde4608 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,5 +62,7 @@ loolwsd_fuzzer
 clientnb
 
 # make tags
+tags
+test/tags
 TAGS
 test/TAGS
commit 67320dc88d7b8723c7139069099815b333bb0a11
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon Jun 19 01:20:34 2017 -0400

    loleaflet: Allow users to repair at all times
    
    Since during an edit conflict the undo/redo
    buttons are dissabled (for the user who can't
    undo/redo anymore) disabling the repair button
    robs them of the ability to repair the document
    to an earlier state (i.e. before the conflict).
    
    This enables the repair button as soon as either
    the undo or redo is enabled, whereupon it remains
    enabled for the duration of the session.
    
    Change-Id: Ibaf257155f721e2cef596e965d8812d381ab3a5b
    Reviewed-on: https://gerrit.libreoffice.org/38942
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit 323e2789b9e82e0d600d39d0697d40f6014f54d7)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index d98dbef2..b1fdfc66 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -1235,9 +1235,7 @@ map.on('commandstatechanged', function (e) {
 	}
 
 	if (id === 'undo' || id === 'redo') {
-		if (toolbar.get('undo').disabled && toolbar.get('redo').disabled) {
-			toolbar.disable('repair');
-		} else {
+		if (!toolbar.get('undo').disabled || !toolbar.get('redo').disabled) {
 			toolbar.enable('repair');
 		}
 	}
commit 992749d4ed247a9423ba65ed3f91b451941446d5
Author: Henry Castro <hcastro at collabora.com>
Date:   Sun Jun 18 14:19:10 2017 -0400

    fix compilation errors with --disable-ssl option
    
    Change-Id: I777f0ebf054db0a5fd2c64e6d56a222826b40045
    (cherry picked from commit c24585741d19a9512cf81a6629e8c410ea35de13)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/Makefile.am b/Makefile.am
index 9cc44025..55707fa1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,6 +40,10 @@ AM_LDFLAGS = -pthread -Wl,-E,-rpath,/snap/loolwsd/current/usr/lib $(ZLIB_LIBS)
 
 if ENABLE_SSL
 AM_LDFLAGS += -lssl -lcrypto
+else
+loolwsd_fuzzer_LDADD = -lssl -lcrypto
+loolwsd_LDADD = -lssl -lcrypto
+loolconfig_LDADD = -lssl -lcrypto
 endif
 
 loolwsd_fuzzer_CPPFLAGS = -DKIT_IN_PROCESS=1 -DFUZZER=1 -DTDOC=\"$(abs_top_srcdir)/test/data\" $(AM_CPPFLAGS)
commit 562f2851ffd513b78d170841e3fd485f6ceaf671
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Jun 16 18:34:07 2017 +0100

    Check for spare space in the right place.
    
    ie. destination not source of the local file.
    
    Change-Id: I4d4c4e56deb039a44d8c2ab2886b8ca52bdb2ef8
    (cherry picked from commit 7b90179fe832194233ba08bff655243054a7cce6)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 54aa2d48..a1ed35ef 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -242,9 +242,9 @@ std::string LocalStorage::loadStorageFileToLocal(const std::string& /*accessToke
     // Despite the talk about URIs it seems that _uri is actually just a pathname here
     const auto publicFilePath = _uri.getPath();
 
-    if (!FileUtil::checkDiskSpace(publicFilePath))
+    if (!FileUtil::checkDiskSpace(_jailedFilePath))
     {
-        throw StorageSpaceLowException("Low disk space for " + publicFilePath);
+        throw StorageSpaceLowException("Low disk space for " + _jailedFilePath);
     }
 
     LOG_INF("Linking " << publicFilePath << " to " << _jailedFilePath);
commit f2ff876d3cc3407ec0e910d2bbc10c13e0e3b970
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Jun 22 13:15:36 2017 +0530

    Enable HTTP key pinning when ssl termination is on too
    
    Change-Id: Id2d7a34374236f50e28551ff9c57433d9153e2fd
    (cherry picked from commit 2e42ae8c2f822f6c02de77bb0aebf064ad066a3e)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 0d5e48d3..93820c4a 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -529,7 +529,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
     oss << cspOss.str();
 
     // Setup HTTP Public key pinning
-    if (LOOLWSD::isSSLEnabled() && config.getBool("ssl.hpkp[@enable]", false))
+    if ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) && config.getBool("ssl.hpkp[@enable]", false))
     {
         size_t i = 0;
         std::string pinPath = "ssl.hpkp.pins.pin[" + std::to_string(i) + "]";
commit 8720ca7186810178acbf2c355cb9bc6fec93d37d
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Jun 12 16:09:10 2017 +0530

    Consistency
    
    Change-Id: I16889728d0062c058ea5831ff8892025e1719c3e
    (cherry picked from commit 5c7b9ce6e71e37176296683b005c4ed3c0c34ab4)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index f09dbf70..0d5e48d3 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -481,7 +481,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
            << "script-src 'unsafe-inline' 'self'; "
            << "style-src 'self' 'unsafe-inline'; "
            << "font-src 'self' data:; "
-           << "object-src blob: ;";
+           << "object-src blob:; ";
 
     std::string frameAncestor;
     const auto it = request.find("Referer"); // Referer[sic]
commit 7e63aee0552f83d19938fd3c6da127ba50dd2b2b
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Sat Jun 10 19:26:17 2017 +0530

    CSP - Add object-src: , this is required for printing documents
    
    Change-Id: I4a759086f2b503dfa9df4000267d920984cfe422
    (cherry picked from commit 54ea43602604a1d111e35e6efef3d76cc8386e70)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 900a69fe..f09dbf70 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -480,7 +480,8 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
            << "connect-src 'self' " << host << "; "
            << "script-src 'unsafe-inline' 'self'; "
            << "style-src 'self' 'unsafe-inline'; "
-           << "font-src 'self' data:; ";
+           << "font-src 'self' data:; "
+           << "object-src blob: ;";
 
     std::string frameAncestor;
     const auto it = request.find("Referer"); // Referer[sic]
commit b4c3e6aab3df42c6d5c9a388f0618cdfc9892e8a
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Jun 6 17:36:47 2017 +0530

    CSP - allow WOPI host as image sources
    
    This is needed to avoid CSP error when loading the avatar image URL from
    the WOPI hosts.
    
    Change-Id: I6bd8bd846f81bc799192e7fbc16b2d7ecc9f555e
    (cherry picked from commit 2d0ec13249851756eb320f004850cc25d98f1acc)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index a50be219..900a69fe 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -480,8 +480,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
            << "connect-src 'self' " << host << "; "
            << "script-src 'unsafe-inline' 'self'; "
            << "style-src 'self' 'unsafe-inline'; "
-           << "font-src 'self' data:; "
-           << "img-src 'self' data:; ";
+           << "font-src 'self' data:; ";
 
     std::string frameAncestor;
     const auto it = request.find("Referer"); // Referer[sic]
@@ -513,12 +512,14 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
 
         // Replaced by frame-ancestors in CSP but some oldies don't know about that
         oss << "X-Frame-Options: allow-from " << frameAncestor << "\r\n";
-        cspOss << "frame-ancestors " << frameAncestor;
+        cspOss << "img-src 'self' data: " << frameAncestor << "; "
+               << "frame-ancestors " << frameAncestor;
     }
     else
     {
         LOG_TRC("Denied frame ancestor: " << frameAncestor);
 
+        cspOss << "img-src 'self' data: ;";
         oss << "X-Frame-Options: deny\r\n";
     }
 
commit bf0c969a3533b4b939d1bb723bda1a6083e8b299
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Jun 7 10:57:21 2017 -0400

    gitignore: *.lo files
    
    Change-Id: I26fd7381ed30592caefa8f515bbdc3e19defdbab
    (cherry picked from commit 075b3b5d1f3ccd615d3223d02acc86143c637c8c)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/.gitignore b/.gitignore
index 6a0481e9..723bd61b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,6 +45,7 @@ cscope*
 *.orig
 loolwsd.log
 *.log.*.gz
+*.lo
 
 connect
 lokitclient


More information about the Libreoffice-commits mailing list