]> granicus.if.org Git - pgbouncer/commitdiff
Explicitly detect V2 protocol request and close it with proper msg.
authorMarko Kreen <markokr@gmail.com>
Wed, 14 Apr 2010 08:09:47 +0000 (08:09 +0000)
committerMarko Kreen <markokr@gmail.com>
Wed, 14 Apr 2010 08:09:47 +0000 (08:09 +0000)
include/bouncer.h
src/client.c
src/proto.c

index fdeaa1188111f4f18c7dd9cbe51c885f132660f9..44a5123be51ad9d7dac8480cf29aec75d0b7f33f 100644 (file)
@@ -104,6 +104,7 @@ extern int cf_sbuf_len;
 #define AUTH_CREDS     6
 
 /* type codes for weird pkts */
+#define PKT_STARTUP_V2  0x20000
 #define PKT_STARTUP     0x30000
 #define PKT_CANCEL      80877102
 #define PKT_SSLREQ      80877103
index 613aa54b12dcd37d17e0d81df396e9a9ca00292d..28d77aa7b2da23f60313a2290f1b0caa4871fda9 100644 (file)
@@ -220,6 +220,9 @@ static bool handle_client_startup(PgSocket *client, PktHdr *pkt)
                        return false;
                }
                break;
+       case PKT_STARTUP_V2:
+               disconnect_client(client, true, "Old V2 protocol not supported");
+               return false;
        case PKT_STARTUP:
                if (client->pool) {
                        disconnect_client(client, true, "client re-sent startup pkt");
index 409e036f56a4acf4f8c75a5e6f63a829793fd05f..2c18c803d4610fd3223ae8d3a8e812999093d867 100644 (file)
@@ -65,6 +65,8 @@ bool get_header(MBuf *data, PktHdr *pkt)
                        type = PKT_SSLREQ;
                else if ((code >> 16) == 3 && (code & 0xFFFF) < 2)
                        type = PKT_STARTUP;
+               else if (code == PKT_STARTUP_V2)
+                       type = PKT_STARTUP_V2;
                else {
                        log_noise("get_header: unknown special pkt: len=%u code=%u", len, code);
                        return false;