Skip to content

Commit 8b80c6b

Browse files
danielgustafssonCommitfest Bot
authored and
Commitfest Bot
committed
Move GSSAPI includes into its own header
Discussion: https://postgr.es/m/[email protected]
1 parent 2a0cd38 commit 8b80c6b

File tree

5 files changed

+46
-30
lines changed

5 files changed

+46
-30
lines changed

contrib/sslinfo/sslinfo.c

-11
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@
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-
3322
PG_MODULE_MAGIC;
3423

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

src/include/libpq/be-gssapi-common.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@
1616

1717
#ifdef ENABLE_GSS
1818

19-
#if defined(HAVE_GSSAPI_H)
20-
#include <gssapi.h>
21-
#include <gssapi_ext.h>
22-
#else
23-
#include <gssapi/gssapi.h>
24-
#include <gssapi/gssapi_ext.h>
25-
#endif
19+
#include "libpq/pg-gssapi.h"
2620

2721
extern void pg_GSS_error(const char *errmsg,
2822
OM_uint32 maj_stat, OM_uint32 min_stat);

src/include/libpq/libpq-be.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@
2828
#include <netinet/tcp.h>
2929

3030
#ifdef ENABLE_GSS
31-
#if defined(HAVE_GSSAPI_H)
32-
#include <gssapi.h>
33-
#else
34-
#include <gssapi/gssapi.h>
35-
#endif /* HAVE_GSSAPI_H */
31+
#include "libpq/pg-gssapi.h"
3632
#endif /* ENABLE_GSS */
3733

3834
#ifdef ENABLE_SSPI

src/include/libpq/pg-gssapi.h

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* pg-gssapi.h
4+
* Definitions for including GSSAPI headers
5+
*
6+
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7+
* Portions Copyright (c) 1994, Regents of the University of California
8+
*
9+
* src/include/libpq/pg-gssapi.h
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
14+
#ifndef PG_GSSAPI_H
15+
#define PG_GSSAPI_H
16+
17+
#ifdef ENABLE_GSS
18+
19+
/* IWYU pragma: begin_exports */
20+
#if defined(HAVE_GSSAPI_H)
21+
#include <gssapi.h>
22+
#include <gssapi_ext.h>
23+
#else
24+
#include <gssapi/gssapi.h>
25+
#include <gssapi/gssapi_ext.h>
26+
#endif
27+
/* IWYU pragma: end_exports */
28+
29+
/*
30+
* On Windows, <wincrypt.h> includes a #define for X509_NAME, which breaks our
31+
* ability to use OpenSSL's version of that symbol if <wincrypt.h> is pulled
32+
* in after <openssl/ssl.h> ... and, at least on some builds, it is. We
33+
* can't reliably fix that by re-ordering #includes, because libpq/libpq-be.h
34+
* #includes <openssl/ssl.h>. Instead, just zap the #define again here.
35+
*/
36+
#ifdef X509_NAME
37+
#undef X509_NAME
38+
#endif
39+
40+
#endif /* ENABLE_GSS */
41+
42+
#endif /* PG_GSSAPI_H */
43+

src/interfaces/libpq/libpq-int.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,9 @@
4444
#include "fe-auth-sasl.h"
4545
#include "pqexpbuffer.h"
4646

47-
/* IWYU pragma: begin_exports */
4847
#ifdef ENABLE_GSS
49-
#if defined(HAVE_GSSAPI_H)
50-
#include <gssapi.h>
51-
#else
52-
#include <gssapi/gssapi.h>
53-
#endif
48+
#include "libpq/pg-gssapi.h"
5449
#endif
55-
/* IWYU pragma: end_exports */
5650

5751
#ifdef ENABLE_SSPI
5852
#define SECURITY_WIN32

0 commit comments

Comments
 (0)