Re: GetTokenInformation() and FreeSid() at port/exec.c

From: Andrew Chernow <ac(at)esilo(dot)com>
To: TAKATSUKA Haruka <harukat(at)sraoss(dot)co(dot)jp>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: GetTokenInformation() and FreeSid() at port/exec.c
Date: 2009-06-23 15:01:42
Message-ID: 4A40EE56.6000703@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>
> DWORD len = GetLengthSid(pTokenUser->User.Sid)
> *ppSidUser = (PSID) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
> CopySid(len, *ppSidUser, pTokenUser->User.Sid);
>

I attached a patch for this. Although, I did not use CopySid. Instead,
I changed GetUserSid to GetTokenUser. AddUserToDacl() is the only
function making use of GetUserSid(), so this change won't break
anything. The benefit to this approach over my first suggestion is that
it avoids an unneeded HeapAlloc(sid), CopySid(sid) ... and its cleaner.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

Attachment Content-Type Size
freesid.patch text/x-patch 7.0 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Armin Jenewein 2009-06-23 15:06:15 BUG #4875: /etc/init.d/postgresql status shows postmaster is stopped when executed as user
Previous Message Magnus Hagander 2009-06-23 14:58:01 Re: GetTokenInformation() and FreeSid() at port/exec.c