]> granicus.if.org Git - pgbouncer/commitdiff
Recognize GSSENCRequest packet
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 16 Aug 2019 10:56:50 +0000 (12:56 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Sat, 17 Aug 2019 18:31:07 +0000 (20:31 +0200)
This is a new startup packet type introduced in PostgreSQL 12.  In
PgBouncer, we'll for now reject GSS encryption attempts.

Without this, PgBouncer would reject such connections with "bad packet
header" errors, requiring the client to reconnect before being able to
do the normal startup.

include/bouncer.h
src/client.c
src/proto.c

index d52d397ef709589dd30842b013ec3a2dde13e6a3..6485fef0da56a4f682e6dfdedd53b9bf29065e90 100644 (file)
@@ -149,6 +149,7 @@ extern int cf_sbuf_len;
 #define PKT_STARTUP     0x30000
 #define PKT_CANCEL      80877102
 #define PKT_SSLREQ      80877103
+#define PKT_GSSENCREQ   80877104
 
 #define POOL_SESSION   0
 #define POOL_TX                1
index 80cbcb6973a8cbd349b2fd60c7dd9800fb2b0e06..fe1ef63e37de6e1d116865abfaf7174369b1be91 100644 (file)
@@ -558,6 +558,14 @@ static bool handle_client_startup(PgSocket *client, PktHdr *pkt)
                        return false;
                }
                break;
+       case PKT_GSSENCREQ:
+               /* reject GSS encryption attempt */
+               slog_noise(client, "C: req GCC enc");
+               if (!sbuf_answer(&client->sbuf, "N", 1)) {
+                       disconnect_client(client, false, "failed to nak GSS enc");
+                       return false;
+               }
+               break;
        case PKT_STARTUP_V2:
                disconnect_client(client, true, "old V2 protocol not supported");
                return false;
index 2f4eba3e0c0807cc78b35a2409cf7738c5378da3..17ffdc8b4b68e2f8de93c77b8065d13141511a36 100644 (file)
@@ -75,6 +75,8 @@ bool get_header(struct MBuf *data, PktHdr *pkt)
                        type = PKT_CANCEL;
                } else if (code == PKT_SSLREQ) {
                        type = PKT_SSLREQ;
+               } else if (code == PKT_GSSENCREQ) {
+                       type = PKT_GSSENCREQ;
                } else if ((code >> 16) == 3 && (code & 0xFFFF) < 2) {
                        type = PKT_STARTUP;
                } else if (code == PKT_STARTUP_V2) {