summaryrefslogtreecommitdiff
path: root/src/include/libpq/sasl.h
diff options
context:
space:
mode:
authorDaniel Gustafsson2024-10-23 14:10:27 +0000
committerDaniel Gustafsson2024-10-23 14:10:27 +0000
commit6d16f9debae0a09a7db91d7f204bda043d04792c (patch)
treecd956bb5b9cd0c447da688e7f35fa09fb366feac /src/include/libpq/sasl.h
parent17b4aa77c3a161a9d0e7b08bd9931fe9fd051540 (diff)
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 <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Discussion: https://postgr.es/m/CAOYmi+nqX_5=Se0W0Ynrr55Fha3CMzwv_R9P3rkpHb=1kG7ZTQ@mail.gmail.com
Diffstat (limited to 'src/include/libpq/sasl.h')
-rw-r--r--src/include/libpq/sasl.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/include/libpq/sasl.h b/src/include/libpq/sasl.h
index 7a1f970ccae..0e8fa848304 100644
--- a/src/include/libpq/sasl.h
+++ b/src/include/libpq/sasl.h
@@ -27,7 +27,15 @@
#define PG_SASL_EXCHANGE_FAILURE 2
/*
- * Backend SASL mechanism callbacks.
+ * 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
+
+/*
+ * Backend SASL mechanism callbacks and metadata.
*
* To implement a backend mechanism, declare a pg_be_sasl_mech struct with
* appropriate callback implementations. Then pass the mechanism to
@@ -127,6 +135,9 @@ typedef struct pg_be_sasl_mech
const char *input, int inputlen,
char **output, int *outputlen,
const char **logdetail);
+
+ /* The maximum size allowed for client SASLResponses. */
+ int max_message_length;
} pg_be_sasl_mech;
/* Common implementation for auth.c */