Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5 passwords

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Subject: Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5 passwords
Date: 2004-05-06 17:49:55
Message-ID: 200405061749.i46HntP24072@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > The attached patch clears the password field on rename:
> >
> > I think you should clear the password field *only* if it's
> > MD5-encrypted.
>
> Patch attached and applied.

Oh, I forgot to display the new behavior:

test=> CREATE USER test;
CREATE USER
test=> ALTER USER test RENAME TO test2;
ALTER USER
test=> ALTER USER test2 UNENCRYPTED PASSWORD 'x';
ALTER USER
test=> ALTER USER test2 RENAME TO test4;
ALTER USER
test=> ALTER USER test4 PASSWORD 'x';
ALTER USER
test=> ALTER USER test4 RENAME TO test8;
NOTICE: MD5 password cleared because of user rename
ALTER USER
test=> SELECT * FROM pg_shadow WHERE usename = 'test8';
usename | usesysid | usecreatedb | usesuper | usecatupd | passwd |
valuntil | useconfig
---------+----------+-------------+----------+-----------+--------+----------+-----------

test8 | 100 | f | f | f | |
|
(1 row)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PostgreSQL Bugs List 2004-05-06 21:10:04 BUG #1148: server restarts depending on stats options
Previous Message Bruce Momjian 2004-05-06 16:59:44 Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5 passwords

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-05-06 19:23:26 Re: win32: whitespace in dir names, shmem bug
Previous Message Bruce Momjian 2004-05-06 16:59:44 Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5 passwords