Re: Re: BUG #13755: pgwin32_is_service not checking if SECURITY_SERVICE_SID is disabled

Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>

From: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
To: 'Michael Paquier' <michael.paquier@gmail.com>
Cc: MauMau <maumau307@gmail.com>, Breen Hagan <breen@rtda.com>, "Heikki Linnakangas" <hlinnaka@iki.fi>, Alvaro Herrera <alvherre@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2016-11-08T06:31:10Z
Lists: pgsql-bugs, pgsql-hackers
From: Michael Paquier [mailto:michael.paquier@gmail.com]
> I just looked more deeply at your refactoring patch, and I didn't know about
> CheckTokenMembership()... The whole logic of your patch depends on it.
> That's quite a cleanup that you have here. It looks that the former
> implementation just had no knowledge of this routine or it would just have
> been used.

Yes, Microsoft recommends GetTokenMembership() because it's simpler.


> +    if (IsAdministrators || IsPowerUsers)
> +        return 1;
> +    else
> +        return 0;
> I would remove the else here.

IIRC, I sometimes saw this style of code in PostgreSQL (or in psqlODBC possibly...)  I'd like to leave the style choice to the committer.

Regards
Takayuki Tsunakawa


Commits

  1. Fix and simplify check for whether we're running as Windows service.