summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-auth.c
diff options
context:
space:
mode:
authorTom Lane2018-08-03 16:12:10 +0000
committerTom Lane2018-08-03 16:12:10 +0000
commit24986c95520e0761dbb3551196fda2305228557c (patch)
tree7ea78f1bc1aecb60029bb05e0e38e154e99a41e9 /src/interfaces/libpq/fe-auth.c
parent85c9d3475e4f680dbca7c04fe096af018f3b8760 (diff)
Change libpq's internal uses of PQhost() to inspect host field directly.
Commit 1944cdc98 changed PQhost() to return the hostaddr value when that is specified and host isn't. This is a good idea in general, but fe-auth.c and related files contain PQhost() calls for which it isn't. Specifically, when we compare SSL certificates or other server identity information to the host field, we do not want to use hostaddr instead; that's not what's documented, that's not what happened pre-v10, and it doesn't seem like a good idea. Instead, we can just look at connhost[].host directly. This does what we want in v10 and up; in particular, if neither host nor hostaddr were given, the host field will be replaced with the default host name. That seems useful, and it's likely the reason that these places were coded to call PQhost() originally (since pre-v10, the stored field was not replaced with the default). Back-patch to v10, as 1944cdc98 (just) was. Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/interfaces/libpq/fe-auth.c')
-rw-r--r--src/interfaces/libpq/fe-auth.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index 3b2073a47fe..09012c562d0 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -199,7 +199,7 @@ pg_GSS_startup(PGconn *conn, int payloadlen)
min_stat;
int maxlen;
gss_buffer_desc temp_gbuf;
- char *host = PQhost(conn);
+ char *host = conn->connhost[conn->whichhost].host;
if (!(host && host[0] != '\0'))
{
@@ -414,7 +414,7 @@ pg_SSPI_startup(PGconn *conn, int use_negotiate, int payloadlen)
{
SECURITY_STATUS r;
TimeStamp expire;
- char *host = PQhost(conn);
+ char *host = conn->connhost[conn->whichhost].host;
if (conn->sspictx)
{