pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Diego <mrstephenamell@gmail.com>
To: Denis Smirnov <darthunix@gmail.com>
Cc: Grigorev Jurij <ju.grigorev@ftdata.ru>
Cc: Jacob Champion <jacob.champion@enterprisedb.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: [PATCH] libpq: Add PQpassfileLookup()
Date: Fri, 18 Sep 2026 14:38:31 -0300
Message-ID: <4e1abcc3-a231-450a-8170-765e53ebb8a3@gmail.com> (raw)
In-Reply-To: <D0A27027-8848-42C8-BFDD-EE1FF193FCE5@gmail.com>
References: <b650e555-11c7-415d-8bda-c747c492ab4a@gmail.com>
	<56a73ea31de54ebea53877367cdd6abf@localhost.localdomain>
	<00e741a7-8dc1-4993-87f4-8976e9c3b6ba@gmail.com>
	<8b93e9c7642b47b49d5b287ed032b00a@localhost.localdomain>
	<D35D0ABB-755E-4EDE-B535-5C7578B3D3DC@gmail.com>
	<5b8e0436-853d-4b5e-8546-1862faf84cc6@gmail.com>
	<D0A27027-8848-42C8-BFDD-EE1FF193FCE5@gmail.com>

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






view thread (8+ messages)

Message-ID: <4e1abcc3-a231-450a-8170-765e53ebb8a3@gmail.com>
Permalink:  ../4e1abcc3-a231-450a-8170-765e53ebb8a3@gmail.com/
Also on:    postgresql.org/message-id/4e1abcc3-a231-450a-8170-765e53ebb8a3@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: mrstephenamell@gmail.com, darthunix@gmail.com, ju.grigorev@ftdata.ru, jacob.champion@enterprisedb.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: [PATCH] libpq: Add PQpassfileLookup()
  In-Reply-To: <4e1abcc3-a231-450a-8170-765e53ebb8a3@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox