Skip to content

Commit a9cedc9

Browse files
committed
Drop getnullacl
1 parent 4cdbf73 commit a9cedc9

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ For a full list of changes, see the [git commit log][log]
99
## v1.0.5
1010

1111
* In development
12+
* Improve release creation procedure
13+
* Drop NULL DACL and use default security descriptor associated with the access token of the calling process
1214

1315
## v1.0.4
1416

svcbatch.c

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -777,40 +777,21 @@ static void reportsvcstatus(DWORD status, DWORD param)
777777
LeaveCriticalSection(&servicelock);
778778
}
779779

780-
static PSECURITY_ATTRIBUTES getnullacl(void)
781-
{
782-
static BYTE sb[BBUFSIZ];
783-
static SECURITY_ATTRIBUTES sa;
784-
static PSECURITY_DESCRIPTOR sd = NULL;
785-
786-
if (sd == NULL) {
787-
sd = (PSECURITY_DESCRIPTOR)sb;
788-
if (!InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION) ||
789-
!SetSecurityDescriptorDacl(sd, TRUE, (PACL)NULL, FALSE)) {
790-
sd = NULL;
791-
return NULL;
792-
}
793-
}
794-
sa.nLength = DSIZEOF(SECURITY_ATTRIBUTES);
795-
sa.lpSecurityDescriptor = sd;
796-
sa.bInheritHandle = TRUE;
797-
return &sa;
798-
}
799-
800780
static DWORD createiopipes(LPSTARTUPINFOW si)
801781
{
802-
LPSECURITY_ATTRIBUTES sa;
782+
SECURITY_ATTRIBUTES sa;
803783
DWORD rc = 0;
804784
HANDLE sh = NULL;
805785
HANDLE cp = GetCurrentProcess();
806786

807-
if ((sa = getnullacl()) == NULL)
808-
return svcsyserror(__LINE__, ERROR_ACCESS_DENIED, L"SetSecurityDescriptorDacl");
787+
sa.nLength = DSIZEOF(SECURITY_ATTRIBUTES);
788+
sa.lpSecurityDescriptor = NULL;
789+
sa.bInheritHandle = TRUE;
809790
/**
810791
* Create stdin pipe, with write side
811792
* of the pipe as non inheritable.
812793
*/
813-
if (!CreatePipe(&(si->hStdInput), &sh, sa, 0))
794+
if (!CreatePipe(&(si->hStdInput), &sh, &sa, 0))
814795
return svcsyserror(__LINE__, GetLastError(), L"CreatePipe");
815796
if (!DuplicateHandle(cp, sh, cp,
816797
&inputpipewrs, FALSE, 0,
@@ -824,7 +805,7 @@ static DWORD createiopipes(LPSTARTUPINFOW si)
824805
* Create stdout/stderr pipe, with read side
825806
* of the pipe as non inheritable
826807
*/
827-
if (!CreatePipe(&sh, &(si->hStdError), sa, 0))
808+
if (!CreatePipe(&sh, &(si->hStdError), &sa, 0))
828809
return svcsyserror(__LINE__, GetLastError(), L"CreatePipe");
829810
if (!DuplicateHandle(cp, sh, cp,
830811
&outputpiperd, FALSE, 0,

0 commit comments

Comments
 (0)