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

Commit 092b785

Browse files
committed
Simplify code related to compilation of SSL and OpenSSL
This commit makes more generic some comments and code related to the compilation with OpenSSL and SSL in general to ease the addition of more SSL implementations in the future. In libpq, some OpenSSL-only code is moved under USE_OPENSSL and not USE_SSL. While on it, make a comment more consistent in libpq-fe.h. Author: Daniel Gustafsson Discussion: https://postgr.es/m/5382CB4A-9CF3-4145-BA46-C802615935E0@yesql.se
1 parent bd12080 commit 092b785

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

src/backend/libpq/hba.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ parse_hba_line(TokenizedLine *tok_line, int elevel)
10411041
ereport(elevel,
10421042
(errcode(ERRCODE_CONFIG_FILE_ERROR),
10431043
errmsg("hostssl record cannot match because SSL is not supported by this build"),
1044-
errhint("Compile with --with-ssl=openssl to use SSL connections."),
1044+
errhint("Compile with --with-ssl to use SSL connections."),
10451045
errcontext("line %d of configuration file \"%s\"",
10461046
line_num, HbaFileName)));
10471047
*err_msg = "hostssl record cannot match because SSL is not supported by this build";

src/include/libpq/libpq-be.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ typedef struct Port
194194

195195
/*
196196
* OpenSSL structures. (Keep these last so that the locations of other
197-
* fields are the same whether or not you build with OpenSSL.)
197+
* fields are the same whether or not you build with SSL enabled.)
198198
*/
199199
#ifdef USE_OPENSSL
200200
SSL *ssl;

src/include/pg_config_manual.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@
176176

177177
/*
178178
* USE_SSL code should be compiled only when compiling with an SSL
179-
* implementation. (Currently, only OpenSSL is supported, but we might add
180-
* more implementations in the future.)
179+
* implementation.
181180
*/
182181
#ifdef USE_OPENSSL
183182
#define USE_SSL

src/interfaces/libpq/fe-secure.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,13 @@ PQsslAttributeNames(PGconn *conn)
421421

422422
return result;
423423
}
424+
#endif /* USE_SSL */
425+
426+
/*
427+
* Dummy versions of OpenSSL key password hook functions, when built without
428+
* OpenSSL.
429+
*/
430+
#ifndef USE_OPENSSL
424431

425432
PQsslKeyPassHook_OpenSSL_type
426433
PQgetSSLKeyPassHook_OpenSSL(void)
@@ -439,7 +446,7 @@ PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn)
439446
{
440447
return 0;
441448
}
442-
#endif /* USE_SSL */
449+
#endif /* USE_OPENSSL */
443450

444451
/* Dummy version of GSSAPI information functions, when built without GSS support */
445452
#ifndef ENABLE_GSS

src/interfaces/libpq/libpq-fe.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ extern int pg_valid_server_encoding_id(int encoding);
619619

620620
/* === in fe-secure-openssl.c === */
621621

622-
/* Support for overriding sslpassword handling with a callback. */
622+
/* Support for overriding sslpassword handling with a callback */
623623
typedef int (*PQsslKeyPassHook_OpenSSL_type) (char *buf, int size, PGconn *conn);
624624
extern PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void);
625625
extern void PQsetSSLKeyPassHook_OpenSSL(PQsslKeyPassHook_OpenSSL_type hook);

0 commit comments

Comments
 (0)