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

Andrew Chernow <ac@esilo.com>

From: Andrew Chernow <ac@esilo.com>
To: TAKATSUKA Haruka <harukat@sraoss.co.jp>
Cc: pgsql-bugs@postgresql.org
Date: 2009-06-23T15:01:42Z
Lists: pgsql-bugs

Attachments

> 
> 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/