Fix check for whether postmaster is running as a Windows service. REL9_4_STABLE
authorHeikki Linnakangas <[email protected]>
Mon, 26 Sep 2016 06:19:20 +0000 (09:19 +0300)
committerHeikki Linnakangas <[email protected]>
Mon, 26 Sep 2016 06:22:09 +0000 (09:22 +0300)
commitac30b004ca502d3ef0301de14783939650039488
tree623d118adaf0f704836169bac48505cc82552a7f
parent5d41f27a95878b0bb6ca7d737062424de0b20d8e
Fix check for whether postmaster is running as a Windows service.

If postmaster is launched with a restricted security token, with the
"Log in as Service" privilege explicitly removed, the token will contain
SECURITY_SERVICE_RID with the SE_GROUP_USE_FOR_DENY_ONLY flag, and without
the SE_GROUP_ENABLED flag. pgwin32_is_service() was fooled by that, and
thought that it's running as a service. Fix to check for the
SE_GROUP_ENABLED flag, like we do in pgwin32_is_admin().

Patch by Michael Paquier, per Breen Hagan's report and analysis. Backpatch
to all supported versions.

Bug: #13755
Discussion: <20151104062315[email protected]>
src/backend/port/win32/security.c