From: Todd C. Miller Date: Sat, 13 Aug 2011 15:55:59 +0000 (-0400) Subject: Add check for NetBSD-style 4-argument skeychallenge() as Gentoo also X-Git-Tag: SUDO_1_7_7~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61edea73fddae8f6ab2b2073dc2b2402dd38ee06;p=sudo Add check for NetBSD-style 4-argument skeychallenge() as Gentoo also has this. Adapted from a patch from Diego Elio Petteno --HG-- branch : 1.7 --- diff --git a/auth/rfc1938.c b/auth/rfc1938.c index b0640e567..bd66964fb 100644 --- a/auth/rfc1938.c +++ b/auth/rfc1938.c @@ -46,7 +46,7 @@ #if defined(HAVE_SKEY) # include # define RFC1938 skey -# ifdef __NetBSD__ +# ifdef HAVE_RFC1938_SKEYCHALLENGE # define rfc1938challenge(a,b,c,d) skeychallenge((a),(b),(c),(d)) # else # define rfc1938challenge(a,b,c,d) skeychallenge((a),(b),(c)) diff --git a/config.h.in b/config.h.in index a4b000db0..cf8b23343 100644 --- a/config.h.in +++ b/config.h.in @@ -400,6 +400,10 @@ /* Define to 1 if you have the `revoke' function. */ #undef HAVE_REVOKE +/* Define to 1 if the skeychallenge() function is RFC1938-compliant and takes + 4 arguments */ +#undef HAVE_RFC1938_SKEYCHALLENGE + /* Define to 1 if you have the header file. */ #undef HAVE_SASL_H diff --git a/configure.in b/configure.in index 80a5e73ec..3e1fb7a71 100644 --- a/configure.in +++ b/configure.in @@ -2522,13 +2522,14 @@ if test "${with_skey-'no'}" = "yes"; then CPPFLAGS="${CPPFLAGS} -I${with_skey}/include" SUDO_APPEND_LIBPATH(LDFLAGS, [${with_skey}/lib]) SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_skey}/lib]) - AC_PREPROC_IFELSE([#include ], [found=yes], [found=no]) + AC_CHECK_HEADER([skey.h], [found=yes], [found=no], [#include ]) else found=no O_CPPFLAGS="$CPPFLAGS" for dir in "" "/usr/local" "/usr/contrib"; do test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include" - AC_PREPROC_IFELSE([#include ], [found=yes; break]) + AC_CHECK_HEADER([skey.h], [found=yes; break], [], + [#include ]) done if test "$found" = "no" -o -z "$dir"; then CPPFLAGS="$O_CPPFLAGS" @@ -2542,6 +2543,21 @@ if test "${with_skey-'no'}" = "yes"; then 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 SUDO_LDFLAGS])]) AC_CHECK_LIB(skey, skeyaccess, AC_DEFINE(HAVE_SKEYACCESS)) + + AC_MSG_CHECKING([for RFC1938-compliant skeychallenge]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include ]], + [[skeychallenge(NULL, NULL, NULL, 0);]] + )], [ + AC_DEFINE(HAVE_RFC1938_SKEYCHALLENGE) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ] + ) + LDFLAGS="$O_LDFLAGS" SUDO_LIBS="${SUDO_LIBS} -lskey" AUTH_OBJS="$AUTH_OBJS rfc1938.o" @@ -2947,6 +2963,7 @@ AH_TEMPLATE(HAVE_SETKEYCREATECON, [Define to 1 if you have the `setkeycreatecon' AH_TEMPLATE(HAVE_SIGACTION_T, [Define to 1 if has the sigaction_t typedef.]) 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_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_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])