OpenSSL conflicts with wincrypt.h
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t45496psql -h localhost -U postgresBuilt from patchset v1 (message #1), July 27, 2026 at 03:21 PM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t45496_1 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t45496_1 && git checkout t45496_1Patchset v1 (message #1) is on t45496_1
Hello,
When building Postgres using MSVC with Kerberos Version 4.1 and OpenSSL
1.1.1l (both of them, using only one will raise no errors), I see errors
like:
"C:\postgres\pgsql.sln" (default target) (1) ->
"C:\postgres\postgres.vcxproj" (default target) (2) ->
(ClCompile target) ->
C:\postgres\src\backend\libpq\be-secure-openssl.c(583,43): warning C4047:
'function': 'X509_NAME *' differs in levels of indirection from 'int'
[C:\postgres\pos
tgres.vcxproj]
"C:\postgres\pgsql.sln" (default target) (1) ->
"C:\postgres\postgres.vcxproj" (default target) (2) ->
(ClCompile target) ->
C:\postgres\src\backend\libpq\be-secure-openssl.c(74,35): error C2143:
syntax error: missing ')' before '(' [C:\postgres\postgres.vcxproj]
There is a comment in 'src/backend/libpq/be-secure-openssl.c' addressing
this issue, but I have to explicitly undefine X509_NAME. Please find
attached a patch for so.
Regards,
Juan José Santamaría Flecha
=?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= <juanjo.santamaria@gmail.com> writes:
There is a comment in 'src/backend/libpq/be-secure-openssl.c' addressing
this issue, but I have to explicitly undefine X509_NAME. Please find
attached a patch for so.
Um ... why? Shouldn't the #undef in the OpenSSL headers take care
of the problem?
regards, tom lane
On Fri, Feb 11, 2022 at 4:36 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
=?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= <
juanjo.santamaria@gmail.com> writes:There is a comment in 'src/backend/libpq/be-secure-openssl.c' addressing
this issue, but I have to explicitly undefine X509_NAME. Please find
attached a patch for so.Um ... why? Shouldn't the #undef in the OpenSSL headers take care
of the problem?After <openssl/ossl_typ.h> has been included, any inclusion of
<wincrypt.h> will be troublesome. There is already something similar in
'contrib/sslinfo/sslinfo.c'. This shouldn't be a problem while
defining WIN32_LEAN_AND_MEAN, but kerberos is directly including
<wincrypt.h> in <win-mac.h>.
Regards,
Juan José Santamaría Flecha
On 15 Feb 2022, at 14:12, Juan José Santamaría Flecha <juanjo.santamaria@gmail.com> wrote:
After <openssl/ossl_typ.h> has been included, any inclusion of <wincrypt.h> will be troublesome.
Not that it changes anything here, but FTR: in OpenSSL 3.0.0 and onwards this
undef has been moved to <openssl/types.h>
--
Daniel Gustafsson https://vmware.com/