Re: passwords in pg_shadow (duplicate).

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, Terry Yapt <pgsql(at)technovell(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: passwords in pg_shadow (duplicate).
Date: 2002-12-05 19:50:22
Message-ID: 204.1039117822@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Good catch. Seems like a bug. I assumed we still want to support
> 'password' even though pg_shadow contains MD5 encrypted passwords. Is
> that correct? (We can't support crypt in those cases.)

I think we should fix this for 7.3.1.

> if (port->auth_method == uaMD5)
> pfree(crypt_pwd);
> + if (port->auth_method != uaMD5 && port->auth_method != uaCrypt &&
> + isMD5(passwd))
> + pfree((char *)pgpass);

This part of your patch seems awfully fragile though. Better style
would be to add a boolean:

bool free_pgpass = false;

...
{
palloc pgpass here;
free_pgpass = true;
}

if (free_pgpass)
free(pg_pass);

This is less fragile and easily extends to more cases that palloc
pg_pass in future.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lamar Owen 2002-12-05 20:05:22 7.3-2 RPMset released.
Previous Message Jean-Luc Lachance 2002-12-05 19:38:13 Order of execution of Constraints, Triggers and Rules