Re: Missing include <openssl/x509.h> in be-secure-openssl.c?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, 近藤雄太 <kondo(at)sraoss(dot)co(dot)jp>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, buildfarm(at)sraoss(dot)co(dot)jp
Subject: Re: Missing include <openssl/x509.h> in be-secure-openssl.c?
Date: 2021-11-04 13:54:07
Message-ID: 319425.1636034047@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> On Wed, Nov 03, 2021 at 11:45:26PM -0400, Tom Lane wrote:
>> Yeah, I noted the comment about WIN32_LEAN_AND_MEAN in the
>> stackoverflow thread too ... but as you say, it seems like
>> that should make the problem less probable not more so.
>> Still, it's hard to think of any other relevant change.

> Yeah, I don't see how this could be linked to WIN32_LEAN_AND_MEAN.

According to that stackoverflow thread, the unwanted #define of
X509_NAME comes from <wincrypt.h>, and WIN32_LEAN_AND_MEAN
prevents that from being immediately included by <windows.h>.

The rough idea I have is that prior to 8162464a2, we sucked in
that #define during postgres.h and then OpenSSL's headers were
able to undo it. After 8162464a2, we don't read <wincrypt.h>
during postgres.h, but some *other* header that be-secure-openssl.c
is including after the OpenSSL headers is pulling it in, so that
by the time we get to the body of the file the unwanted #define
is active.

I don't have either the resources or the interest to track down
exactly where that happens; my thought was just to make
be-secure-openssl.c's inclusions look more like fe-secure-openssl.c.
But, if you'd like to pursue the details, feel free.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-11-04 14:53:13 Re: Extending amcheck to check toast size and compression
Previous Message Hamlin, Garick L 2021-11-04 13:37:08 Re: pg14 psql broke \d datname.nspname.relname