]> granicus.if.org Git - sudo/commitdiff
Add check for NetBSD-style 4-argument skeychallenge() as Gentoo also
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 6 Apr 2011 14:08:57 +0000 (10:08 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 6 Apr 2011 14:08:57 +0000 (10:08 -0400)
has this.  Adapted from a patch from Diego Elio Petteno

configure
configure.in
plugins/sudoers/auth/rfc1938.c

index 56009cfd9aee0f3a2e6be39001931e9e9f437aea..55160ade8094d76bdab4c47497e2e4361b3b2e92 100755 (executable)
--- a/configure
+++ b/configure
@@ -17892,29 +17892,27 @@ if test "${with_skey-'no'}" = "yes"; then
        blibpath_add="${blibpath_add}:${with_skey}/lib"
     fi
 
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <skey.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+       ac_fn_c_check_header_compile "$LINENO" "skey.h" "ac_cv_header_skey_h" "#include <stdio.h>
+"
+if test "x$ac_cv_header_skey_h" = x""yes; then :
   found=yes
 else
   found=no
 fi
-rm -f conftest.err conftest.$ac_ext
+
+
     else
        found=no
        O_CPPFLAGS="$CPPFLAGS"
        for dir in "" "/usr/local" "/usr/contrib"; do
            test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
-           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <skey.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+           ac_fn_c_check_header_compile "$LINENO" "skey.h" "ac_cv_header_skey_h" "#include <stdio.h>
+"
+if test "x$ac_cv_header_skey_h" = x""yes; then :
   found=yes; break
 fi
-rm -f conftest.err conftest.$ac_ext
+
+
        done
        if test "$found" = "no" -o -z "$dir"; then
            CPPFLAGS="$O_CPPFLAGS"
@@ -18033,6 +18031,38 @@ if test "x$ac_cv_lib_skey_skeyaccess" = x""yes; then :
 
 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"
     SUDOERS_LIBS="${SUDOERS_LIBS} -lskey"
     AUTH_OBJS="$AUTH_OBJS rfc1938.lo"
@@ -21369,5 +21399,6 @@ fi
 
 
 
+
 
 
index f6497e614ed91d0d871e1a5c8cf7231ab6decbfa..85f6a614f3a2a720e22a8ae409e5c0c8b5fa65ac 100644 (file)
@@ -2585,13 +2585,14 @@ if test "${with_skey-'no'}" = "yes"; then
        CPPFLAGS="${CPPFLAGS} -I${with_skey}/include"
        SUDO_APPEND_LIBPATH(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
        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"
@@ -2605,6 +2606,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 SUDOERS_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"
     SUDOERS_LIBS="${SUDOERS_LIBS} -lskey"
     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_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])
index 95069884cca0b8d10ae4de34436ca6dac5f29be7..846b7b23bff3db627ff4f993bd6a0e0e2a5a2826 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))