Add check for NetBSD-style 4-argument skeychallenge() as Gentoo also

has this.  Adapted from a patch from Diego Elio Petteno
This commit is contained in:
Todd C. Miller
2011-04-06 10:08:57 -04:00
parent f6ffc8adf3
commit 233d90f2c3
3 changed files with 63 additions and 15 deletions

55
configure vendored
View File

@@ -17892,29 +17892,27 @@ if test "${with_skey-'no'}" = "yes"; then
blibpath_add="${blibpath_add}:${with_skey}/lib" blibpath_add="${blibpath_add}:${with_skey}/lib"
fi fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext ac_fn_c_check_header_compile "$LINENO" "skey.h" "ac_cv_header_skey_h" "#include <stdio.h>
/* end confdefs.h. */ "
#include <skey.h> if test "x$ac_cv_header_skey_h" = x""yes; then :
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
found=yes found=yes
else else
found=no found=no
fi fi
rm -f conftest.err conftest.$ac_ext
else else
found=no found=no
O_CPPFLAGS="$CPPFLAGS" O_CPPFLAGS="$CPPFLAGS"
for dir in "" "/usr/local" "/usr/contrib"; do for dir in "" "/usr/local" "/usr/contrib"; do
test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include" test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext ac_fn_c_check_header_compile "$LINENO" "skey.h" "ac_cv_header_skey_h" "#include <stdio.h>
/* end confdefs.h. */ "
#include <skey.h> if test "x$ac_cv_header_skey_h" = x""yes; then :
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
found=yes; break found=yes; break
fi fi
rm -f conftest.err conftest.$ac_ext
done done
if test "$found" = "no" -o -z "$dir"; then if test "$found" = "no" -o -z "$dir"; then
CPPFLAGS="$O_CPPFLAGS" CPPFLAGS="$O_CPPFLAGS"
@@ -18033,6 +18031,38 @@ if test "x$ac_cv_lib_skey_skeyaccess" = x""yes; then :
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RFC1938-compliant skeychallenge" >&5
$as_echo_n "checking for RFC1938-compliant skeychallenge... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
#include <skey.h>
int
main ()
{
skeychallenge(NULL, NULL, NULL, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
$as_echo "#define HAVE_RFC1938_SKEYCHALLENGE 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
LDFLAGS="$O_LDFLAGS" LDFLAGS="$O_LDFLAGS"
SUDOERS_LIBS="${SUDOERS_LIBS} -lskey" SUDOERS_LIBS="${SUDOERS_LIBS} -lskey"
AUTH_OBJS="$AUTH_OBJS rfc1938.lo" AUTH_OBJS="$AUTH_OBJS rfc1938.lo"
@@ -21369,5 +21399,6 @@ fi

View File

@@ -2585,13 +2585,14 @@ if test "${with_skey-'no'}" = "yes"; then
CPPFLAGS="${CPPFLAGS} -I${with_skey}/include" CPPFLAGS="${CPPFLAGS} -I${with_skey}/include"
SUDO_APPEND_LIBPATH(LDFLAGS, [${with_skey}/lib]) SUDO_APPEND_LIBPATH(LDFLAGS, [${with_skey}/lib])
SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_skey}/lib]) SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_skey}/lib])
AC_PREPROC_IFELSE([#include <skey.h>], [found=yes], [found=no]) AC_CHECK_HEADER([skey.h], [found=yes], [found=no], [#include <stdio.h>])
else else
found=no found=no
O_CPPFLAGS="$CPPFLAGS" O_CPPFLAGS="$CPPFLAGS"
for dir in "" "/usr/local" "/usr/contrib"; do for dir in "" "/usr/local" "/usr/contrib"; do
test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include" test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
AC_PREPROC_IFELSE([#include <skey.h>], [found=yes; break]) AC_CHECK_HEADER([skey.h], [found=yes; break], [],
[#include <stdio.h>])
done done
if test "$found" = "no" -o -z "$dir"; then if test "$found" = "no" -o -z "$dir"; then
CPPFLAGS="$O_CPPFLAGS" CPPFLAGS="$O_CPPFLAGS"
@@ -2605,6 +2606,21 @@ if test "${with_skey-'no'}" = "yes"; then
fi fi
AC_CHECK_LIB(skey, main, [found=yes], [AC_MSG_WARN([Unable to locate libskey.a, you will have to edit the Makefile and add -L/path/to/skey/lib to SUDOERS_LDFLAGS])]) AC_CHECK_LIB(skey, main, [found=yes], [AC_MSG_WARN([Unable to locate libskey.a, you will have to edit the Makefile and add -L/path/to/skey/lib to SUDOERS_LDFLAGS])])
AC_CHECK_LIB(skey, skeyaccess, AC_DEFINE(HAVE_SKEYACCESS)) AC_CHECK_LIB(skey, skeyaccess, AC_DEFINE(HAVE_SKEYACCESS))
AC_MSG_CHECKING([for RFC1938-compliant skeychallenge])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdio.h>
#include <skey.h>]],
[[skeychallenge(NULL, NULL, NULL, 0);]]
)], [
AC_DEFINE(HAVE_RFC1938_SKEYCHALLENGE)
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
]
)
LDFLAGS="$O_LDFLAGS" LDFLAGS="$O_LDFLAGS"
SUDOERS_LIBS="${SUDOERS_LIBS} -lskey" SUDOERS_LIBS="${SUDOERS_LIBS} -lskey"
AUTH_OBJS="$AUTH_OBJS rfc1938.lo" AUTH_OBJS="$AUTH_OBJS rfc1938.lo"
@@ -3004,6 +3020,7 @@ AH_TEMPLATE(HAVE_SHL_LOAD, [Define to 1 if you have the `shl_load' function.])
AH_TEMPLATE(HAVE_SIGACTION_T, [Define to 1 if <signal.h> has the sigaction_t typedef.]) AH_TEMPLATE(HAVE_SIGACTION_T, [Define to 1 if <signal.h> has the sigaction_t typedef.])
AH_TEMPLATE(HAVE_SKEY, [Define to 1 if you use S/Key.]) AH_TEMPLATE(HAVE_SKEY, [Define to 1 if you use S/Key.])
AH_TEMPLATE(HAVE_SKEYACCESS, [Define to 1 if your S/Key library has skeyaccess().]) AH_TEMPLATE(HAVE_SKEYACCESS, [Define to 1 if your S/Key library has skeyaccess().])
AH_TEMPLATE(HAVE_RFC1938_SKEYCHALLENGE, [Define to 1 if the skeychallenge() function is RFC1938-compliant and takes 4 arguments])
AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union]) AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union])
AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member]) AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member])
AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member]) AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member])

View File

@@ -46,7 +46,7 @@
#if defined(HAVE_SKEY) #if defined(HAVE_SKEY)
# include <skey.h> # include <skey.h>
# define RFC1938 skey # define RFC1938 skey
# ifdef __NetBSD__ # ifdef HAVE_RFC1938_SKEYCHALLENGE
# define rfc1938challenge(a,b,c,d) skeychallenge((a),(b),(c),(d)) # define rfc1938challenge(a,b,c,d) skeychallenge((a),(b),(c),(d))
# else # else
# define rfc1938challenge(a,b,c,d) skeychallenge((a),(b),(c)) # define rfc1938challenge(a,b,c,d) skeychallenge((a),(b),(c))