From 0f5dc583a9d942e67953f84a6d800e9b969149b2 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Fri, 11 May 2012 21:28:41 +0100 Subject: [PATCH] Import of code from rra-c-util This commit updates the code imported from rra-c-util to 3900f94b9b8c46a3cb2d83d73c6cf4b73be1cc10 (release/4.4) New files are: m4/krb5-config.m4 Change-Id: I6ef966e4a30cd23feac4a159be2ffeb7357765b7 Reviewed-on: http://gerrit.openafs.org/7401 Reviewed-by: Russ Allbery Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/external/rra-c-util-last | 2 +- src/external/rra-c-util/LICENSE | 111 ++++++++++++---------- src/external/rra-c-util/m4/gssapi.m4 | 82 +++++++++++----- src/external/rra-c-util/m4/krb5-config.m4 | 101 ++++++++++++++++++++ src/external/rra-c-util/m4/krb5.m4 | 81 ++++++++-------- 5 files changed, 265 insertions(+), 112 deletions(-) create mode 100644 src/external/rra-c-util/m4/krb5-config.m4 diff --git a/src/external/rra-c-util-last b/src/external/rra-c-util-last index 4ca1278258..c7b0ad0c7a 100644 --- a/src/external/rra-c-util-last +++ b/src/external/rra-c-util-last @@ -1 +1 @@ -aadb400e7536b29fb2b34299ef3cac07d86c108d +3900f94b9b8c46a3cb2d83d73c6cf4b73be1cc10 diff --git a/src/external/rra-c-util/LICENSE b/src/external/rra-c-util/LICENSE index f171953d50..ac96faad72 100644 --- a/src/external/rra-c-util/LICENSE +++ b/src/external/rra-c-util/LICENSE @@ -1,7 +1,7 @@ The rra-c-util package as a whole is: Copyright 2000, 2009, 2010 Russ Allbery - Copyright 2009, 2010, 2011 + Copyright 2009, 2010, 2011, 2012 The Board of Trustees of the Leland Stanford Junior University The package is collectively released under the following license: @@ -34,15 +34,16 @@ licenses, all of which are compatible with the above general package license but which may require preservation of additional notices. All required notices are preserved in this file. Each file intended for copying into other software packages contains a copyright and license -notice at the top of the file. Please take note of any attribution and -notice requirements specified in that license. +notice at the top of the file or, in the case of tests/fakepam/README, at +the bottom of the file. Please take note of any attribution and notice +requirements specified in that license. Collected copyright notices for the entire package: Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010 Russ Allbery - Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 - The Board of Trustees of the Leland Stanford Junior University + 2010, 2011 Russ Allbery + Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, + 2012 The Board of Trustees of the Leland Stanford Junior University Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010 by Internet Systems Consortium, Inc. ("ISC") Copyright 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -57,49 +58,49 @@ Collected copyright notices for the entire package: Copyright 1998 Andrew Tridgell Copyright 2000, 2005 Hrvoje Niksic Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Copyright 1994 X Consortium -The files kafs/sys-syscall.c, mkusage, pam-util/vector.c, -pam-util/vector.h, portable/asprintf.c, portable/daemon.c, -portable/dummy.c, portable/getaddrinfo.c, portable/getaddrinfo.h, -portable/getnameinfo.c, portable/getnameinfo.h, portable/gssapi-mech.c, -portable/gssapi.h, portable/inet_aton.c, portable/inet_ntoa.c, -portable/inet_ntop.c, portable/issetuidgid.c, portable/krb4.h, -portable/krb5-extra.c, portable/krb5.h, portable/macros.h, -portable/mkstemp.c, portable/pam.h, portable/pam_syslog.c, -portable/pam_vsyslog.c, portable/setenv.c, portable/seteuid.c, -portable/stdbool.h, portable/strlcat.c, portable/strlcpy.c, -portable/strndup.c, portable/system.h, portable/uio.h, portable/winsock.c, -tests/pam-util/vector-t.c, tests/portable/asprintf-t.c, -tests/portable/daemon-t.c, tests/portable/getaddrinfo-t.c, -tests/portable/getnameinfo-t.c, tests/portable/inet_aton-t.c, -tests/portable/inet_ntoa-t.c, tests/portable/inet_ntop-t.c, -tests/portable/mkstemp-t.c, tests/portable/setenv-t.c, -tests/portable/strlcat-t.c, tests/portable/strlcpy-t.c, -tests/portable/strndup-t.c, tests/util/buffer-t.c, tests/util/concat-t.c, -tests/util/vector-t.c, util/concat.c, util/concat.h, util/macros.h, -util/vector.c, and util/vector.h are covered by the following statement: +The files kafs/sys-syscall.c, pam-util/vector.c, pam-util/vector.h, +portable/asprintf.c, portable/daemon.c, portable/dummy.c, +portable/getaddrinfo.c, portable/getaddrinfo.h, portable/getnameinfo.c, +portable/getnameinfo.h, portable/gssapi-mech.c, portable/gssapi.h, +portable/inet_aton.c, portable/inet_ntoa.c, portable/inet_ntop.c, +portable/issetugid.c, portable/kadmin.h, portable/krb5-extra.c, +portable/krb5.h, portable/macros.h, portable/mkstemp.c, portable/pam.h, +portable/pam_syslog.c, portable/pam_vsyslog.c, portable/setenv.c, +portable/seteuid.c, portable/stdbool.h, portable/strlcat.c, +portable/strlcpy.c, portable/strndup.c, portable/system.h, portable/uio.h, +portable/winsock.c, tests/pam-util/vector-t.c, +tests/portable/asprintf-t.c, tests/portable/daemon-t.c, +tests/portable/getaddrinfo-t.c, tests/portable/getnameinfo-t.c, +tests/portable/inet_aton-t.c, tests/portable/inet_ntoa-t.c, +tests/portable/inet_ntop-t.c, tests/portable/mkstemp-t.c, +tests/portable/setenv-t.c, tests/portable/strlcat-t.c, +tests/portable/strlcpy-t.c, tests/portable/strndup-t.c, +tests/util/buffer-t.c, tests/util/concat-t.c, tests/util/vector-t.c, +util/concat.c, util/concat.h, util/macros.h, util/vector.c, and +util/vector.h are covered by the following statement: - The authors hereby relinquish any claim to any copyright that they may - have in this work, whether granted under contract or by operation of - law or international treaty, and hereby commit to the public, at - large, that they shall not, at any time in the future, seek to enforce - any copyright in this work against any person or entity, or prevent - any person or entity from copying, publishing, distributing or - creating derivative works of this work. + The authors hereby relinquish any claim to any copyright that they may + have in this work, whether granted under contract or by operation of law + or international treaty, and hereby commit to the public, at large, that + they shall not, at any time in the future, seek to enforce any copyright + in this work against any person or entity, or prevent any person or + entity from copying, publishing, distributing or creating derivative + works of this work. In other words, you can do anything you wish with this code, although I would strongly prefer that any improvements or modifications be sent to me (rra@stanford.edu) so that I can continue to maintain a canonical version. The files configure.ac, m4/apache.m4, m4/apr.m4, m4/aprutil.m4, -m4/curl.m4, m4/gssapi.m4, m4/inet-ntoa.m4, m4/kafs.m4, m4/krb4.m4, -m4/krb5.m4, m4/ld-version.m4, m4/ldap.m4, m4/lib-depends.m4, -m4/lib-pathname.m4, m4/pam-const.m4, m4/pcre.m4, m4/remctl.m4, -m4/snprintf.m4, m4/ssl.m4, and m4/vamacros.m4 are released under the -following copyright and license: +m4/curl.m4, m4/gssapi.m4, m4/inet-ntoa.m4, m4/kadm5clnt.m4, m4/kafs.m4, +m4/krb5.m4, m4/krb5-config.m4, m4/ld-version.m4, m4/ldap.m4, +m4/lib-depends.m4, m4/lib-helper.m4, m4/lib-pathname.m4, m4/pam-const.m4, +m4/pcre.m4, m4/remctl.m4, m4/snprintf.m4, m4/ssl.m4, and m4/vamacros.m4 +are released under the following copyright and license: Copyright 1999, 2000, 2001, 2003 Russ Allbery Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011 @@ -117,7 +118,7 @@ util/messages.c, util/messages.h, util/network.c, util/network.h, util/xmalloc.c, util/xmalloc.h, util/xwrite.c, and util/xwrite.h are released under the following copyright and license: - Copyright 2008, 2009, 2010, 2011 + Copyright 2008, 2009, 2010, 2011, 2012 The Board of Trustees of the Leland Stanford Junior University Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010 by Internet Systems Consortium, Inc. ("ISC") @@ -193,10 +194,10 @@ The files Makefile.in and aclocal.m4 are generated by GNU Automake and released under the following copyright and license: Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, - Inc. This file is free software; the Free Software Foundation gives - unlimited permission to copy and/or distribute it, with or without - modifications, as long as this notice is preserved. + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software + Foundation, Inc. This file is free software; the Free Software + Foundation gives unlimited permission to copy and/or distribute it, with + or without modifications, as long as this notice is preserved. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without @@ -212,14 +213,14 @@ following copyright and license: Software Foundation gives unlimited permission to copy, distribute and modify it. -The files build-aux/depcomp and build-aux/missing are taken from GNU -Automake. The files build-aux/config.guess and build-aux/config.sub are -taken from the Debian autotools-dev package. These files are released -under the following copyright and license: +The files build-aux/compile, build-aux/depcomp, and build-aux/missing are +taken from GNU Automake. The files build-aux/config.guess and +build-aux/config.sub are taken from the Debian autotools-dev package. +These files are released under the following copyright and license: Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free - Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -271,3 +272,13 @@ and license: from the X Consortium. FSF changes to this file are in the public domain. + +The files tests/README and tests/fakepam/README are released under the +following copyright and license: + + Copyright 2010, 2011 Russ Allbery + + Copying and distribution of this file, with or without modification, are + permitted in any medium without royalty provided the copyright notice + and this notice are preserved. This file is offered as-is, without any + warranty. diff --git a/src/external/rra-c-util/m4/gssapi.m4 b/src/external/rra-c-util/m4/gssapi.m4 index deaa43288a..c8b6a9555f 100644 --- a/src/external/rra-c-util/m4/gssapi.m4 +++ b/src/external/rra-c-util/m4/gssapi.m4 @@ -12,19 +12,35 @@ dnl RRA_LIB_GSSAPI_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include the dnl GSS-API libraries, saving the ecurrent values, and RRA_LIB_GSSAPI_RESTORE dnl to restore those settings to before the last RRA_LIB_GSSAPI_SWITCH. dnl -dnl Depends on RRA_ENABLE_REDUCED_DEPENDS and RRA_SET_LDFLAGS. +dnl Also provides RRA_INCLUDES_KRB5, which are the headers to include when +dnl probing the Kerberos library properties. +dnl +dnl Depends on RRA_KRB5_CONFIG, RRA_ENABLE_REDUCED_DEPENDS, and +dnl RRA_SET_LDFLAGS. dnl dnl The canonical version of this file is maintained in the rra-c-util dnl package, available at . dnl dnl Written by Russ Allbery -dnl Copyright 2005, 2006, 2007, 2008, 2009, 2011 +dnl Copyright 2005, 2006, 2007, 2008, 2009, 2011, 2012 dnl The Board of Trustees of the Leland Stanford Junior University dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl Headers to include when probing for Kerberos library properties. +AC_DEFUN([RRA_INCLUDES_GSSAPI], [[ +#ifdef HAVE_GSSAPI_GSSAPI_H +# include +#else +# include +#endif +#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H +# include +#endif +]]) + dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to dnl versions that include the GSS-API flags. Used as a wrapper, with dnl RRA_LIB_GSSAPI_RESTORE, around tests. @@ -124,27 +140,41 @@ AC_DEFUN([_RRA_LIB_GSSAPI_CHECK], dnl Determine GSS-API compiler and linker flags from krb5-config. AC_DEFUN([_RRA_LIB_GSSAPI_CONFIG], -[AC_ARG_VAR([PATH_KRB5_CONFIG], [Path to krb5-config]) - AS_IF([test x"$rra_gssapi_root" != x && test -z "$PATH_KRB5_CONFIG"], - [AS_IF([test -x "${rra_gssapi_root}/bin/krb5-config"], - [PATH_KRB5_CONFIG="${rra_gssapi_root}/bin/krb5-config"])], - [AC_PATH_PROG([PATH_KRB5_CONFIG], [krb5-config], [], - [${PATH}:/usr/kerberos/bin])]) - AS_IF([test x"$PATH_KRB5_CONFIG" != x && test -x "$PATH_KRB5_CONFIG"], - [AC_CACHE_CHECK([for gssapi support in krb5-config], - [rra_cv_lib_gssapi_config], - [AS_IF(["$PATH_KRB5_CONFIG" 2>&1 | grep gssapi >/dev/null 2>&1], - [rra_cv_lib_gssapi_config=yes], - [rra_cv_lib_gssapi_config=no])]) - AS_IF([test "$rra_cv_lib_gssapi_config" = yes], - [GSSAPI_CPPFLAGS=`"$PATH_KRB5_CONFIG" --cflags gssapi 2>/dev/null` - GSSAPI_LIBS=`"$PATH_KRB5_CONFIG" --libs gssapi 2>/dev/null`], - [GSSAPI_CPPFLAGS=`"$PATH_KRB5_CONFIG" --cflags 2>/dev/null` - GSSAPI_LIBS=`"$PATH_KRB5_CONFIG" --libs 2>/dev/null`]) - GSSAPI_CPPFLAGS=`echo "$GSSAPI_CPPFLAGS" | sed 's%-I/usr/include ?%%'` - _RRA_LIB_GSSAPI_CHECK], - [_RRA_LIB_GSSAPI_PATHS - _RRA_LIB_GSSAPI_MANUAL])]) +[RRA_KRB5_CONFIG([${rra_gssapi_root}], [gssapi], [GSSAPI], + [_RRA_LIB_GSSAPI_CHECK], + [_RRA_LIB_GSSAPI_PATHS + _RRA_LIB_GSSAPI_MANUAL])]) + +dnl Check for a header using a file existence check rather than using +dnl AC_CHECK_HEADERS. This is used if there were arguments to configure +dnl specifying the GSS-API library path, since we may have one header in the +dnl default include path and another under our explicitly-configured GSS-API +dnl location. +AC_DEFUN([_RRA_LIB_GSSAPI_CHECK_HEADER], +[AC_MSG_CHECKING([for $1]) + AS_IF([test -f "${rra_gssapi_incroot}/$1"], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1]), [1], + [Define to 1 if you have the <$1> header file.]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])])]) + +dnl Determine the GSS-API header location and probe for some other +dnl characteristics of the libraries. We use a file existence check rather +dnl than letting the compiler probe for the right header location +AC_DEFUN([_RRA_LIB_GSSAPI_EXTRA], +[rra_gssapi_incroot= + AS_IF([test x"$rra_gssapi_includedir" != x], + [rra_gssapi_incroot="$rra_gssapi_includedir"], + [AS_IF([test x"$rra_gssapi_root" != x], + [rra_gssapi_incroot="${rra_gssapi_root}/include"])]) + AS_IF([test x"$rra_gssapi_incroot" = x], + [AC_CHECK_HEADERS([gssapi/gssapi.h gssapi/gssapi_krb5.h])], + [_RRA_LIB_GSSAPI_CHECK_HEADER([gssapi/gssapi.h]) + _RRA_LIB_GSSAPI_CHECK_HEADER([gssapi/gssapi_krb5.h])]) + AC_CHECK_DECL([GSS_C_NT_USER_NAME], + [AC_DEFINE([HAVE_GSS_RFC_OIDS], 1, + [Define to 1 if the GSS-API library uses RFC-compliant OIDs.])], [], + [RRA_INCLUDES_GSSAPI])]) dnl The main macro. AC_DEFUN([RRA_LIB_GSSAPI], @@ -182,4 +212,8 @@ AC_DEFUN([RRA_LIB_GSSAPI], && test x"$rra_gssapi_libdir" = x], [_RRA_LIB_GSSAPI_CONFIG], [_RRA_LIB_GSSAPI_PATHS - _RRA_LIB_GSSAPI_MANUAL])])]) + _RRA_LIB_GSSAPI_MANUAL])]) + + RRA_LIB_GSSAPI_SWITCH + _RRA_LIB_GSSAPI_EXTRA + RRA_LIB_GSSAPI_RESTORE]) diff --git a/src/external/rra-c-util/m4/krb5-config.m4 b/src/external/rra-c-util/m4/krb5-config.m4 new file mode 100644 index 0000000000..d73085f9ca --- /dev/null +++ b/src/external/rra-c-util/m4/krb5-config.m4 @@ -0,0 +1,101 @@ +dnl Use krb5-config to get link paths for Kerberos libraries. +dnl +dnl Provides one macro, RRA_KRB5_CONFIG, which attempts to get compiler and +dnl linker flags for a library via krb5-config and sets the appropriate shell +dnl variables. Defines the Autoconf variable PATH_KRB5_CONFIG, which can be +dnl used to find the default path to krb5-config. +dnl +dnl Depends on RRA_ENABLE_REDUCED_DEPENDS. +dnl +dnl The canonical version of this file is maintained in the rra-c-util +dnl package, available at . +dnl +dnl Written by Russ Allbery +dnl Copyright 2011, 2012 +dnl The Board of Trustees of the Leland Stanford Junior University +dnl +dnl This file is free software; the authors give unlimited permission to copy +dnl and/or distribute it, with or without modifications, as long as this +dnl notice is preserved. + +dnl Check for krb5-config in the user's path and set PATH_KRB5_CONFIG. This +dnl is moved into a separate macro so that it can be loaded via AC_REQUIRE, +dnl meaning it will only be run once even if we link with multiple krb5-config +dnl libraries. +AC_DEFUN([_RRA_KRB5_CONFIG_PATH], +[AC_ARG_VAR([PATH_KRB5_CONFIG], [Path to krb5-config]) + AC_PATH_PROG([PATH_KRB5_CONFIG], [krb5-config], [], + [${PATH}:/usr/kerberos/bin])]) + +dnl Check whether the --deps flag is supported by krb5-config. Takes the path +dnl to krb5-config to use. Note that this path is not embedded in the cache +dnl variable, so this macro implicitly assumes that we will always use the +dnl same krb5-config program. +AC_DEFUN([_RRA_KRB5_CONFIG_DEPS], +[AC_REQUIRE([_RRA_KRB5_CONFIG_PATH]) + AC_CACHE_CHECK([for --deps support in krb5-config], + [rra_cv_krb5_config_deps], + [AS_IF(["$1" 2>&1 | grep deps >/dev/null 2>&1], + [rra_cv_krb5_config_deps=yes], + [rra_cv_krb5_config_deps=no])])]) + +dnl Obtain the library flags for a particular library using krb5-config. +dnl Takes the path to the krb5-config program to use, the argument to +dnl krb5-config to use, and the variable prefix under which to store the +dnl library flags. +AC_DEFUN([_RRA_KRB5_CONFIG_LIBS], +[AC_REQUIRE([_RRA_KRB5_CONFIG_PATH]) + AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS]) + _RRA_KRB5_CONFIG_DEPS([$1]) + AS_IF([test x"$rra_reduced_depends" = xfalse \ + && test x"$rra_cv_krb5_config_deps" = xyes], + [$3[]_LIBS=`"$1" --deps --libs $2 2>/dev/null`], + [$3[]_LIBS=`"$1" --libs $2 2>/dev/null`])]) + +dnl Attempt to find the flags for a library using krb5-config. Takes the +dnl following arguments (in order): +dnl +dnl 1. The root directory for the library in question, generally from an +dnl Autoconf --with flag. Used by preference as the path to krb5-config. +dnl +dnl 2. The argument to krb5-config to retrieve flags for this particular +dnl library. +dnl +dnl 3. The variable prefix to use when setting CPPFLAGS and LIBS variables +dnl based on the result of krb5-config. +dnl +dnl 4. Further actions to take if krb5-config was found and supported that +dnl library type. +dnl +dnl 5. Further actions to take if krb5-config could not be used to get flags +dnl for that library type. +dnl +dnl Special-case a krb5-config argument of krb5 and run krb5-config without an +dnl argument if that option was requested and not supported. Old versions of +dnl krb5-config didn't take an argument to specify the library type, but +dnl always returned the flags for libkrb5. +AC_DEFUN([RRA_KRB5_CONFIG], +[AC_REQUIRE([_RRA_KRB5_CONFIG_PATH]) + rra_krb5_config_$3= + rra_krb5_config_$3[]_ok= + AS_IF([test x"$1" != x && test -x "$1/bin/krb5-config"], + [rra_krb5_config_$3="$1/bin/krb5-config"], + [rra_krb5_config_$3="$PATH_KRB5_CONFIG"]) + AS_IF([test x"$rra_krb5_config_$3" != x && test -x "$rra_krb5_config_$3"], + [AC_CACHE_CHECK([for $2 support in krb5-config], [rra_cv_lib_$3[]_config], + [AS_IF(["$rra_krb5_config_$3" 2>&1 | grep $2 >/dev/null 2>&1], + [rra_cv_lib_$3[]_config=yes], + [rra_cv_lib_$3[]_config=no])]) + AS_IF([test "$rra_cv_lib_$3[]_config" = yes], + [$3[]_CPPFLAGS=`"$rra_krb5_config_$3" --cflags $2 2>/dev/null` + _RRA_KRB5_CONFIG_LIBS([$rra_krb5_config_$3], [$2], [$3]) + rra_krb5_config_$3[]_ok=yes], + [AS_IF([test x"$2" = xkrb5], + [$3[]_CPPFLAGS=`"$rra_krb5_config_$3" --cflags 2>/dev/null` + $3[]_LIBS=`"$rra_krb5_config_$3" --libs $2 2>/dev/null` + rra_krb5_config_$3[]_ok=yes])])]) + AS_IF([test x"$rra_krb5_config_$3[]_ok" = xyes], + [$3[]_CPPFLAGS=`echo "$$3[]_CPPFLAGS" | sed 's%-I/usr/include %%'` + $3[]_CPPFLAGS=`echo "$$3[]_CPPFLAGS" | sed 's%-I/usr/include$%%'` + $4], + [$5])]) diff --git a/src/external/rra-c-util/m4/krb5.m4 b/src/external/rra-c-util/m4/krb5.m4 index fb8cf908c8..61602a2e12 100644 --- a/src/external/rra-c-util/m4/krb5.m4 +++ b/src/external/rra-c-util/m4/krb5.m4 @@ -33,6 +33,9 @@ dnl Also provides RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_FREE_ARGS, which checks dnl whether krb5_get_init_creds_opt_free takes one argument or two. Defines dnl HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_2_ARGS if it takes two arguments. dnl +dnl Also provides RRA_INCLUDES_KRB5, which are the headers to include when +dnl probing the Kerberos library properties. +dnl dnl The canonical version of this file is maintained in the rra-c-util dnl package, available at . dnl @@ -44,6 +47,15 @@ dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl Headers to include when probing for Kerberos library properties. +AC_DEFUN([RRA_INCLUDES_KRB5], [[ +#if HAVE_KRB5_H +# include +#else +# include +#endif +]]) + dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to dnl versions that include the Kerberos flags. Used as a wrapper, with dnl RRA_LIB_KRB5_RESTORE, around tests. @@ -84,6 +96,7 @@ AC_DEFUN([_RRA_LIB_KRB5_REDUCED], [AS_IF([test x"$1" = xtrue], [AC_MSG_ERROR([cannot find usable Kerberos library])])]) LIBS="$KRB5_LIBS $LIBS" + AC_CHECK_HEADERS([krb5.h krb5/krb5.h]) AC_CHECK_FUNCS([krb5_get_error_message], [AC_CHECK_FUNCS([krb5_free_error_message])], [AC_CHECK_FUNCS([krb5_get_error_string], [], @@ -92,7 +105,7 @@ AC_DEFUN([_RRA_LIB_KRB5_REDUCED], [KRB5_LIBS="$KRB5_LIBS -lksvc" AC_DEFINE([HAVE_KRB5_SVC_GET_MSG], [1]) AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [], - [#include ])], + [RRA_INCLUDES_KRB5])], [AC_CHECK_LIB([com_err], [com_err], [KRB5_LIBS="$KRB5_LIBS -lcom_err"], [AC_MSG_ERROR([cannot find usable com_err library])]) @@ -143,13 +156,14 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL], [$rra_krb5_extra])], [-lasn1 -lcom_err -lcrypto $rra_krb5_extra]) LIBS="$KRB5_LIBS $LIBS" + AC_CHECK_HEADERS([krb5.h krb5/krb5.h]) AC_CHECK_FUNCS([krb5_get_error_message], [AC_CHECK_FUNCS([krb5_free_error_message])], [AC_CHECK_FUNCS([krb5_get_error_string], [], [AC_CHECK_FUNCS([krb5_get_err_txt], [], [AC_CHECK_FUNCS([krb5_svc_get_msg], [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [], - [#include ])], + [RRA_INCLUDES_KRB5])], [AC_CHECK_HEADERS([et/com_err.h])])])])]) RRA_LIB_KRB5_RESTORE]) @@ -171,37 +185,21 @@ dnl Determine Kerberos compiler and linker flags from krb5-config. Does the dnl additional probing we need to do to uncover error handling features, and dnl falls back on the manual checks. AC_DEFUN([_RRA_LIB_KRB5_CONFIG], -[AC_ARG_VAR([PATH_KRB5_CONFIG], [Path to krb5-config]) - AS_IF([test x"$rra_krb5_root" != x && test -z "$PATH_KRB5_CONFIG"], - [AS_IF([test -x "${rra_krb5_root}/bin/krb5-config"], - [PATH_KRB5_CONFIG="${rra_krb5_root}/bin/krb5-config"])], - [AC_PATH_PROG([PATH_KRB5_CONFIG], [krb5-config], [], - [${PATH}:/usr/kerberos/bin])]) - AS_IF([test x"$PATH_KRB5_CONFIG" != x && test -x "$PATH_KRB5_CONFIG"], - [AC_CACHE_CHECK([for krb5 support in krb5-config], - [rra_cv_lib_krb5_config], - [AS_IF(["$PATH_KRB5_CONFIG" 2>&1 | grep krb5 >/dev/null 2>&1], - [rra_cv_lib_krb5_config=yes], - [rra_cv_lib_krb5_config=no])]) - AS_IF([test x"$rra_cv_lib_krb5_config" = xyes], - [KRB5_CPPFLAGS=`"$PATH_KRB5_CONFIG" --cflags krb5 2>/dev/null` - KRB5_LIBS=`"$PATH_KRB5_CONFIG" --libs krb5 2>/dev/null`], - [KRB5_CPPFLAGS=`"$PATH_KRB5_CONFIG" --cflags 2>/dev/null` - KRB5_LIBS=`"$PATH_KRB5_CONFIG" --libs 2>/dev/null`]) - KRB5_CPPFLAGS=`echo "$KRB5_CPPFLAGS" | sed 's%-I/usr/include ?%%'` - _RRA_LIB_KRB5_CHECK([$1]) - RRA_LIB_KRB5_SWITCH - AC_CHECK_FUNCS([krb5_get_error_message], - [AC_CHECK_FUNCS([krb5_free_error_message])], - [AC_CHECK_FUNCS([krb5_get_error_string], [], - [AC_CHECK_FUNCS([krb5_get_err_txt], [], - [AC_CHECK_FUNCS([krb5_svc_get_msg], - [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [], - [#include ])], - [AC_CHECK_HEADERS([et/com_err.h])])])])]) - RRA_LIB_KRB5_RESTORE], - [_RRA_LIB_KRB5_PATHS - _RRA_LIB_KRB5_MANUAL([$1])])]) +[RRA_KRB5_CONFIG([${rra_krb5_root}], [krb5], [KRB5], + [_RRA_LIB_KRB5_CHECK([$1]) + RRA_LIB_KRB5_SWITCH + AC_CHECK_HEADERS([krb5.h krb5/krb5.h]) + AC_CHECK_FUNCS([krb5_get_error_message], + [AC_CHECK_FUNCS([krb5_free_error_message])], + [AC_CHECK_FUNCS([krb5_get_error_string], [], + [AC_CHECK_FUNCS([krb5_get_err_txt], [], + [AC_CHECK_FUNCS([krb5_svc_get_msg], + [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [], + [RRA_INCLUDES_KRB5])], + [AC_CHECK_HEADERS([et/com_err.h])])])])]) + RRA_LIB_KRB5_RESTORE], + [_RRA_LIB_KRB5_PATHS + _RRA_LIB_KRB5_MANUAL([$1])])]) dnl The core of the library checking, shared between RRA_LIB_KRB5 and dnl RRA_LIB_KRB5_OPTIONAL. The single argument, if "true", says to fail if @@ -212,7 +210,7 @@ AC_DEFUN([_RRA_LIB_KRB5_INTERNAL], [_RRA_LIB_KRB5_PATHS _RRA_LIB_KRB5_REDUCED([$1])], [AS_IF([test x"$rra_krb5_includedir" = x && test x"$rra_krb5_libdir" = x], - [_RRA_LIB_KRB5_CONFIG], + [_RRA_LIB_KRB5_CONFIG([$1])], [_RRA_LIB_KRB5_PATHS _RRA_LIB_KRB5_MANUAL([$1])])]) rra_krb5_uses_com_err=false @@ -283,6 +281,17 @@ AC_DEFUN([RRA_LIB_KRB5_OPTIONAL], AS_IF([test x"$KRB5_LIBS" != x], [AC_DEFINE([HAVE_KERBEROS], 1, [Define to enable Kerberos features.])])]) +dnl Source used by RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_FREE_ARGS. +AC_DEFUN([_RRA_FUNC_KRB5_OPT_FREE_ARGS_SOURCE], [RRA_INCLUDES_KRB5] [[ +int +main(void) +{ + krb5_get_init_creds_opt *opts; + krb5_context c; + krb5_get_init_creds_opt_free(c, opts); +} +]]) + dnl Check whether krb5_get_init_creds_opt_free takes one argument or two. dnl Early Heimdal used to take a single argument. Defines dnl HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_2_ARGS if it takes two arguments. @@ -291,9 +300,7 @@ dnl Should be called with RRA_LIB_KRB5_SWITCH active. AC_DEFUN([RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_FREE_ARGS], [AC_CACHE_CHECK([if krb5_get_init_creds_opt_free takes two arguments], [rra_cv_func_krb5_get_init_creds_opt_free_args], - [AC_TRY_COMPILE([#include ], - [krb5_get_init_creds_opt *opts; krb5_context c; - krb5_get_init_creds_opt_free(c, opts);], + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_FUNC_KRB5_OPT_FREE_ARGS_SOURCE])], [rra_cv_func_krb5_get_init_creds_opt_free_args=yes], [rra_cv_func_krb5_get_init_creds_opt_free_args=no])]) AS_IF([test $rra_cv_func_krb5_get_init_creds_opt_free_args = yes],