Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[log] redact username/password when savings screenshots #10601

Merged
merged 1 commit into from Oct 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions xbmc/pictures/Picture.cpp
Expand Up @@ -26,6 +26,7 @@
#include <algorithm>

#include "Picture.h"
#include "URL.h"
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "FileItem.h"
Expand Down Expand Up @@ -72,7 +73,7 @@ bool CPicture::GetThumbnailFromSurface(const unsigned char* buffer, int width, i

bool CPicture::CreateThumbnailFromSurface(const unsigned char *buffer, int width, int height, int stride, const std::string &thumbFile)
{
CLog::Log(LOGDEBUG, "cached image '%s' size %dx%d", thumbFile.c_str(), width, height);
CLog::Log(LOGDEBUG, "cached image '%s' size %dx%d", CURL::GetRedacted(thumbFile).c_str(), width, height);
if (URIUtils::HasExtension(thumbFile, ".jpg"))
{
#if defined(HAS_OMXPLAYER)
Expand All @@ -86,7 +87,7 @@ bool CPicture::CreateThumbnailFromSurface(const unsigned char *buffer, int width
IImage* pImage = ImageFactory::CreateLoader(thumbFile);
if(pImage == NULL || !pImage->CreateThumbnailFromSurface((BYTE *)buffer, width, height, XB_FMT_A8R8G8B8, stride, thumbFile.c_str(), thumb, thumbsize))
{
CLog::Log(LOGERROR, "Failed to CreateThumbnailFromSurface for %s", thumbFile.c_str());
CLog::Log(LOGERROR, "Failed to CreateThumbnailFromSurface for %s", CURL::GetRedacted(thumbFile).c_str());
delete pImage;
return false;
}
Expand Down Expand Up @@ -119,7 +120,7 @@ bool CThumbnailWriter::DoWork()

if (!CPicture::CreateThumbnailFromSurface(m_buffer, m_width, m_height, m_stride, m_thumbFile))
{
CLog::Log(LOGERROR, "CThumbnailWriter::DoWork unable to write %s", m_thumbFile.c_str());
CLog::Log(LOGERROR, "CThumbnailWriter::DoWork unable to write %s", CURL::GetRedacted(m_thumbFile).c_str());
success = false;
}

Expand Down
9 changes: 5 additions & 4 deletions xbmc/utils/Screenshot.cpp
Expand Up @@ -24,6 +24,7 @@
#include <vector>

#include "Util.h"
#include "URL.h"

#include "Application.h"
#include "windowing/WindowingFactory.h"
Expand Down Expand Up @@ -195,11 +196,11 @@ void CScreenShot::TakeScreenshot(const std::string &filename, bool sync)
CScreenshotSurface surface;
if (!surface.capture())
{
CLog::Log(LOGERROR, "Screenshot %s failed", filename.c_str());
CLog::Log(LOGERROR, "Screenshot %s failed", CURL::GetRedacted(filename).c_str());
return;
}

CLog::Log(LOGDEBUG, "Saving screenshot %s", filename.c_str());
CLog::Log(LOGDEBUG, "Saving screenshot %s", CURL::GetRedacted(filename).c_str());

//set alpha byte to 0xFF
for (int y = 0; y < surface.m_height; y++)
Expand All @@ -213,7 +214,7 @@ void CScreenShot::TakeScreenshot(const std::string &filename, bool sync)
if (sync)
{
if (!CPicture::CreateThumbnailFromSurface(surface.m_buffer, surface.m_width, surface.m_height, surface.m_stride, filename))
CLog::Log(LOGERROR, "Unable to write screenshot %s", filename.c_str());
CLog::Log(LOGERROR, "Unable to write screenshot %s", CURL::GetRedacted(filename).c_str());

delete [] surface.m_buffer;
surface.m_buffer = NULL;
Expand All @@ -225,7 +226,7 @@ void CScreenShot::TakeScreenshot(const std::string &filename, bool sync)
if (fp)
fclose(fp);
else
CLog::Log(LOGERROR, "Unable to create file %s", filename.c_str());
CLog::Log(LOGERROR, "Unable to create file %s", CURL::GetRedacted(filename).c_str());

//write .png file asynchronous with CThumbnailWriter, prevents stalling of the render thread
//buffer is deleted from CThumbnailWriter
Expand Down