Skip to content

Commit 3b7c5aa

Browse files
committed
Fix some unprotected references to AF_UNIX ... wouldn't compile on
platforms without AF_UNIX sockets.
1 parent e490ee8 commit 3b7c5aa

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/backend/libpq/hba.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.108 2003/07/26 13:50:02 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.109 2003/08/01 23:24:28 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -585,14 +585,13 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p)
585585
if (*error_p)
586586
goto hba_syntax;
587587

588-
/*
589-
* Disallow auth methods that always need AF_INET sockets to work.
590-
*/
588+
/* Disallow auth methods that always need TCP/IP sockets to work */
591589
if (port->auth_method == uaKrb4 ||
592590
port->auth_method == uaKrb5)
593591
goto hba_syntax;
594592

595-
if (port->raddr.addr.ss_family != AF_UNIX)
593+
/* Does not match if connection isn't AF_UNIX */
594+
if (!IS_AF_UNIX(port->raddr.addr.ss_family))
596595
return;
597596
}
598597
else if (strcmp(token, "host") == 0
@@ -1348,6 +1347,8 @@ ident_inet(const SockAddr remote_addr,
13481347
* Returns either true and the username put into "ident_user",
13491348
* or false if we were unable to determine the username.
13501349
*/
1350+
#ifdef HAVE_UNIX_SOCKETS
1351+
13511352
static bool
13521353
ident_unix(int sock, char *ident_user)
13531354
{
@@ -1491,6 +1492,7 @@ ident_unix(int sock, char *ident_user)
14911492
#endif
14921493
}
14931494

1495+
#endif /* HAVE_UNIX_SOCKETS */
14941496

14951497

14961498
/*
@@ -1515,10 +1517,14 @@ authident(hbaPort *port)
15151517
if (!ident_inet(port->raddr, port->laddr, ident_user))
15161518
return STATUS_ERROR;
15171519
break;
1520+
1521+
#ifdef HAVE_UNIX_SOCKETS
15181522
case AF_UNIX:
15191523
if (!ident_unix(port->sock, ident_user))
15201524
return STATUS_ERROR;
15211525
break;
1526+
#endif
1527+
15221528
default:
15231529
return STATUS_ERROR;
15241530
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy