Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/shared/Communication.cpp

Issue 4859386648330240: Fix named pipe security on Windows XP (Closed)
Patch Set: Created June 16, 2014, 10:15 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/plugin/AdblockPlusClient.cpp ('K') | « src/plugin/AdblockPlusClient.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/Communication.cpp
===================================================================
--- a/src/shared/Communication.cpp
+++ b/src/shared/Communication.cpp
@@ -177,7 +177,6 @@
pipe = INVALID_HANDLE_VALUE;
if (mode == MODE_CREATE)
{
-
SECURITY_ATTRIBUTES securityAttributes = {};
securityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
securityAttributes.bInheritHandle = TRUE;
@@ -186,16 +185,24 @@
AutoHandle token;
OpenProcessToken(GetCurrentProcess(), TOKEN_READ, token);
- std::auto_ptr<SID> logonSid = GetLogonSid(token);
- // Create a SECURITY_DESCRIPTOR that has both Low Integrity and allows access to all AppContainers
- // This is needed since IE likes to jump out of Enhanced Protected Mode for specific pages (bing.com)
- std::auto_ptr<SECURITY_DESCRIPTOR> securityDescriptor = CreateSecurityDescriptor(logonSid.get());
- securityAttributes.lpSecurityDescriptor = securityDescriptor.release();
- sharedSecurityDescriptor.reset(static_cast<SECURITY_DESCRIPTOR*>(securityAttributes.lpSecurityDescriptor));
+
+ if (IsWindowsVistaOrLater())
+ {
+ std::auto_ptr<SID> logonSid = GetLogonSid(token);
+ // Create a SECURITY_DESCRIPTOR that has both Low Integrity and allows access to all AppContainers
+ // This is needed since IE likes to jump out of Enhanced Protected Mode for specific pages (bing.com)
+ std::auto_ptr<SECURITY_DESCRIPTOR> securityDescriptor = CreateSecurityDescriptor(logonSid.get());
+ securityAttributes.lpSecurityDescriptor = securityDescriptor.release();
+ sharedSecurityDescriptor.reset(static_cast<SECURITY_DESCRIPTOR*>(securityAttributes.lpSecurityDescriptor));
- pipe = CreateNamedPipeW(pipeName.c_str(), PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
- PIPE_UNLIMITED_INSTANCES, bufferSize, bufferSize, 0, &securityAttributes);
-
+ pipe = CreateNamedPipeW(pipeName.c_str(), PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
+ PIPE_UNLIMITED_INSTANCES, bufferSize, bufferSize, 0, &securityAttributes);
+ }
+ else
+ {
+ pipe = CreateNamedPipeW(pipeName.c_str(), PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
+ PIPE_UNLIMITED_INSTANCES, bufferSize, bufferSize, 0, &securityAttributes);
Felix Dahlke 2014/06/24 12:25:05 This is the exact same "CreateNamedPipeW" done in
+ }
}
else
{
« src/plugin/AdblockPlusClient.cpp ('K') | « src/plugin/AdblockPlusClient.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld