Re: [PATCH] libpq: Add PQpassfileLookup() - Mailing list pgsql-hackers

From Diego
Subject Re: [PATCH] libpq: Add PQpassfileLookup()
Date
Msg-id 4e1abcc3-a231-450a-8170-765e53ebb8a3@gmail.com
Whole thread
In response to Re: [PATCH] libpq: Add PQpassfileLookup()  (Denis Smirnov <darthunix@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Reject WAIT FOR earlier in transaction-snapshot mode
Next
From: Bharath Rupireddy
Date:
Subject: Re: Introduce XID age based replication slot invalidation