pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix handling of escape sequences in postgres_fdw.application_nam
Date: Tue, 21 Feb 2023 11:02:41 +0000
Message-ID: <E1pUQPx-002Fyz-9A@gemulon.postgresql.org> (raw)

Fix handling of escape sequences in postgres_fdw.application_name

postgres_fdw.application_name relies on MyProcPort to define the data
that should be added to escape sequences %u (user name) or %d (database
name).  However this code could be run in processes that lack a
MyProcPort, like an autovacuum process, causing crashes.

The code generating the application name is made more flexible with this
commit, so as it now generates no data for %u and %d if MyProcPort is
missing, and a simple "unknown" if MyProcPort exists, but the expected
fields are not set.

Reported-by: Alexander Lakhin
Author: Kyotaro Horiguchi, Michael Paquier
Reviewed-by: Hayato Kuroda, Masahiko Sawada
Discussion: https://postgr.es/m/17789-8b31c5a4672b74d9@postgresql.org
Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5bace41abc317ae8ecf3397e9e92f3b0e5444c69

Modified Files
--------------
contrib/postgres_fdw/option.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)



view thread (2+ messages)

Message-ID: <E1pUQPx-002Fyz-9A@gemulon.postgresql.org>
Permalink:  ../E1pUQPx-002Fyz-9A@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pUQPx-002Fyz-9A@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Fix handling of escape sequences in postgres_fdw.application_nam
  In-Reply-To: <E1pUQPx-002Fyz-9A@gemulon.postgresql.org>
  References: <E1pUQPx-002Fyz-9A@gemulon.postgresql.org>

* 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