Skip to content

Commit e21d6f2

Browse files
Move PG_MAX_AUTH_TOKEN_LENGTH to libpq/auth.h
Future SASL mechanism, like OAUTHBEARER, will use this as a limit on token messages coming from the client, so promote it to the header file to make it available. This patch is extracted from a larger body of work aimed at adding support for OAUTHBEARER in libpq. Author: Jacob Champion <jacob.champion@enterprisedb.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://postgr.es/m/CAOYmi+kJqzo6XsR9TEhvVfeVNQ-TyFM5LATypm9yoQVYk=4Wrw@mail.gmail.com
1 parent 59d6c03 commit e21d6f2

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/backend/libpq/auth.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,6 @@ static int CheckRADIUSAuth(Port *port);
201201
static int PerformRadiusTransaction(const char *server, const char *secret, const char *portstr, const char *identifier, const char *user_name, const char *passwd);
202202

203203

204-
/*
205-
* Maximum accepted size of GSS and SSPI authentication tokens.
206-
* We also use this as a limit on ordinary password packet lengths.
207-
*
208-
* Kerberos tickets are usually quite small, but the TGTs issued by Windows
209-
* domain controllers include an authorization field known as the Privilege
210-
* Attribute Certificate (PAC), which contains the user's Windows permissions
211-
* (group memberships etc.). The PAC is copied into all tickets obtained on
212-
* the basis of this TGT (even those issued by Unix realms which the Windows
213-
* realm trusts), and can be several kB in size. The maximum token size
214-
* accepted by Windows systems is determined by the MaxAuthToken Windows
215-
* registry setting. Microsoft recommends that it is not set higher than
216-
* 65535 bytes, so that seems like a reasonable limit for us as well.
217-
*/
218-
#define PG_MAX_AUTH_TOKEN_LENGTH 65535
219-
220204
/*----------------------------------------------------------------
221205
* Global authentication functions
222206
*----------------------------------------------------------------

src/include/libpq/auth.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@
1616

1717
#include "libpq/libpq-be.h"
1818

19+
/*
20+
* Maximum accepted size of GSS and SSPI authentication tokens.
21+
* We also use this as a limit on ordinary password packet lengths.
22+
*
23+
* Kerberos tickets are usually quite small, but the TGTs issued by Windows
24+
* domain controllers include an authorization field known as the Privilege
25+
* Attribute Certificate (PAC), which contains the user's Windows permissions
26+
* (group memberships etc.). The PAC is copied into all tickets obtained on
27+
* the basis of this TGT (even those issued by Unix realms which the Windows
28+
* realm trusts), and can be several kB in size. The maximum token size
29+
* accepted by Windows systems is determined by the MaxAuthToken Windows
30+
* registry setting. Microsoft recommends that it is not set higher than
31+
* 65535 bytes, so that seems like a reasonable limit for us as well.
32+
*/
33+
#define PG_MAX_AUTH_TOKEN_LENGTH 65535
34+
1935
extern PGDLLIMPORT char *pg_krb_server_keyfile;
2036
extern PGDLLIMPORT bool pg_krb_caseins_users;
2137
extern PGDLLIMPORT bool pg_gss_accept_delegation;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy