libpq: Fix SNI host handling
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 8 Jun 2021 13:37:54 +0000 (15:37 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 8 Jun 2021 14:01:05 +0000 (16:01 +0200)
commit37e1cce4ddf0be362e3093cee55493aee41bc423
tree1a012dc0d87164fd45faf5fbd0f2f8caff6b957b
parenteab81953682d5087295afb911c93f36cb1533bd9
libpq: Fix SNI host handling

Fix handling of NULL host name (possibly by using hostaddr).  It
previously crashed.  Also, we should look at connhost, not pghost, to
handle multi-host specifications.

Also remove an unnecessary SSL_CTX_free().

Reported-by: Jacob Champion <pchampion@vmware.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/504c276ab6eee000bb23d571ea9b0ced4250774e.camel@vmware.com
src/interfaces/libpq/fe-secure-openssl.c