Re: [BUGS] BUG #5957: createdb with description and md5 auth forces to provide password twice

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Grzegorz Szpetkowski <gszpetkowski(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [BUGS] BUG #5957: createdb with description and md5 auth forces to provide password twice
Date: 2011-05-05 21:08:02
Message-ID: 201105052108.p45L82w27520@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Grzegorz Szpetkowski wrote:
>
> The following bug has been logged online:
>
> Bug reference: 5957
> Logged by: Grzegorz Szpetkowski
> Email address: gszpetkowski(at)gmail(dot)com
> PostgreSQL version: 9.0.3
> Operating system: Ubuntu 10.10
> Description: createdb with description and md5 auth forces to provide
> password twice
> Details:
>
> How to reproduce the problem:
>
> 1.Create new role with (encrypted password):
> createuser -SdRP user
> 2.In PostgreSQL 9.0.3 I found pg_hba.conf with local all all ident, so
> change to local all all md5
> 3.Restart/Reload used cluster
> 4.Execute createdb -U user mydb "My DB Description"
>
> Output:
>
> Password:
> Password:
>
> creatdb command prompts password twice and I think it's improper behaviour
> (and documentation is silent about that).

Interesting. This is happening because we are connecting to one
database to create the new database, and then connecting to the new
database to add the comment.

Prior to PG 8.2, this was necessary to put the comment on the database,
but now that we have the shared comment/description table
pg_shdescription, this is not necessary.

Do we need createdb to be able to create databases for pre-8.2 clusters?
If not, the attached patch fixes the double-prompting.

Also, why is this code used to create the new database?

conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres",
host, port, username, prompt_password, progname);

Do we assume more users can connect to the 'postgres' database, but we
want 'postgres' to connect to 'template1' in case it wants to drop the
'postgres' database? Whatever the purpose, this code certainly needs a
comment.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

Attachment Content-Type Size
/pgpatches/createdb text/x-diff 813 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-05-05 21:29:47 Re: Adding a user without expiration date using pgAdmin III causes postgresql Beta1 to crash
Previous Message Leon Widdershoven 2011-05-05 19:21:53 Adding a user without expiration date using pgAdmin III causes postgresql Beta1 to crash

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-05-05 21:22:33 Re: Process wakeups when idle and power consumption
Previous Message Robert Haas 2011-05-05 20:56:08 Re: Process wakeups when idle and power consumption