Re: [PATCH] libpq: Add PQpassfileLookup()

From: Diego <mrstephenamell(at)gmail(dot)com>
To: Denis Smirnov <darthunix(at)gmail(dot)com>
Cc: Grigorev Jurij <ju(dot)grigorev(at)ftdata(dot)ru>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] libpq: Add PQpassfileLookup()
Date: 2026-09-18 17:38:31
Message-ID: 4e1abcc3-a231-450a-8170-765e53ebb8a3@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Denis,

Thank you, and thanks for the review that found the residue in the first
place.

> One separate note for future work: even after 0001, copies of the
> password can still remain in memory:

Agreed on all four, and I had noticed two of them while checking 0001: on
an allocation failure, enlargePQExpBuffer() ends up in
markPQExpBufferBroken(), which free()s the block still holding the partially
read line and sets maxlen to 0, so the explicit_bzero(buf.data, buf.maxlen)
further down becomes a no-op on the replacement buffer. I left it alone
because fixing it properly means touching pqexpbuffer.c, which is a
different patch and a different discussion.

The stdio buffer is the largest of the four by far, it can hold the whole
file, not just one line, and it is also the only one that is there on
every successful lookup rather than only on an error path. If nobody
objects I will look at that one separately once this is settled, probably
with setvbuf() on an owned buffer that can be cleared before fclose().

I'll leave those out of this thread so they do not hold up the API. Since
you and Yuriy are both happy with the series, I'll move the CF entry to
Ready for Committer.

Thanks,
Diego

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2026-09-18 17:40:00 Re: Introduce XID age based replication slot invalidation
Previous Message Nathan Bossart 2026-09-18 17:38:10 Re: Reject WAIT FOR earlier in transaction-snapshot mode