Stephane Bortzmeyer <bortzmeyer(at)nic(dot)fr> writes:
> The real issue is "Why PostgreSQL does not use getpwuid when
> getsockopt with SO_PEERCREED returns a numeric UID?"
Oh? I read in hba.c
if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 ||
so_len != sizeof(peercred))
{
/* We didn't get a valid credentials struct. */
ereport(LOG,
(errcode_for_socket_access(),
errmsg("could not get peer credentials: %m")));
return false;
}
pass = getpwuid(peercred.uid);
so it sure looks like we *are* using getpwuid.
regards, tom lane