diff options
| author | Magnus Hagander | 2009-11-14 15:39:45 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2009-11-14 15:39:45 +0000 |
| commit | 8467f3c5a1bdf94e25129b9aa33bcfcb96b76937 (patch) | |
| tree | 197bcd5d1930813ca5a393d1c5c9e2fda1049736 /src/bin | |
| parent | 30137bde6db48a8b8c1ffc736eb239bd7381f04d (diff) | |
Add inheritable ACE when creating a restricted token for execution on
Win32.
Also refactor the code around it to be more clear.
Jesse Morris
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/initdb/initdb.c | 10 | ||||
| -rw-r--r-- | src/bin/pg_ctl/pg_ctl.c | 9 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 3fc9b3880ef..fa14161551f 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -42,7 +42,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * Portions taken from FreeBSD. * - * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.172 2009/06/11 14:49:07 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.172.2.1 2009/11/14 15:39:45 mha Exp $ * *------------------------------------------------------------------------- */ @@ -2393,6 +2393,10 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo) return 0; } +#ifndef __CYGWIN__ + AddUserToTokenDacl(restrictedToken); +#endif + if (!CreateProcessAsUser(restrictedToken, NULL, cmd, @@ -2410,10 +2414,6 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo) return 0; } -#ifndef __CYGWIN__ - AddUserToDacl(processInfo->hProcess); -#endif - return ResumeThread(processInfo->hThread); } #endif diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 7a7d03e8f69..e80031fba97 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -4,7 +4,7 @@ * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.111.2.1 2009/09/02 02:40:59 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.111.2.2 2009/11/14 15:39:45 mha Exp $ * *------------------------------------------------------------------------- */ @@ -1390,6 +1390,10 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser return 0; } +#ifndef __CYGWIN__ + AddUserToTokenDacl(restrictedToken); +#endif + r = CreateProcessAsUser(restrictedToken, NULL, cmd, NULL, NULL, TRUE, CREATE_SUSPENDED, NULL, NULL, &si, processInfo); Kernel32Handle = LoadLibrary("KERNEL32.DLL"); @@ -1488,9 +1492,6 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser } } -#ifndef __CYGWIN__ - AddUserToDacl(processInfo->hProcess); -#endif CloseHandle(restrictedToken); |
