Thread: pg_hba.conf editor is buggy

pg_hba.conf editor is buggy

From
damien clochard
Date:
hi guys,

Last month during a PG training, i found a very bad behaviour from
pgadmin. Here's the step to follow :

0- backup your pg_hba.conf
1- launch pgadmin
2- edit the pg_hba.conf
3- Add a new line with an error inside the CIDR address.  For example : host all all 10.224.24.26 trust
4- save
5- close pgadmin
6- now if you edit pg_hba.conf with a generic text editor  the line you've added will appear.
7- launch pgadmin again
8- edit pg_hba.conf
9- your line doesn't appear
10- you need to modify pg_ba.conf with a text editor or restore your backup

As you may have noticed, between step 4 and step 10 you'll be unable to
start PostgreSQL because the pg_hba.conf has a syntax error.

I can't describe how much this is confusing for newbies : they write a
pg_hba rule that seems correct (they just wrote an IP Address instead of
a CIDR ) and then they restart PG to test it... Now the server won't
start and if they restart pgAdmin, then the faulty line is hidden !

What's even more confusing is the dialog window that adds a new line....
There's a field for each part of the pg_hba line. But when it comes to
the CIDR Address the field label is "IP Address" instead of "CIDR
Address" or "IP Address + Netmask"

At the very least, i think the behaviour should coherent. Either pgadmin
accepts faulty lines then it must be able to display them, or
Pgadmin refuses to write a faulty line in the pg_hba.conf and in that
case it's ok hide them...

I think the best behaviour would be :
 a/ pgadmin refuses to write a faulty line b/ pgadmin display faulty lines **in red** (if any)

...which is basically the opposite to what pgAdmin is doing now... :)


Here's more detail :
   * Platform : Windows XP and Linux   * Language : French   * Distribution : EDB installer / Ubuntu package / Source
*Version : 1.10.5 and 1.12.2   * nothing in pgadmin.log
 

--
damien clochard
dalibo.com



Re: pg_hba.conf editor is buggy

From
Guillaume Lelarge
Date:
Le 06/01/2011 22:33, damien clochard a écrit :
> hi guys,
> 
> Last month during a PG training, i found a very bad behaviour from
> pgadmin. Here's the step to follow :
> 
> 0- backup your pg_hba.conf
> 1- launch pgadmin
> 2- edit the pg_hba.conf
> 3- Add a new line with an error inside the CIDR address.
>    For example : host all all 10.224.24.26 trust
> 4- save
> 5- close pgadmin
> 6- now if you edit pg_hba.conf with a generic text editor
>    the line you've added will appear.
> 7- launch pgadmin again
> 8- edit pg_hba.conf
> 9- your line doesn't appear
> 10- you need to modify pg_ba.conf with a text editor or restore your backup
> 
> As you may have noticed, between step 4 and step 10 you'll be unable to
> start PostgreSQL because the pg_hba.conf has a syntax error.
> 
> I can't describe how much this is confusing for newbies : they write a
> pg_hba rule that seems correct (they just wrote an IP Address instead of
> a CIDR ) and then they restart PG to test it... Now the server won't
> start and if they restart pgAdmin, then the faulty line is hidden !
> 
> What's even more confusing is the dialog window that adds a new line....
> There's a field for each part of the pg_hba line. But when it comes to
> the CIDR Address the field label is "IP Address" instead of "CIDR
> Address" or "IP Address + Netmask"
> 
> At the very least, i think the behaviour should coherent. Either pgadmin
> accepts faulty lines then it must be able to display them, or
> Pgadmin refuses to write a faulty line in the pg_hba.conf and in that
> case it's ok hide them...
> 
> I think the best behaviour would be :
> 
>   a/ pgadmin refuses to write a faulty line
>   b/ pgadmin display faulty lines **in red** (if any)
> 
> ...which is basically the opposite to what pgAdmin is doing now... :)
> 
> 
> Here's more detail :
> 
>     * Platform : Windows XP and Linux
>     * Language : French
>     * Distribution : EDB installer / Ubuntu package / Source
>     * Version : 1.10.5 and 1.12.2
>     * nothing in pgadmin.log
> 

I added a ticket (http://code.pgadmin.org/trac/ticket/298). It's not a
part of the code I know much, but I'll try to see what I can do about it.


-- 
Guillaumehttp://www.postgresql.frhttp://dalibo.com