1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +03:00

Properly close token in sspi authentication

We can never leak more than one token, but we shouldn't do that. We
don't bother closing it in the error paths since the process will
exit shortly anyway.

Christian Ullrich
This commit is contained in:
Magnus Hagander
2016-01-14 13:06:03 +01:00
parent c42df2d46c
commit 3276ca303d

View File

@ -1253,6 +1253,8 @@ pg_SSPI_recvauth(Port *port)
(errmsg_internal("could not get user token: error code %lu", (errmsg_internal("could not get user token: error code %lu",
GetLastError()))); GetLastError())));
CloseHandle(token);
if (!LookupAccountSid(NULL, tokenuser->User.Sid, accountname, &accountnamesize, if (!LookupAccountSid(NULL, tokenuser->User.Sid, accountname, &accountnamesize,
domainname, &domainnamesize, &accountnameuse)) domainname, &domainnamesize, &accountnameuse))
ereport(ERROR, ereport(ERROR,