diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c new file mode 100644 index 2a46f7b..d5f15b0 *** a/src/backend/libpq/auth.c --- b/src/backend/libpq/auth.c *************** auth_peer(hbaPort *port) *** 1560,1567 **** char ident_user[IDENT_USERNAME_MAX + 1]; uid_t uid; gid_t gid; ! const char *user_name; ! char *errstr; errno = 0; if (getpeereid(port->sock, &uid, &gid) != 0) --- 1560,1566 ---- char ident_user[IDENT_USERNAME_MAX + 1]; uid_t uid; gid_t gid; ! struct passwd *pass; errno = 0; if (getpeereid(port->sock, &uid, &gid) != 0) *************** auth_peer(hbaPort *port) *** 1578,1592 **** return STATUS_ERROR; } ! user_name = get_user_name(&errstr); ! if (!user_name) { ! ereport(LOG, (errmsg_internal("%s", errstr))); ! pfree(errstr); return STATUS_ERROR; } ! strlcpy(ident_user, user_name, IDENT_USERNAME_MAX + 1); return check_usermap(port->hba->usermap, port->user_name, ident_user, false); } --- 1577,1593 ---- return STATUS_ERROR; } ! pass = getpwuid(uid); ! ! if (pass == NULL) { ! ereport(LOG, ! (errmsg("local user with ID %d does not exist", ! (int) uid))); return STATUS_ERROR; } ! strlcpy(ident_user, pass->pw_name, IDENT_USERNAME_MAX + 1); return check_usermap(port->hba->usermap, port->user_name, ident_user, false); }