Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uI88D-00GI9m-VU for pgsql-bugs@arkaria.postgresql.org; Thu, 22 May 2025 15:46:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uI88C-004Wq5-JY for pgsql-bugs@arkaria.postgresql.org; Thu, 22 May 2025 15:46:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uI88C-004Wpx-Al for pgsql-bugs@lists.postgresql.org; Thu, 22 May 2025 15:46:52 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uI889-000Mmz-1j for pgsql-bugs@lists.postgresql.org; Thu, 22 May 2025 15:46:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 54MFkkij1529315; Thu, 22 May 2025 11:46:46 -0400 From: Tom Lane To: Chris Gooch cc: pgsql-bugs@lists.postgresql.org Subject: Re: GSS Auth issue when user member of lots of AD groups In-reply-to: References: Comments: In-reply-to Chris Gooch message dated "Thu, 22 May 2025 14:55:39 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1529313.1747928806.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 22 May 2025 11:46:46 -0400 Message-ID: <1529314.1747928806@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk [ pgsql-committers is completely inappropriate, redirecting to -bugs ] Chris Gooch writes: > GSS authentication is working for users with small number of AD > groups but getting below error when a user has larger number of > groups. I believe it might to token size related, but they don't > have issues when authenticating with Kerberos/GSS to other > applications, only with Postgres. > failed: GSSAPI context establishment error: The routine must be called a= gain to complete its function: Unknown error Hmm. That must be coming from this bit in libpq: /* Must have output.length > 0 */ if (output.length > PQ_GSS_SEND_BUFFER_SIZE - sizeof(uint32)) { pg_GSS_error(libpq_gettext("GSSAPI context establishment error"), conn, major, minor); gss_release_buffer(&minor, &output); return PGRES_POLLING_FAILED; } which makes it look like gss_init_sec_context wants us to send a packet larger than PQ_GSS_SEND_BUFFER_SIZE, which perhaps is a plausible thing to happen if the user belongs to enough groups. Unfortunately, elsewhere in the same file: * NOTE: The client and server have to agree on the max packet size, * because we have to pass an entire packet to GSSAPI at a time and we * don't want the other side to send arbitrarily huge packets as we * would have to allocate memory for them to then pass them to GSSAPI. * * Therefore, these two #define's are effectively part of the protocol * spec and can't ever be changed. */ #define PQ_GSS_SEND_BUFFER_SIZE 16384 #define PQ_GSS_RECV_BUFFER_SIZE 16384 Not sure where to go from here. Unfortunately the person who was mostly responsible for this code has left the project... regards, tom lane