agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: ssl: Replace deprecated API to get commonName
Date: Wed, 29 Jul 2026 19:27:35 +0000
Message-ID: <E1wp9wF-00000000qIu-1aKv@gemulon.postgresql.org> (raw)

ssl: Replace deprecated API to get commonName

X509_NAME_get_text_by_NID was deprecated in OpenSSL 4.0.0, and could
be removed in a future version of OpenSSL.  The replacement APIs are
available in all versions of OpenSSL and LibreSSL that we support so
we can easily change to make the code future proof.

The reason for the deprecation is that X509_NAME_get_text_by_NID can
only grab the first entry in a list, and doesn't handle multibyte
strings well.  The fix is to get the index of the name entry with
X509_NAME_get_index_by_NID and use X509_NAME_get_entry to extract
the data.

Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Tristan Partin <tristan@partin.io>
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Reviewed-by: Yilin Zhang <jiezhilove@126.com>
Discussion: https://postgr.es/m/68B9881D-DAA8-467D-A251-C96E98E57BA0@yesql.se

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/54dee94e6a71817877dfdeb2c2c811330e58e754

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)



Message-ID: <E1wp9wF-00000000qIu-1aKv@gemulon.postgresql.org>
Permalink:  ../E1wp9wF-00000000qIu-1aKv@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wp9wF-00000000qIu-1aKv@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: dgustafsson@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: ssl: Replace deprecated API to get commonName
  In-Reply-To: <E1wp9wF-00000000qIu-1aKv@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox