anonymization: Anonymize urls in Kit.cpp

(cherry picked from commit 3a530d247496e577ed994c9cbece5faebd68e850)

Change-Id: I02c24e53664dbc971e8b5b4bdc3e607a53769bd0
This commit is contained in:
Jan Holesovsky 2018-06-15 15:26:47 +02:00 committed by Ashod Nakashian
parent 25ef47adb4
commit 564fd6c621

View file

@ -504,7 +504,7 @@ class PngCache
int width, int height,
int bufferWidth, int bufferHeight,
std::vector<char>& output, LibreOfficeKitTileMode mode,
TileBinaryHash hash, TileWireId wid, TileWireId /*oldWid*/)
TileBinaryHash hash, TileWireId wid, TileWireId /* oldWid */)
{
LOG_DBG("PNG cache with hash " << hash << " missed.");
/*
@ -796,7 +796,7 @@ public:
_editorChangeWarning(false)
{
LOG_INF("Document ctor for [" << _docKey <<
"] url [" << _url << "] on child [" << _jailId <<
"] url [" << anonymizeUrl(_url) << "] on child [" << _jailId <<
"] and id [" << _docId << "].");
assert(_loKit);
@ -806,7 +806,7 @@ public:
~Document()
{
LOG_INF("~Document dtor for [" << _docKey <<
"] url [" << _url << "] on child [" << _jailId <<
"] url [" << anonymizeUrl(_url) << "] on child [" << _jailId <<
"] and id [" << _docId << "]. There are " <<
_sessions.size() << " views.");
@ -843,12 +843,12 @@ public:
{
if (_sessions.find(sessionId) != _sessions.end())
{
LOG_WRN("Session [" << sessionId << "] on url [" << _url << "] already exists.");
LOG_WRN("Session [" << sessionId << "] on url [" << anonymizeUrl(_url) << "] already exists.");
return true;
}
LOG_INF("Creating " << (_sessions.empty() ? "first" : "new") <<
" session for url: " << _url << " for sessionId: " <<
" session for url: " << anonymizeUrl(_url) << " for sessionId: " <<
sessionId << " on jailId: " << _jailId);
auto session = std::make_shared<ChildSession>(sessionId, _jailId, *this);
@ -864,7 +864,7 @@ public:
catch (const std::exception& ex)
{
LOG_ERR("Exception while creating session [" << sessionId <<
"] on url [" << _url << "] - '" << ex.what() << "'.");
"] on url [" << anonymizeUrl(_url) << "] - '" << ex.what() << "'.");
return false;
}
}
@ -905,7 +905,7 @@ public:
#ifndef MOBILEAPP
if (num_sessions == 0)
{
LOG_INF("Document [" << _url << "] has no more views, exiting bluntly.");
LOG_INF("Document [" << anonymizeUrl(_url) << "] has no more views, exiting bluntly.");
std::_Exit(Application::EXIT_OK);
}
#endif
@ -1364,7 +1364,7 @@ private:
void onUnload(const ChildSession& session) override
{
const auto& sessionId = session.getId();
LOG_INF("Unloading session [" << sessionId << "] on url [" << _url << "].");
LOG_INF("Unloading session [" << sessionId << "] on url [" << anonymizeUrl(_url) << "].");
const int viewId = session.getViewId();
_tileQueue->removeCursorPosition(viewId);
@ -1386,14 +1386,14 @@ private:
#ifndef MOBILEAPP
if (_sessions.empty())
{
LOG_INF("Document [" << _url << "] has no more views, exiting bluntly.");
LOG_INF("Document [" << anonymizeUrl(_url) << "] has no more views, exiting bluntly.");
std::_Exit(Application::EXIT_OK);
}
#endif
LOG_INF("Document [" << _url << "] has no more views, but has " <<
LOG_INF("Document [" << anonymizeUrl(_url) << "] has no more views, but has " <<
_sessions.size() << " sessions still. Destroying the document.");
_loKitDocument.reset();
LOG_INF("Document [" << _url << "] session [" << sessionId << "] unloaded Document.");
LOG_INF("Document [" << anonymizeUrl(_url) << "] session [" << sessionId << "] unloaded Document.");
return;
}
else
@ -1407,7 +1407,7 @@ private:
// _viewIdToCallbackDescr.erase(viewId);
viewCount = _loKitDocument->getViewsCount();
LOG_INF("Document [" << _url << "] session [" <<
LOG_INF("Document [" << anonymizeUrl(_url) << "] session [" <<
sessionId << "] unloaded view [" << viewId << "]. Have " <<
viewCount << " view" << (viewCount != 1 ? "s." : "."));
@ -1690,7 +1690,7 @@ private:
}
LOG_INF("Initializing for rendering session [" << sessionId << "] on document url [" <<
_url << "] with: [" << makeRenderParams(_renderOpts, userNameAnonym) << "].");
anonymizeUrl(_url) << "] with: [" << makeRenderParams(_renderOpts, userNameAnonym) << "].");
// initializeForRendering() should be called before
// registerCallback(), as the previous creates a new view in Impress.
@ -1710,7 +1710,7 @@ private:
_loKitDocument->registerCallback(ViewCallback, _viewIdToCallbackDescr[viewId].get());
const int viewCount = _loKitDocument->getViewsCount();
LOG_INF("Document url [" << _url << "] for session [" <<
LOG_INF("Document url [" << anonymizeUrl(_url) << "] for session [" <<
sessionId << "] loaded view [" << viewId << "]. Have " <<
viewCount << " view" << (viewCount != 1 ? "s." : "."));
@ -1771,7 +1771,7 @@ private:
std::vector<char> vect(size);
vect.assign(data, data + size);
// TODO this is probably wrong...
// TODO loolnb - this is probably wrong...
session->handleMessage(/* fin = */ false, WSOpCode::Binary, vect);
return true;
}
@ -2201,7 +2201,6 @@ void lokit_main(
}
Util::rng::reseed();
const std::string LogLevel = logLevel ? logLevel : "trace";
const bool bTraceStartup = (std::getenv("LOOL_TRACE_STARTUP") != nullptr);
Log::initialize("kit", bTraceStartup ? "trace" : logLevel, logColor != nullptr, logToFile, logProperties);