[OpenAFS] Re: How do you resolve the problem with DES

Gémes Géza geza@kzsdabas.hu
Wed, 01 Oct 2008 20:08:45 +0200


This is a multi-part message in MIME format.
--------------090506030608030403090901
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

pentruinregistrare@gmail.com írta:
> I  install  libssl-dev 0.9.8c-4etch3, libopenafs-dev 1.4.2-6etch1 and try compile samba-3.2.4 after configure --with-fake-kaserver --with-vfs-afsacl but in "make" process I received that:
>
> "lib/afs.o: In function `afs_createtoken':
> afs.c:(.text+0x2b7): undefined reference to `DES_key_sched'
> afs.c:(.text+0x2e9): undefined reference to `DES_pcbc_encrypt'
> collect2: ld returned 1 exit status
> make: *** [bin/smbd] Error 1"
>
> Witch file or files exactly I must modify to correct that problem?
> Thanks in advance 
>
>
>   
Apply the attached patch, it is bug id 5799 in samba bugzilla.
But please note, that while it fixes the compile problem, it doesn't
make the fake-kaserver part functional :-(  (yet ), because in
source/lib/afs_settoken.c there is a deprecated openafs syscall, now I
try to figure out how could I rewrite it.

Cheers

Geza

--------------090506030608030403090901
Content-Type: text/x-patch;
 name="afs.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="afs.patch"

diff -urN samba-3.2.3.orig/source/configure samba-3.2.3/source/configure
--- samba-3.2.3.orig/source/configure	2008-09-26 21:01:25.120601000 +0200
+++ samba-3.2.3/source/configure	2008-09-26 21:10:56.595590574 +0200
@@ -53356,12 +53356,82 @@
 if test x"$samba_cv_WITH_AFS" != x"no" ||
    test x"$samba_cv_WITH_FAKE_KASERVER" != x"no"; then
 
+   { echo "$as_me:$LINENO: checking for DES_pcbc_encrypt in -lcrypto" >&5
+echo $ECHO_N "checking for DES_pcbc_encrypt in -lcrypto... $ECHO_C" >&6; }
+if test "${ac_cv_lib_crypto_DES_pcbc_encrypt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypto  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char DES_pcbc_encrypt ();
+int
+main ()
+{
+return DES_pcbc_encrypt ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_crypto_DES_pcbc_encrypt=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_crypto_DES_pcbc_encrypt=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_DES_pcbc_encrypt" >&5
+echo "${ECHO_T}$ac_cv_lib_crypto_DES_pcbc_encrypt" >&6; }
+if test $ac_cv_lib_crypto_DES_pcbc_encrypt = yes; then
+  LIBS="$LIBS -lcrypto"
+fi
+
+
     # see if this box has the afs-headers in /usr/include/afs
     { echo "$as_me:$LINENO: checking for /usr/include/afs" >&5
 echo $ECHO_N "checking for /usr/include/afs... $ECHO_C" >&6; }
     if test -d /usr/include/afs; then
-          CFLAGS="$CFLAGS -I/usr/include/afs"
-          CPPFLAGS="$CPPFLAGS -I/usr/include/afs"
+	  mkdir -p ./include/afs
+          for f in afs.h auth.h param.h prs_fs.h stds.h venus.h ; do
+	    cp -a /usr/include/afs/$f ./iclude/afs/
+	  done
+	  CFLAGS="$CFLAGS -Iinclude/afs"
+          CPPFLAGS="$CPPFLAGS -Iinclude/afs"
           { echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6; }
     else
diff -urN samba-3.2.3.orig/source/configure.in samba-3.2.3/source/configure.in
--- samba-3.2.3.orig/source/configure.in	2008-09-26 21:01:27.208591000 +0200
+++ samba-3.2.3/source/configure.in	2008-09-26 21:10:07.023786290 +0200
@@ -2834,11 +2834,17 @@
 if test x"$samba_cv_WITH_AFS" != x"no" ||
    test x"$samba_cv_WITH_FAKE_KASERVER" != x"no"; then
 
+   AC_CHECK_LIB( crypto, DES_pcbc_encrypt, LIBS="$LIBS -lcrypto" )
+
     # see if this box has the afs-headers in /usr/include/afs
     AC_MSG_CHECKING(for /usr/include/afs)
     if test -d /usr/include/afs; then
-          CFLAGS="$CFLAGS -I/usr/include/afs"
-          CPPFLAGS="$CPPFLAGS -I/usr/include/afs"
+	  mkdir -p ./include/afs
+          for f in afs.h auth.h param.h prs_fs.h stds.h venus.h ; do
+	    cp -a /usr/include/afs/$f ./iclude/afs/
+	  done
+	  CFLAGS="$CFLAGS -Iinclude/afs"
+          CPPFLAGS="$CPPFLAGS -Iinclude/afs"
           AC_MSG_RESULT(yes)
     else
       AC_MSG_RESULT(no)
diff -urN samba-3.2.3.orig/source/lib/afs.c samba-3.2.3/source/lib/afs.c
--- samba-3.2.3.orig/source/lib/afs.c	2008-09-26 21:01:22.943600000 +0200
+++ samba-3.2.3/source/lib/afs.c	2008-09-28 18:07:11.986286809 +0200
@@ -23,6 +23,7 @@
 
 #define NO_ASN1_TYPEDEFS 1
 
+#include <afs/param.h>
 #include <afs/stds.h>
 #include <afs/afs.h>
 #include <afs/auth.h>
diff -urN samba-3.2.3.orig/source/lib/afs_settoken.c samba-3.2.3/source/lib/afs_settoken.c
--- samba-3.2.3.orig/source/lib/afs_settoken.c	2008-09-22 18:51:18.683589000 +0200
+++ samba-3.2.3/source/lib/afs_settoken.c	2008-09-26 21:14:26.275582872 +0200
@@ -23,6 +23,7 @@
 
 #define NO_ASN1_TYPEDEFS 1
 
+#include <afs/param.h>
 #include <afs/stds.h>
 #include <afs/afs.h>
 #include <afs/auth.h>
diff -urN samba-3.2.3.orig/source/modules/vfs_afsacl.c samba-3.2.3/source/modules/vfs_afsacl.c
--- samba-3.2.3.orig/source/modules/vfs_afsacl.c	2008-08-27 13:23:20.000000000 +0200
+++ samba-3.2.3/source/modules/vfs_afsacl.c	2008-09-26 21:15:08.956586527 +0200
@@ -22,6 +22,7 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
 
+#include <afs/param.h>
 #include <afs/stds.h>
 #include <afs/afs.h>
 #include <afs/auth.h>

--------------090506030608030403090901--