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

New commits:
commit 7b5d10a69ad29c771c5dd5e02e4230cc2f2d31af
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Fri Mar 15 10:51:19 2019 +0100
Commit:     Ashod Nakashian <ashnak...@gmail.com>
CommitDate: Sun Apr 14 20:52:40 2019 +0200

    Anonymization: don't log when it is disabled.
    
    Also fix unexpected concatenation error in Poco::URI::encode generating
    eg. authorid=localhost0 xauthorid=localhost0localhost0 in the output.
    
    Change-Id: I560e47e31884eeb1c662f468436ed7541cfb082d
    Reviewed-on: https://gerrit.libreoffice.org/69299
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/common/Util.cpp b/common/Util.cpp
index a27ed5a22..caea764a4 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -659,7 +659,9 @@ namespace Util
         if (plain.empty() || anonymized.empty())
             return;
 
-        LOG_TRC("Anonymizing [" << plain << "] -> [" << anonymized << "].");
+        auto &log = Log::logger();
+        if (log.trace() && plain != anonymized)
+            LOG_TRC("Anonymizing [" << plain << "] -> [" << anonymized << 
"].");
 
         std::unique_lock<std::mutex> lock(AnonymizedMutex);
 
@@ -674,7 +676,9 @@ namespace Util
             const auto it = AnonymizedStrings.find(text);
             if (it != AnonymizedStrings.end())
             {
-                LOG_TRC("Found anonymized [" << text << "] -> [" << it->second 
<< "].");
+                auto &log = Log::logger();
+                if (log.trace() && text != it->second)
+                    LOG_TRC("Found anonymized [" << text << "] -> [" << 
it->second << "].");
                 return it->second;
             }
         }
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 7cd98ae69..efbac7dab 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -420,12 +420,14 @@ bool ClientSession::loadDocument(const char* /*buffer*/, 
int /*length*/,
             std::string encodedUserId;
             Poco::URI::encode(getUserId(), "", encodedUserId);
             oss << " authorid=" << encodedUserId;
+            encodedUserId = "";
             Poco::URI::encode(LOOLWSD::anonymizeUsername(getUserId()), "", 
encodedUserId);
             oss << " xauthorid=" << encodedUserId;
 
             std::string encodedUserName;
             Poco::URI::encode(getUserName(), "", encodedUserName);
             oss << " author=" << encodedUserName;
+            encodedUserName = "";
             Poco::URI::encode(LOOLWSD::anonymizeUsername(getUserName()), "", 
encodedUserName);
             oss << " xauthor=" << encodedUserName;
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to