Raise fixed token-length limit in hba.c.
authorTom Lane <[email protected]>
Thu, 27 Jul 2023 16:07:48 +0000 (12:07 -0400)
committerTom Lane <[email protected]>
Thu, 27 Jul 2023 16:07:48 +0000 (12:07 -0400)
Historically, hba.c limited tokens in the authentication configuration
files (pg_hba.conf and pg_ident.conf) to less than 256 bytes.  We have
seen a few reports of this limit causing problems; notably, for
moderately-complex LDAP configurations.  Increase the limit to 10240
bytes as a low-risk stop-gap solution.

In v13 and earlier, this also requires raising MAX_LINE, the limit
on overall line length.  I'm hesitant to make this code consume
too much stack space, so I only raised that to 20480 bytes.

Discussion: https://postgr.es/m/1588937.1690221208@sss.pgh.pa.us

src/backend/libpq/hba.c

index d9a60843470acafc446e11bd57f913f8d07470e5..55dca8fc57d040f230b9419333a147e01860c8a4 100644 (file)
@@ -53,8 +53,8 @@
 #endif
 
 
-#define MAX_TOKEN  256
-#define MAX_LINE   8192
+#define MAX_TOKEN  10240
+#define MAX_LINE   20480
 
 /* callback data for check_network_callback */
 typedef struct check_network_data