Fix some unprotected references to AF_UNIX ... wouldn't compile on

platforms without AF_UNIX sockets.
This commit is contained in:
Tom Lane 2003-08-01 23:24:28 +00:00
parent e490ee80e6
commit 3b7c5aa548
1 changed files with 11 additions and 5 deletions

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.108 2003/07/26 13:50:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.109 2003/08/01 23:24:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -585,14 +585,13 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p)
if (*error_p) if (*error_p)
goto hba_syntax; goto hba_syntax;
/* /* Disallow auth methods that always need TCP/IP sockets to work */
* Disallow auth methods that always need AF_INET sockets to work.
*/
if (port->auth_method == uaKrb4 || if (port->auth_method == uaKrb4 ||
port->auth_method == uaKrb5) port->auth_method == uaKrb5)
goto hba_syntax; goto hba_syntax;
if (port->raddr.addr.ss_family != AF_UNIX) /* Does not match if connection isn't AF_UNIX */
if (!IS_AF_UNIX(port->raddr.addr.ss_family))
return; return;
} }
else if (strcmp(token, "host") == 0 else if (strcmp(token, "host") == 0
@ -1348,6 +1347,8 @@ ident_inet_done:
* Returns either true and the username put into "ident_user", * Returns either true and the username put into "ident_user",
* or false if we were unable to determine the username. * or false if we were unable to determine the username.
*/ */
#ifdef HAVE_UNIX_SOCKETS
static bool static bool
ident_unix(int sock, char *ident_user) ident_unix(int sock, char *ident_user)
{ {
@ -1491,6 +1492,7 @@ ident_unix(int sock, char *ident_user)
#endif #endif
} }
#endif /* HAVE_UNIX_SOCKETS */
/* /*
@ -1515,10 +1517,14 @@ authident(hbaPort *port)
if (!ident_inet(port->raddr, port->laddr, ident_user)) if (!ident_inet(port->raddr, port->laddr, ident_user))
return STATUS_ERROR; return STATUS_ERROR;
break; break;
#ifdef HAVE_UNIX_SOCKETS
case AF_UNIX: case AF_UNIX:
if (!ident_unix(port->sock, ident_user)) if (!ident_unix(port->sock, ident_user))
return STATUS_ERROR; return STATUS_ERROR;
break; break;
#endif
default: default:
return STATUS_ERROR; return STATUS_ERROR;
} }