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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5 passwords
Date: 2004-04-27 02:16:19
Message-ID: 200404270216.i3R2GJ114665@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

PostgreSQL Bugs List wrote:
>
> The following bug has been logged online:
>
> Bug reference: 1134
> Logged by: Fabien COELHO
>
> Email address: coelho(at)cri(dot)ensmp(dot)fr
>
> PostgreSQL version: 7.5 Dev
>
> Operating system: any
>
> Description: ALTER USER ... RENAME breaks md5 passwords
>
> Details:
>
> If you rename a user with a md5 password, the
> password is broken. md5 passwords are the default,
> so it means that renaming a user with a password
> does not work by default.
>
> This is because the username is used implicitly as salt. This was a bad idea
> (tm).
>
> Fixing this has implications on the client/server
> protocol for md5 authentication. If you're going
> to fix it some day, consider also adding more
> characters to the server nonce used in the protocol.

Yes, the problem is that we used the username for the salt, just like
FreeBSD does for its MD5 passwords. Of course, you can't rename unix
users, while PostgreSQL allows user renaming.

The attached patch clears the password field on rename:

test=> CREATE USER pass password 'aa';
CREATE USER
test=> ALTER USER pass RENAME TO pass2;
NOTICE: password cleared because OF USER RENAME
ALTER USER
test=> ALTER USER pass2 RENAME TO pass3;
ALTER USER

and adds documention explaining this behavior. I can't think of a
better solution.

--
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

Attachment Content-Type Size
unknown_filename text/plain 4.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Fabien COELHO 2004-04-27 07:37:50 Re: [BUGS] BUG #1134: ALTER USER ... RENAME breaks md5
Previous Message Joel Garry 2004-04-26 22:45:08 Re: How configure Oracle 9i not case sensitive...

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-04-27 03:06:21 Re: FW: Timezone library
Previous Message Bruce Momjian 2004-04-26 17:42:24 Re: build annoyences