From 6d16f9debae0a09a7db91d7f204bda043d04792c Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Wed, 23 Oct 2024 16:10:27 +0200 Subject: Make SASL max message length configurable The proposed OAUTHBEARER SASL mechanism will need to allow larger messages in the exchange, since tokens are sent directly by the client. Move this limit into the pg_be_sasl_mech struct so that it can be changed per-mechanism. Author: Jacob Champion Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CAOYmi+nqX_5=Se0W0Ynrr55Fha3CMzwv_R9P3rkpHb=1kG7ZTQ@mail.gmail.com --- src/backend/libpq/auth-sasl.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/backend/libpq/auth-sasl.c') diff --git a/src/backend/libpq/auth-sasl.c b/src/backend/libpq/auth-sasl.c index 08b24d90b4b..4039e7fa3e9 100644 --- a/src/backend/libpq/auth-sasl.c +++ b/src/backend/libpq/auth-sasl.c @@ -20,14 +20,6 @@ #include "libpq/pqformat.h" #include "libpq/sasl.h" -/* - * Maximum accepted size of SASL messages. - * - * The messages that the server or libpq generate are much smaller than this, - * but have some headroom. - */ -#define PG_MAX_SASL_MESSAGE_LENGTH 1024 - /* * Perform a SASL exchange with a libpq client, using a specific mechanism * implementation. @@ -103,7 +95,7 @@ CheckSASLAuth(const pg_be_sasl_mech *mech, Port *port, char *shadow_pass, /* Get the actual SASL message */ initStringInfo(&buf); - if (pq_getmessage(&buf, PG_MAX_SASL_MESSAGE_LENGTH)) + if (pq_getmessage(&buf, mech->max_message_length)) { /* EOF - pq_getmessage already logged error */ pfree(buf.data); -- cgit v1.2.3