Commit 75c35e0f authored by Tom Lane's avatar Tom Lane

Remove check on source address of a statistics packet. Check was broken

by recent IPv6 changes, and since it's redundant with a kernel-level check
anyway, it seems not worth trying to fix it.  Per recent discussions.
parent 4b407f6c
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* Copyright (c) 2001-2003, PostgreSQL Global Development Group * Copyright (c) 2001-2003, PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.43 2003/08/12 16:21:18 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.44 2003/09/07 14:44:40 tgl Exp $
* ---------- * ----------
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -1591,8 +1591,6 @@ pgstat_recvbuffer(void) ...@@ -1591,8 +1591,6 @@ pgstat_recvbuffer(void)
int msg_send = 0; /* next send index in buffer */ int msg_send = 0; /* next send index in buffer */
int msg_recv = 0; /* next receive index */ int msg_recv = 0; /* next receive index */
int msg_have = 0; /* number of bytes stored */ int msg_have = 0; /* number of bytes stored */
struct sockaddr_storage fromaddr;
int fromlen;
bool overflow = false; bool overflow = false;
/* /*
...@@ -1702,10 +1700,8 @@ pgstat_recvbuffer(void) ...@@ -1702,10 +1700,8 @@ pgstat_recvbuffer(void)
*/ */
if (FD_ISSET(pgStatSock, &rfds)) if (FD_ISSET(pgStatSock, &rfds))
{ {
fromlen = sizeof(fromaddr); len = recv(pgStatSock, (char *) &input_buffer,
len = recvfrom(pgStatSock, (char *) &input_buffer, sizeof(PgStat_Msg), 0);
sizeof(PgStat_Msg), 0,
(struct sockaddr *) &fromaddr, &fromlen);
if (len < 0) if (len < 0)
{ {
ereport(LOG, ereport(LOG,
...@@ -1726,16 +1722,6 @@ pgstat_recvbuffer(void) ...@@ -1726,16 +1722,6 @@ pgstat_recvbuffer(void)
if (input_buffer.msg_hdr.m_size != len) if (input_buffer.msg_hdr.m_size != len)
continue; continue;
/*
* The source address of the packet must be our own socket.
* This ensures that only real hackers or our own backends
* tell us something. (This should be redundant with a
* kernel-level check due to having used connect(), but let's
* do it anyway.)
*/
if (memcmp(&fromaddr, &pgStatAddr, fromlen))
continue;
/* /*
* O.K. - we accept this message. Copy it to the circular * O.K. - we accept this message. Copy it to the circular
* msgbuffer. * msgbuffer.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment