1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Un-break peer authentication.

Commit 613c6d26bd sloppily replaced a
lookup of the UID obtained from getpeereid() with a lookup of the
server's own user name, thus totally destroying peer authentication.
Revert.  Per report from Christoph Berg.

In passing, make sure get_user_name() zeroes *errstr on success on
Windows as well as non-Windows.  I don't think any callers actually
depend on this ATM, but we should be consistent across platforms.
This commit is contained in:
Tom Lane
2014-03-28 10:30:37 -04:00
parent e5a452b3a4
commit b777be0d48
2 changed files with 10 additions and 8 deletions

View File

@ -54,6 +54,8 @@ get_user_name(char **errstr)
static char username[256 + 1];
DWORD len = sizeof(username) - 1;
*errstr = NULL;
if (!GetUserName(username, &len))
{
*errstr = psprintf(_("user name lookup failure: %s"), strerror(errno));