[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-cd-3-2' - common/Util.cpp wsd/ClientSession.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Jul 12 22:34:38 UTC 2018


 common/Util.cpp       |    6 ++++++
 wsd/ClientSession.cpp |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 6acfdd5d3738a268667c0d61de7b398b8c5c5e8d
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Thu Jul 12 18:00:33 2018 -0400

    wsd: prevent anonymization to empty strings
    
    Change-Id: Ib4f90db5d39e7bf2e2f0b6566b1927363e6afcec
    Reviewed-on: https://gerrit.libreoffice.org/57377
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/common/Util.cpp b/common/Util.cpp
index b481d9e88..4b57d429a 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -549,6 +549,9 @@ namespace Util
 
     void mapAnonymized(const std::string& plain, const std::string& anonymized)
     {
+        if (plain.empty() || anonymized.empty())
+            return;
+
         LOG_TRC("Anonymizing [" << plain << "] -> [" << anonymized << "].");
 
         std::unique_lock<std::mutex> lock(AnonymizedMutex);
@@ -563,7 +566,10 @@ namespace Util
 
             const auto it = AnonymizedStrings.find(text);
             if (it != AnonymizedStrings.end())
+            {
+                LOG_TRC("Found anonymized [" << text << "] -> [" << it->second << "].");
                 return it->second;
+            }
         }
 
         // We just need something irreversible, short, and
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 87bf4e1db..a023453f7 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -309,12 +309,12 @@ bool ClientSession::loadDocument(const char* /*buffer*/, int /*length*/,
             std::string encodedUserId;
             Poco::URI::encode(_userId, "", encodedUserId);
             oss << " authorid=" << encodedUserId;
-            oss << " xauthorid=" << LOOLWSD::anonymizeUsername(encodedUserId);
+            oss << " xauthorid=" << LOOLWSD::anonymizeUsername(_userId);
 
             std::string encodedUserName;
             Poco::URI::encode(_userName, "", encodedUserName);
             oss << " author=" << encodedUserName;
-            oss << " xauthor=" << LOOLWSD::anonymizeUsername(encodedUserName);
+            oss << " xauthor=" << LOOLWSD::anonymizeUsername(_userName);
         }
 
         if (!_userExtraInfo.empty())


More information about the Libreoffice-commits mailing list