GetCurrentThreadId(), pipe_uuid_str);
RpcStringFree(&pipe_uuid_str);
+ /* make a security descriptor for the named pipe with access
+ * restricted to the user and SYSTEM
+ */
+
+ SECURITY_ATTRIBUTES sa;
+ PSECURITY_DESCRIPTOR pSD = NULL;
+ LPCWSTR szSDDL = L"D:(A;;GA;;;SY)(A;;GA;;;OW)";
+ if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(
+ szSDDL, SDDL_REVISION_1, &pSD, NULL))
+ {
+ ReturnLastError(pipe, L"ConvertSDDL");
+ goto out;
+ }
+ sa.nLength = sizeof(sa);
+ sa.lpSecurityDescriptor = pSD;
+ sa.bInheritHandle = FALSE;
+
ovpn_pipe = CreateNamedPipe(
ovpn_pipe_name, PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED,
- PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, 1, 128, 128, 0, NULL);
+ PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, 1, 128, 128, 0, &sa);
if (ovpn_pipe == INVALID_HANDLE_VALUE)
{
ReturnLastError(pipe, L"CreateNamedPipe");