]> granicus.if.org Git - sudo/commitdiff
Add check for NetBSD-style 4-argument skeychallenge() as Gentoo also
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 13 Aug 2011 15:55:59 +0000 (11:55 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 13 Aug 2011 15:55:59 +0000 (11:55 -0400)
has this.  Adapted from a patch from Diego Elio Petteno

--HG--
branch : 1.7

auth/rfc1938.c
config.h.in
configure.in

index b0640e567b8a1e661cb70ca28a34cab56af2eca4..bd66964fbaec2f68ae117895a87758ba04e609c3 100644 (file)
@@ -46,7 +46,7 @@
 #if defined(HAVE_SKEY)
 # include <skey.h>
 # 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))
index a4b000db0a3e1f9fbd4db5b12d8d2f22e1cc1811..cf8b233435053bcb64c22bebfe870c5d8223c610 100644 (file)
 /* 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 <sasl.h> header file. */
 #undef HAVE_SASL_H
 
index 80a5e73ec06c0d712ac493598b259c83225af86d..3e1fb7a717541b497e8d76c414be90ffe48ca5b2 100644 (file)
@@ -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 <skey.h>], [found=yes], [found=no])
+       AC_CHECK_HEADER([skey.h], [found=yes], [found=no], [#include <stdio.h>])
     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 <skey.h>], [found=yes; break])
+           AC_CHECK_HEADER([skey.h], [found=yes; break], [],
+               [#include <stdio.h>])
        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 <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"
     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 <signal.h> 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])