Summary
The ident() function in src/backend/libpq/hba.c doesn't cope when postmaster is contacted on an IP alias. This patch fixes it. Malcolm Beattie
This commit is contained in:
parent
9b7c6ee00b
commit
772a596ed2
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.35 1998/09/01 04:28:48 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.36 1998/10/02 16:18:20 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -565,6 +565,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct sockaddr_in ident_server;
|
struct sockaddr_in ident_server;
|
||||||
|
struct sockaddr_in la;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Socket address of Ident server on the system from which client
|
* Socket address of Ident server on the system from which client
|
||||||
@ -573,8 +574,22 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
|
|||||||
ident_server.sin_family = AF_INET;
|
ident_server.sin_family = AF_INET;
|
||||||
ident_server.sin_port = htons(IDENT_PORT);
|
ident_server.sin_port = htons(IDENT_PORT);
|
||||||
ident_server.sin_addr = remote_ip_addr;
|
ident_server.sin_addr = remote_ip_addr;
|
||||||
rc = connect(sock_fd,
|
|
||||||
(struct sockaddr *) & ident_server, sizeof(ident_server));
|
/*
|
||||||
|
* Bind to the address which the client originally contacted,
|
||||||
|
* otherwise the ident server won't be able to match up the
|
||||||
|
* right connection. This is necessary if the PostgreSQL
|
||||||
|
* server is running on an IP alias.
|
||||||
|
*/
|
||||||
|
memset(&la, 0, sizeof(la));
|
||||||
|
la.sin_family = AF_INET;
|
||||||
|
la.sin_addr = local_ip_addr;
|
||||||
|
rc = bind(sock_fd, (struct sockaddr *) &la, sizeof(la));
|
||||||
|
if (rc == 0)
|
||||||
|
{
|
||||||
|
rc = connect(sock_fd,
|
||||||
|
(struct sockaddr *) & ident_server, sizeof(ident_server));
|
||||||
|
}
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
{
|
{
|
||||||
sprintf(PQerrormsg,
|
sprintf(PQerrormsg,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user