summaryrefslogtreecommitdiff
path: root/src/common/username.c
diff options
context:
space:
mode:
authorTom Lane2014-03-28 14:30:37 +0000
committerTom Lane2014-03-28 14:30:37 +0000
commitb777be0d48a042f500cac72140ffb50392973aa2 (patch)
tree65f1f352d337bb95e761bbd5e07146d5d8af5b85 /src/common/username.c
parente5a452b3a4600dfc9c045e1591c25e6a567d8d73 (diff)
Un-break peer authentication.
Commit 613c6d26bd42dd8c2dd0664315be9551475b8864 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.
Diffstat (limited to 'src/common/username.c')
-rw-r--r--src/common/username.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/username.c b/src/common/username.c
index e946972a561..24c5b476278 100644
--- a/src/common/username.c
+++ b/src/common/username.c
@@ -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));