launcher: named pipe SDDL

This commit is contained in:
Bill Zissimopoulos 2016-05-11 20:37:44 -07:00
parent da839e39b8
commit a81a766bbe
2 changed files with 14 additions and 0 deletions

View File

@ -16,6 +16,7 @@
*/ */
#include <launcher/launcher.h> #include <launcher/launcher.h>
#include <sddl.h>
#define PROGNAME "WinFsp-Launcher" #define PROGNAME "WinFsp-Launcher"
#define REGKEY "SYSTEM\\CurrentControlSet\\Services\\" PROGNAME "\\Services" #define REGKEY "SYSTEM\\CurrentControlSet\\Services\\" PROGNAME "\\Services"
@ -356,8 +357,16 @@ static VOID SvcPipeTransact(PWSTR PipeBuf, PULONG PSize);
static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv) static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
{ {
SECURITY_ATTRIBUTES SecurityAttributes = { 0 };
InitializeCriticalSection(&SvcInstanceLock); InitializeCriticalSection(&SvcInstanceLock);
SecurityAttributes.nLength = sizeof SecurityAttributes;
SecurityAttributes.bInheritHandle = FALSE;
if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(L"" PIPE_SDDL, SDDL_REVISION_1,
&SecurityAttributes.lpSecurityDescriptor, 0))
goto fail;
SvcEvent = CreateEventW(0, TRUE, FALSE, 0); SvcEvent = CreateEventW(0, TRUE, FALSE, 0);
if (0 == SvcEvent) if (0 == SvcEvent)
goto fail; goto fail;
@ -378,6 +387,8 @@ static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
if (0 == SvcThread) if (0 == SvcThread)
goto fail; goto fail;
LocalFree(SecurityAttributes.lpSecurityDescriptor);
return STATUS_SUCCESS; return STATUS_SUCCESS;
fail: fail:
@ -395,6 +406,8 @@ fail:
if (0 != SvcEvent) if (0 != SvcEvent)
CloseHandle(SvcEvent); CloseHandle(SvcEvent);
LocalFree(SecurityAttributes.lpSecurityDescriptor);
DeleteCriticalSection(&SvcInstanceLock); DeleteCriticalSection(&SvcInstanceLock);
return FspNtStatusFromWin32(LastError); return FspNtStatusFromWin32(LastError);

View File

@ -22,6 +22,7 @@
#include <shared/minimal.h> #include <shared/minimal.h>
#define PIPE_NAME "\\\\.\\pipe\\WinFsp.{14E7137D-22B4-437A-B0C1-D21D1BDF3767}" #define PIPE_NAME "\\\\.\\pipe\\WinFsp.{14E7137D-22B4-437A-B0C1-D21D1BDF3767}"
#define PIPE_SDDL "O:SYG:SYD:P(A;;GA;;;WD)"
#define PIPE_BUFFER_SIZE 2048 #define PIPE_BUFFER_SIZE 2048
#define PIPE_DEFAULT_TIMEOUT 3000 #define PIPE_DEFAULT_TIMEOUT 3000