[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp

Pranav Kant pranavk at collabora.co.uk
Wed May 10 15:03:05 UTC 2017


 wsd/DocumentBroker.cpp |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit e8ff26899203b6994579afacdd5f89aa68c8a696
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon May 8 23:40:46 2017 +0530

    wsd: Use hostname and port in doc key too
    
    ... to avoid different WOPI hosts using same loolwsd instance sharing a
    file because the path of the file (file id etc.) is same in both of
    WOPI hosts.
    
    Though, having hosts + port in doc key engenders the possibility of
    opening the same file as two if the WOPI host is accessed using
    different aliases but that is much less of a concern than security bug
    mentioned in previous paragraph.
    
    Change-Id: Iaa2f880edce952925a85e56ed8eba99514e19751
    Reviewed-on: https://gerrit.libreoffice.org/37400
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index f5af9895..21f6965f 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -103,14 +103,13 @@ Poco::URI DocumentBroker::sanitizeURI(const std::string& uri)
 std::string DocumentBroker::getDocKey(const Poco::URI& uri)
 {
     // If multiple host-names are used to access us, then
-    // they must be aliases. Permission to access aliased hosts
-    // is checked at the point of accepting incoming connections.
-    // At this point storing the hostname artificially discriminates
-    // between aliases and forces same document (when opened from
+    // we force same document (when opened from
     // alias hosts) to load as separate documents and sharing doesn't
     // work. Worse, saving overwrites one another.
+    // But we also do not want different WOPI hosts using the same path
+    // for some file getting shared across WOPI hosts
     std::string docKey;
-    Poco::URI::encode(uri.getPath(), "", docKey);
+    Poco::URI::encode(uri.getHost() + ":" + std::to_string(uri.getPort()) + uri.getPath(), "", docKey);
     return docKey;
 }
 


More information about the Libreoffice-commits mailing list