Check that SID is enabled while checking for Windows admin privileges.
authorTom Lane <[email protected]>
Fri, 10 Feb 2006 21:52:43 +0000 (21:52 +0000)
committerTom Lane <[email protected]>
Fri, 10 Feb 2006 21:52:43 +0000 (21:52 +0000)
Magnus

src/backend/port/win32/security.c

index 9283f3f6942041f74709315798ff667fd1d35dc8..7a68a33a7f24638126851c93496828e4b489f4b2 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/port/win32/security.c,v 1.8 2004/12/31 22:00:37 pgsql Exp $
+ *   $PostgreSQL: pgsql/src/backend/port/win32/security.c,v 1.8.4.1 2006/02/10 21:52:43 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -78,8 +78,8 @@ pgwin32_is_admin(void)
 
    for (x = 0; x < Groups->GroupCount; x++)
    {
-       if (EqualSid(AdministratorsSid, Groups->Groups[x].Sid) ||
-           EqualSid(PowerUsersSid, Groups->Groups[x].Sid))
+       if ((EqualSid(AdministratorsSid, Groups->Groups[x].Sid) && (Groups->Groups[x].Attributes & SE_GROUP_ENABLED)) ||
+           (EqualSid(PowerUsersSid, Groups->Groups[x].Sid) && (Groups->Groups[x].Attributes & SE_GROUP_ENABLED)))
        {
            success = TRUE;
            break;