Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 568620d

Browse files
committed
contrib/sslinfo needs a fix too to make hamerkop happy.
Re-ordering the #include's is a bit problematic here because libpq/libpq-be.h needs to include <openssl/ssl.h>. Instead, let's #undef the unwanted macro after all the #includes. This is definitely uglier than the other way, but it should work despite possible future header rearrangements. (A look at the openssl headers indicates that X509_NAME is the only conflicting symbol that we use.) In passing, remove a related but long-incorrect comment in pg_backup_archiver.h. Discussion: https://postgr.es/m/1051867.1635720347@sss.pgh.pa.us
1 parent 27ef132 commit 568620d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

contrib/sslinfo/sslinfo.c

+11
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
#include "miscadmin.h"
2020
#include "utils/builtins.h"
2121

22+
/*
23+
* On Windows, <wincrypt.h> includes a #define for X509_NAME, which breaks our
24+
* ability to use OpenSSL's version of that symbol if <wincrypt.h> is pulled
25+
* in after <openssl/ssl.h> ... and, at least on some builds, it is. We
26+
* can't reliably fix that by re-ordering #includes, because libpq/libpq-be.h
27+
* #includes <openssl/ssl.h>. Instead, just zap the #define again here.
28+
*/
29+
#ifdef X509_NAME
30+
#undef X509_NAME
31+
#endif
32+
2233
PG_MODULE_MAGIC;
2334

2435
static Datum X509_NAME_field_to_text(X509_NAME *name, text *fieldName);

src/bin/pg_dump/pg_backup_archiver.h

-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232

3333
#define LOBBUFSIZE 16384
3434

35-
/*
36-
* Note: zlib.h must be included *after* libpq-fe.h, because the latter may
37-
* include ssl.h, which has a naming conflict with zlib.h.
38-
*/
3935
#ifdef HAVE_LIBZ
4036
#include <zlib.h>
4137
#define GZCLOSE(fh) gzclose(fh)

0 commit comments

Comments
 (0)