Skip site navigation (1) Skip section navigation (2)

Re: Invalid pg_hba.conf => Postgres crash

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Invalid pg_hba.conf => Postgres crash
Date: 2004-04-24 20:13:19
Message-ID: 13531.1082837599@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Gaetano Mendola <mendola(at)bigfoot(dot)com> writes:
>   host   all    all    127.0.0.1    trust   sameuser     # HANG
> the future connections will hang leaving a postgres process
> running
> - Inserting the following line instead will crash postgres
>   host  all     127.0.0.1             trust   sameuser        # CRASH

I was able to reproduce the crash but not the hang.  Would you see if
the attached patch fixes both symptoms on your machine?

			regards, tom lane

Index: ip.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/libpq/ip.c,v
retrieving revision 1.23
diff -c -r1.23 ip.c
*** ip.c	12 Sep 2003 20:18:51 -0000	1.23
--- ip.c	24 Apr 2004 20:09:21 -0000
***************
*** 67,74 ****
   */
  int
  getaddrinfo_all(const char *hostname, const char *servname,
! 				const struct addrinfo * hintp, struct addrinfo ** result)
  {
  #ifdef HAVE_UNIX_SOCKETS
  	if (hintp != NULL && hintp->ai_family == AF_UNIX)
  		return getaddrinfo_unix(servname, hintp, result);
--- 67,77 ----
   */
  int
  getaddrinfo_all(const char *hostname, const char *servname,
! 				const struct addrinfo *hintp, struct addrinfo **result)
  {
+ 	/* not all versions of getaddrinfo() zero *result on failure */
+ 	*result = NULL;
+ 
  #ifdef HAVE_UNIX_SOCKETS
  	if (hintp != NULL && hintp->ai_family == AF_UNIX)
  		return getaddrinfo_unix(servname, hintp, result);

In response to

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2004-04-24 21:31:26
Subject: Re: Current CVS tip segfaulting
Previous:From: Jordan HendersonDate: 2004-04-24 19:05:06
Subject: Re: [HACKERS] What can we learn from MySQL?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group