Re: passwords in pg_shadow (duplicate).

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(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 20:18:36
Message-ID: 200212052018.gB5KIab29557@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


You were looking at last night's patch. The one attached is the one
applied, and it addresses exactly the ugly issue you saw. It compares
to see if pgpass was reassigned with new memory, and frees only in that
case.

Also, in CVS HEAD, the variables are renamed client_pass and shadow_pass
so it is clear which is which.

---------------------------------------------------------------------------

Tom Lane wrote:
> 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
>

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-12-05 21:51:06 Re: Query breaking with unknown expression type (lost s
Previous Message Lamar Owen 2002-12-05 20:05:22 7.3-2 RPMset released.