static int
auth_peer(hbaPort *port)
{
- int sock = port->sock;
char ident_user[IDENT_USERNAME_MAX + 1];
#if defined(HAVE_GETPEEREID)
struct passwd *pass;
errno = 0;
- if (getpeereid(sock, &uid, &gid) != 0)
+ if (getpeereid(port->sock, &uid, &gid) != 0)
{
/* We didn't get a valid credentials struct. */
ereport(LOG,
struct passwd *pass;
errno = 0;
- if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 ||
+ if (getsockopt(port->sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 ||
so_len != sizeof(peercred))
{
/* We didn't get a valid credentials struct. */
ucred_t *ucred;
ucred = NULL; /* must be initialized to NULL */
- if (getpeerucred(sock, &ucred) == -1)
+ if (getpeerucred(port->sock, &ucred) == -1)
{
ereport(LOG,
(errcode_for_socket_access(),
iov.iov_base = &buf;
iov.iov_len = 1;
- if (recvmsg(sock, &msg, 0) < 0 ||
+ if (recvmsg(port->sock, &msg, 0) < 0 ||
cmsg->cmsg_len < sizeof(cmsgmem) ||
cmsg->cmsg_type != SCM_CREDS)
{