Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pkyu4-0005H2-Bh for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Apr 2023 03:06:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pkyu3-0005bp-8c for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Apr 2023 03:06:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pkyu2-0005Wq-FW for pgsql-hackers@lists.postgresql.org; Sat, 08 Apr 2023 03:06:10 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pkytx-00042y-7z for pgsql-hackers@lists.postgresql.org; Sat, 08 Apr 2023 03:06:09 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 228A45F7B6; Fri, 7 Apr 2023 23:06:00 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=snowman.net; s=dkim; t=1680923160; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xkE9tAJZopqkuPDOzGjbf4OlH9pxGYlaeYGhFpBbK+8=; b=uwG+mRkl0mqRpLNy056Z1aScCLmeD6P02ElbQrHD3BgRjB+qHE+MFnq9gORyCohYt9b1/W F5jZfy3kHUFea/nF9Y0LJTHvj5K0Zwxa2cYPjAywe8CRe+5rIcmpJ3AQ0QMR90QV7Q6xMd /MsNV0oeM+7XeNVptaLru4DzOIWp3I0= Date: Fri, 7 Apr 2023 23:06:00 -0400 From: Stephen Frost To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: longfin missing gssapi_ext.h Message-ID: References: <3282942.1680920692@sss.pgh.pa.us> <3284314.1680921096@sss.pgh.pa.us> <3286097.1680922218@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cHt4NTrwTCx2y7xi" Content-Disposition: inline In-Reply-To: <3286097.1680922218@sss.pgh.pa.us> User-Agent: Mutt/2.1.4 (2021-12-11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --cHt4NTrwTCx2y7xi Content-Type: multipart/mixed; boundary="JfexJRnHb/wD0d28" Content-Disposition: inline --JfexJRnHb/wD0d28 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Tom Lane (tgl@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > Looks like buildfarm animal hake, at least, has a version recent enough > > to have gssapi_ext.h ... but still older than 1.11 and therefore > > doesn't have the type gss_key_value_element_desc defined, so maybe the > > check for gss_store_cred_into would be better? >=20 > Well, now we're getting into value judgements about which gssapi > versions are still worth supporting. Are you really willing to toss > overboard all versions that don't support gss_store_cred_into? Or > should credential delegation be viewed as an incremental feature that > we can support or not? I'm open to considering support for older versions, however ... > TBH, committing things with significant portability hazards ten hours > before feature freeze is not high on my list of good development > practices. but as pointed out, these APIs are all over a decade old and systems which don't support them have a pretty high risk of having security issues due to shipping these out-dated libraries. I agree it's a value judgement and something to consider but I don't see Apple changing their mind any time soon on actually updating the Kerberos version they ship and no one should really be using what they do ship. The same is true for any other system that's shipping a version of a core security library that's not been updated in over a decade. We are currently requiring at least OpenSSL 1.0.1 which was released in 2012. Having a similar requirement for MIT Kerberos, for our release of PG in 2023, doesn't strike me as unreasonable. Attached is a more fully-formed patch with a regenerated configure that adds in a check for gssapi_ext.h and updates the function check to look for gss_store_cred_into(). Thanks! Stephen --JfexJRnHb/wD0d28 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="check_gssapi_ext.h_v2.patch" Content-Transfer-Encoding: quoted-printable diff --git a/configure b/configure index 905be9568b..1ccdc5ca2c 100755 --- a/configure +++ b/configure @@ -12635,9 +12635,9 @@ fi =20 if test "$with_gssapi" =3D yes ; then if test "$PORTNAME" !=3D "win32"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containi= ng gss_init_sec_context" >&5 -$as_echo_n "checking for library containing gss_init_sec_context... " >&6;= } -if ${ac_cv_search_gss_init_sec_context+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containi= ng gss_store_cred_into" >&5 +$as_echo_n "checking for library containing gss_store_cred_into... " >&6; } +if ${ac_cv_search_gss_store_cred_into+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=3D$LIBS @@ -12650,11 +12650,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char gss_init_sec_context (); +char gss_store_cred_into (); int main () { -return gss_init_sec_context (); +return gss_store_cred_into (); ; return 0; } @@ -12667,30 +12667,30 @@ for ac_lib in '' gssapi_krb5 gss 'gssapi -lkrb5 -= lcrypto'; do LIBS=3D"-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_gss_init_sec_context=3D$ac_res + ac_cv_search_gss_store_cred_into=3D$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_gss_init_sec_context+:} false; then : + if ${ac_cv_search_gss_store_cred_into+:} false; then : break fi done -if ${ac_cv_search_gss_init_sec_context+:} false; then : +if ${ac_cv_search_gss_store_cred_into+:} false; then : =20 else - ac_cv_search_gss_init_sec_context=3Dno + ac_cv_search_gss_store_cred_into=3Dno fi rm conftest.$ac_ext LIBS=3D$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gss_init_se= c_context" >&5 -$as_echo "$ac_cv_search_gss_init_sec_context" >&6; } -ac_res=3D$ac_cv_search_gss_init_sec_context +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gss_store_c= red_into" >&5 +$as_echo "$ac_cv_search_gss_store_cred_into" >&6; } +ac_res=3D$ac_cv_search_gss_store_cred_into if test "$ac_res" !=3D no; then : test "$ac_res" =3D "none required" || LIBS=3D"$ac_res $LIBS" =20 else - as_fn_error $? "could not find function 'gss_init_sec_context' required = for GSSAPI" "$LINENO" 5 + as_fn_error $? "could not find function 'gss_store_cred_into' required f= or GSSAPI" "$LINENO" 5 fi =20 else @@ -14104,6 +14104,33 @@ done =20 fi =20 +done + + for ac_header in gssapi/gssapi_ext.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "gssapi/gssapi_ext.h" "ac_cv_head= er_gssapi_gssapi_ext_h" "$ac_includes_default" +if test "x$ac_cv_header_gssapi_gssapi_ext_h" =3D xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GSSAPI_GSSAPI_EXT_H 1 +_ACEOF + +else + for ac_header in gssapi_ext.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "gssapi_ext.h" "ac_cv_header_gssa= pi_ext_h" "$ac_includes_default" +if test "x$ac_cv_header_gssapi_ext_h" =3D xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GSSAPI_EXT_H 1 +_ACEOF + +else + as_fn_error $? "gssapi_ext.h header file is required for GSSAPI" "$LINEN= O" 5 +fi + +done + +fi + done =20 fi @@ -15321,7 +15348,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; @@ -15367,7 +15394,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; @@ -15391,7 +15418,7 @@ rm -f core conftest.err conftest.$ac_objext conftes= t.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; @@ -15436,7 +15463,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; @@ -15460,7 +15487,7 @@ rm -f core conftest.err conftest.$ac_objext conftes= t.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; diff --git a/configure.ac b/configure.ac index 8095dfcf1d..7ba969b1b1 100644 --- a/configure.ac +++ b/configure.ac @@ -1340,8 +1340,8 @@ fi =20 if test "$with_gssapi" =3D yes ; then if test "$PORTNAME" !=3D "win32"; then - AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -= lcrypto'], [], - [AC_MSG_ERROR([could not find function 'gss_init_sec_co= ntext' required for GSSAPI])]) + AC_SEARCH_LIBS(gss_store_cred_into, [gssapi_krb5 gss 'gssapi -lkrb5 -l= crypto'], [], + [AC_MSG_ERROR([could not find function 'gss_store_cred_= into' required for GSSAPI])]) else LIBS=3D"$LIBS -lgssapi32" fi @@ -1562,6 +1562,8 @@ fi if test "$with_gssapi" =3D yes ; then AC_CHECK_HEADERS(gssapi/gssapi.h, [], [AC_CHECK_HEADERS(gssapi.h, [], [AC_MSG_ERROR([gssapi.h header file is re= quired for GSSAPI])])]) + AC_CHECK_HEADERS(gssapi/gssapi_ext.h, [], + [AC_CHECK_HEADERS(gssapi_ext.h, [], [AC_MSG_ERROR([gssapi_ext.h header fi= le is required for GSSAPI])])]) fi =20 PGAC_PATH_PROGS(OPENSSL, openssl) diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 3665e799e7..6d572c3820 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -196,6 +196,12 @@ /* Define to 1 if you have the `getpeerucred' function. */ #undef HAVE_GETPEERUCRED =20 +/* Define to 1 if you have the header file. */ +#undef HAVE_GSSAPI_EXT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_GSSAPI_GSSAPI_EXT_H + /* Define to 1 if you have the header file. */ #undef HAVE_GSSAPI_GSSAPI_H =20 --JfexJRnHb/wD0d28-- --cHt4NTrwTCx2y7xi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEwf6gbxKhD863zrx/7WyKOINHZFUFAmQw2hQACgkQ7WyKOINH ZFVauA//f0XIHSO7mUT1ehH2TxiCyfGAIlKE7ou3paxAmKILnkqwrN4zFij9zS0K TfGpyGuBqEO1EWjXesCIeFbgUWgy8+FhNtOfew7oHuvqojvPJsZTVreLYpUIDO7R ZSCTgmrLzkJZFCIbuVLAPdRIsbYX5hIkJ4lnKPalsXQjjVWzedZzTEEvKV7a1SqX 2SyOywIx8gPzYcRACNCfxikPPFnQWlRRcfCWtG7RPKDviWhLONrJAm1IqZ7fm7ak poBYAkPMIVaxq8mKHqTLTedhPf1EJ43nLzU7G1GDRe/ND+g3v8X71ctjQpywxuou T0UUDqSl8an/39DPmN40Q3I5ddU9j5aj6o2vn6OdWaCwaaZzAyGL0ESM+efgDdSI 4Yb7ZZZDKB3bmvh71e/CI7lHkGGQ6ELTmggSbv6YW5se93elcNpBKJLVcHk1XDYg 4HXCMSeiXXVULCPIiOx8Rsa2LTQC6zGRHpzkrzimTZ6VAkYuP6nUl2/bJVGcSlqL ZkYDTt3VLOfuck2uiOX0zZJEJMZ3mTRL2dMTCN7B2OEjYCJ43mqpMdg5RK9r5LwV pwiqKOnyQOvUIOV+JKSFbpP1ILzn90YPbfULsWV/H6sXZjtkCVMXfgsU6M5yAbTV ymUSO4yVKGDRIO8Tc+L64vkJiLhJGr6guTIT0T2AOBGSGNLjmlY= =TJ0Q -----END PGP SIGNATURE----- --cHt4NTrwTCx2y7xi--