]> granicus.if.org Git - pgbouncer/commitdiff
When 'database' is missing or empty in startup packet, fallback to 'user'
authorMarko Kreen <markokr@gmail.com>
Wed, 8 Dec 2010 15:30:45 +0000 (17:30 +0200)
committerMarko Kreen <markokr@gmail.com>
Wed, 8 Dec 2010 15:30:45 +0000 (17:30 +0200)
src/client.c

index fe1ac430584c235c3e83325717be198832eb2335..b05fc51fd81417812070ef128ceac02025c8536d 100644 (file)
@@ -130,14 +130,14 @@ static bool decide_startup_pool(PgSocket *client, PktHdr *pkt)
                        return false;
                }
        }
-       if (!username) {
+       if (!username || !username[0]) {
                disconnect_client(client, true, "No username supplied");
                return false;
        }
-       if (!dbname) {
-               disconnect_client(client, true, "No database supplied");
-               return false;
-       }
+
+       /* if missing dbname, default to username */
+       if (!dbname || !dbname[0])
+               dbname = username;
 
        /* check if limit allows, dont limit admin db
           nb: new incoming conn will be attached to PgSocket, thus