Re: Silent failure with invalid hba_file setting

From: Thom Brown <thom(at)linux(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Silent failure with invalid hba_file setting
Date: 2011-10-18 23:15:16
Message-ID: CAA-aLv59ugbU6Xbn47FHAgo2R+uEorPB4AGhmcHDwLcu8M7MOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19 October 2011 00:38, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Thom Brown <thom(at)linux(dot)com> writes:
>> I noticed that if the hba_file setting in the config is uncommented
>> and set to a directory instead of the full path to the file, no error
>> occurs when the service starts.
>
> When I try that, I get a boatload of errors ending with
> FATAL:  could not load pg_hba.conf
>
> I suspect what happened to you is that the directory read like an empty
> file, so Postgres didn't see any error condition.  I suppose we could
> add an fstat test to see if we'd opened something other than a regular
> file, but I'm not terribly excited about it.
>
>> The problem with this is you cannot get into the database as it acts
>> as if it did find the hba file but found it empty.
>
> Well, an actually empty pg_hba.conf file would have the same problem,
> and it's pretty hard to see any situation where it would be useful to
> start the postmaster and not let it accept any connections.  Should we
> add a check to consider it an error if the file doesn't contain at least
> one HBA record?

That would solve both problems, so +1 for that.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-10-19 01:59:17 Re: termination of backend waiting for sync rep generates a junk log message
Previous Message Tom Lane 2011-10-18 22:38:03 Re: Silent failure with invalid hba_file setting