On Thu, Jun 8, 2017 at 1:36 AM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
While testing libpq and GSS the other day, I was surprised by the behavior of the host and hostaddr libpq options, if you specify a list of hostnames.
I did this this, and it took me quite a while to figure out what was going on:
$ psql "dbname=postgres hostaddr=::1 host=localhost,localhost user=krbtestuser" -c "SELECT 'hello'" psql: GSSAPI continuation error: Unspecified GSS failure. Minor code may provide more information GSSAPI continuation error: Server postgres/localhost,localhost@PG.EXAMPLE not found in Kerberos database
That was a pilot error; I specified a list of hostnames, but only one hostaddr. But I would've expected to get a more helpful error, pointing that out.
Some thoughts on this:
1. You cannot actually specify a list of hostaddrs. Trying to do so gives error:
psql: could not translate host name "::1,::1" to address: Name or service not known
That error message is a bit inaccurate, in that it wasn't really a "host name" that it tried to translate, but a raw address in string format. That's even more confusing if you make the mistake that you specify "hostaddr=localhost":
Your commit to fix this part, 76b11e8a43eca4612d, is giving me compiler warnings:
fe-connect.c: In function 'connectDBStart':
fe-connect.c:1625: warning: 'ret' may be used uninitialized in this function
gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)