Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5 passwords - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5 passwords
Date
Msg-id 200405061749.i46HntP24072@candle.pha.pa.us
Whole thread Raw
In response to Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5 passwords  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5 passwords
Next
From: Bruce Momjian
Date:
Subject: Re: win32: whitespace in dir names, shmem bug