summaryrefslogtreecommitdiff
path: root/chromium/base/syslog_logging.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/base/syslog_logging.cc')
-rw-r--r--chromium/base/syslog_logging.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/chromium/base/syslog_logging.cc b/chromium/base/syslog_logging.cc
index 6d139b70986..cb9e26f6dfe 100644
--- a/chromium/base/syslog_logging.cc
+++ b/chromium/base/syslog_logging.cc
@@ -6,9 +6,11 @@
#if defined(OS_WIN)
#include <windows.h>
+#include <sddl.h>
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/debug/stack_trace.h"
+#include "base/win/win_util.h"
#elif defined(OS_LINUX)
// <syslog.h> defines LOG_INFO, LOG_WARNING macros that could conflict with
// base::LOG_INFO, base::LOG_WARNING.
@@ -29,6 +31,7 @@ namespace {
std::string* g_event_source_name = nullptr;
uint16_t g_category = 0;
uint32_t g_event_id = 0;
+base::string16* g_user_sid = nullptr;
} // namespace
@@ -39,11 +42,16 @@ void SetEventSource(const std::string& name,
g_event_source_name = new std::string(name);
g_category = category;
g_event_id = event_id;
+ DCHECK_EQ(nullptr, g_user_sid);
+ g_user_sid = new base::string16();
+ base::win::GetUserSidString(g_user_sid);
}
void ResetEventSourceForTesting() {
delete g_event_source_name;
g_event_source_name = nullptr;
+ delete g_user_sid;
+ g_user_sid = nullptr;
}
#endif // defined(OS_WIN)
@@ -90,10 +98,18 @@ EventLogMessage::~EventLogMessage() {
break;
}
LPCSTR strings[1] = {message.data()};
- if (!ReportEventA(event_log_handle, log_type, g_category, g_event_id, nullptr,
- 1, 0, strings, nullptr)) {
+ PSID user_sid = nullptr;
+ if (!::ConvertStringSidToSid(g_user_sid->c_str(), &user_sid)) {
+ stream() << " !!ERROR GETTING USER SID!!";
+ }
+
+ if (!ReportEventA(event_log_handle, log_type, g_category, g_event_id,
+ user_sid, 1, 0, strings, nullptr)) {
stream() << " !!NOT ADDED TO EVENTLOG!!";
}
+
+ if (user_sid != nullptr)
+ ::LocalFree(user_sid);
#elif defined(OS_LINUX)
const char kEventSource[] = "chrome";
openlog(kEventSource, LOG_NOWAIT | LOG_PID, LOG_USER);