]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Replace hardcoded mentions of pg_hosts.conf with GUC
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Tue, 7 Jul 2026 15:39:28 +0000 (17:39 +0200)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Tue, 7 Jul 2026 15:39:28 +0000 (17:39 +0200)
Three error messages were using the default file name pg_hosts.conf
and not the variable backing the GUC, which would make logging be
confusing for users who have renamed the file using the GUC.  Fix
by consistently using the HostsFileName variable.

Backpatch down to v19 where serverside SNI was introduced.

Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Surya Poondla <suryapoondla4@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAN4CZFMARYjQfgyRaCKOXDO=Q91kuKn=pSC02DAOOr23ojhEGQ@mail.gmail.com
Backpatch-through: 19

src/backend/libpq/be-secure-openssl.c

index 7890e6c2de292d80c6bf41b8c5c77274f6644d84..4ce2a92b9649be6c6cc4780cdb367d77bafca4b4 100644 (file)
@@ -228,7 +228,7 @@ be_tls_init(bool isServerStart)
                {
                        ereport(isServerStart ? FATAL : LOG,
                                        errcode(ERRCODE_CONFIG_FILE_ERROR),
-                                       errmsg("could not load \"%s\": %s", "pg_hosts.conf",
+                                       errmsg("could not load \"%s\": %s", HostsFileName,
                                                   err_msg ? err_msg : "unknown error"));
                        goto error;
                }
@@ -365,7 +365,7 @@ be_tls_init(bool isServerStart)
                                errmsg("no SSL configurations loaded"),
                /*- translator: The two %s contain filenames */
                                errhint("If ssl_sni is enabled then add configuration to \"%s\", else \"%s\"",
-                                               "pg_hosts.conf", "postgresql.conf"));
+                                               HostsFileName, "postgresql.conf"));
                goto error;
        }
 
@@ -644,7 +644,7 @@ init_host_context(HostsLine *host, bool isServerStart)
                                                        "Set \"%s\" to \"off\" to make use of the hook "
                                                        "that is currently installed, or remove the hook "
                                                        "and use per-host passphrase commands in \"%s\".",
-                                                       "ssl_sni", "pg_hosts.conf"));
+                                                       "ssl_sni", HostsFileName));
                        init_warned = true;
                }