1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Copy SSL GUCs into the hosts context

When the SSL configuration from postgresql.conf is used, the default
host entry stored pointers to the relevant GUC variables.  These
pointers are not guaranteed to survive a failed configuration reload
so copy the values into the hosts memory context.

Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Rui Zhao <zhaorui126@gmail.com>
Discussion: https://postgr.es/m/A1745424-7110-41E9-B98C-3CED1A034A8F@yesql.se
Backpatch-through: 19
This commit is contained in:
Daniel Gustafsson
2026-10-06 13:28:00 +02:00
parent ff684b6be2
commit fd7e11b92b

View File

@@ -346,10 +346,14 @@ be_tls_init(bool isServerStart)
Assert(ssl_sni == false);
#endif
pgconf->ssl_cert = ssl_cert_file;
pgconf->ssl_key = ssl_key_file;
pgconf->ssl_ca = ssl_ca_file;
pgconf->ssl_passphrase_cmd = ssl_passphrase_command;
/*
* Copy the configuration from the GUC variables since they aren't
* guaranteed to survive a failed reload.
*/
pgconf->ssl_cert = pstrdup(ssl_cert_file);
pgconf->ssl_key = pstrdup(ssl_key_file);
pgconf->ssl_ca = pstrdup(ssl_ca_file);
pgconf->ssl_passphrase_cmd = pstrdup(ssl_passphrase_command);
pgconf->ssl_passphrase_reload = ssl_passphrase_command_supports_reload;
if (!init_host_context(pgconf, isServerStart, &hasWarned))