Fix passing username to the server.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 15 Jan 2015 16:41:01 +0000 (18:41 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 15 Jan 2015 16:42:59 +0000 (18:42 +0200)
In commit e85fbb2, as part of removing non-libpq code, I removed the code
that determined the username of the currently logged-in user, and send it
to the server during authentication. However, I accidentally also removed
the code that passed any explicitly-given username to the server. Oops.

connection.c

index be1037ecbeb7352a46943f25e637746948653724..312232ed35461d5daf589c84e41c1488e9fbcfdb 100644 (file)
@@ -941,6 +941,10 @@ static int protocol3_opts_array(ConnectionClass *self, const char *opts[], const
    {
        opts[cnt] = "dbname";   vals[cnt++] = ci->database;
    }
+   if (ci->username[0])
+   {
+       opts[cnt] = "user";     vals[cnt++] = ci->username;
+   }
 
    switch (ci->sslmode[0])
    {