diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-07-12 18:00:33 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-07-13 00:34:20 +0200 |
commit | 6acfdd5d3738a268667c0d61de7b398b8c5c5e8d (patch) | |
tree | f2a6805a77842804df3972f7da112250a87050ea | |
parent | 2fad1aaec63fd8804edc12d0c385c0f3ac83f499 (diff) |
wsd: prevent anonymization to empty stringscd-3.2.2-6
Change-Id: Ib4f90db5d39e7bf2e2f0b6566b1927363e6afcec
Reviewed-on: https://gerrit.libreoffice.org/57377
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | common/Util.cpp | 6 | ||||
-rw-r--r-- | wsd/ClientSession.cpp | 4 |
2 files changed, 8 insertions, 2 deletions
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()) |