Re: [PATCH] libpq: Add PQpassfileLookup()

From: Diego <mrstephenamell(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Denis Smirnov <darthunix(at)gmail(dot)com>, Grigorev Jurij <ju(dot)grigorev(at)ftdata(dot)ru>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Subject: Re: [PATCH] libpq: Add PQpassfileLookup()
Date: 2026-11-27 12:54:42
Message-ID: 1b4042b9-2e80-4a16-ae99-abef0bf50c41@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks Michael.

The simpler comment is fine with me, feel free to change it when
committing, or I can send a v4-0001 with it.

On 2026-11-27 02:57, Michael Paquier wrote:
> On Thu, Nov 26, 2026 at 08:48:01AM -0800, Diego wrote:
>> v3 [1] is two patches:
>>
>> - 0001 fixes a gap in how libpq clears a password read from the
>> password file. passwordFromFile() does strdup() on the rest of the
>> line and then de-escapes the password in place, so the tail of an
>> escaped password, and any fields after it, are left in the
>> allocation past the terminator, out of reach of the
>> explicit_bzero(p, strlen(p)) in pqReleaseConnHosts(). It is +21/-9
>> in fe-connect.c and does not depend on the new API.
>
> Hmm, yeah, I guess that you are right here and that this leaks useless
> data in the stack. One could argue about a backpatch but this is
> close to explicit_bzero() in spirit even, so let's do so as an
> improvement. I don't see a point in complicating the comment the way
> you are suggesting: this explains a non-consequence. Or just simplify
> the comment to a simpler "De-escape the buffer, before copying it into
> the result.".
>
> I am not planning to spend cycles on your 0002, though. (Perhaps
> others will be interested in that.)
>
>> Is there anything I can do to make this easier to pick up? If the API
>> needs more discussion, 0001 can go in on its own, and I can move it to
>> a separate thread if that helps.
>
> One suggestion: you could help other people. If you are using some
> AI-generated content, which I think is at least partially the case, a
> second suggestion is to slow down with the noise and the quantity of
> text in your messages or patches.
>
>> Michael, I added you in Cc because you reworked the error handling in
>> passwordFromFile() last year (861af926103).
>
> For a completely unrelated thing. But thanks anyway. :)
> --
> Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-11-27 12:55:51 Re: Preserve conflict log table during upgrade
Previous Message Amit Kapila 2026-11-27 12:42:55 Re: unidirectional logical replication logging issue