[OpenAFS] samba 3.3.0 fake-kaserver no more working

Gémes Géza geza@kzsdabas.hu
Fri, 30 Jan 2009 11:15:05 +0100


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


> While 3.2.7 (lastest stable samba version) with afs 1.5.57 worked fine.
>
> samba 3.3.0 release is core dumping on afs_login:
>
>   BACKTRACE: 18 stack frames:
>    #0 /opt/samba/sbin/smbd(log_stack_trace+0x2d) [0x802a548c]
>    #1 /opt/samba/sbin/smbd(smb_panic+0x80) [0x802a55c8]
>    #2 /opt/samba/sbin/smbd(iface_count+0) [0x8028fd70]
>    #3 /lib/libpthread.so.0 [0x241619]
>    #4 /lib/libc.so.6 [0x3e8188]
>    #5 /opt/samba/sbin/smbd(realloc_string_sub2+0x61) [0x8029cc2e]
>    #6 /opt/samba/sbin/smbd(realloc_string_sub+0x3b) [0x8029cec0]
>    #7 /opt/samba/sbin/smbd [0x802acc3d]
>    #8 /opt/samba/sbin/smbd(talloc_sub_advanced+0x43) [0x802acdf2]
>    #9 /opt/samba/sbin/smbd(afs_login+0xb3) [0x800e7977]
>    #10 /opt/samba/sbin/smbd [0x800e04b0]
>    #11 /opt/samba/sbin/smbd(make_connection+0x73b) [0x800e10a2]
>    #12 /opt/samba/sbin/smbd(reply_tcon_and_X+0x3e6) [0x800a03cc]
>    #13 /opt/samba/sbin/smbd [0x800db207]
>    #14 /opt/samba/sbin/smbd(smbd_process+0xef4) [0x800dd71b]
>    #15 /opt/samba/sbin/smbd(main+0x222c) [0x804e1920]
>    #16 /lib/libc.so.6(__libc_start_main+0x8d) [0x3d6bc1]
>    #17 /opt/samba/sbin/smbd [0x80063bc2]
> [2009/01/29 13:20:14,  0] lib/fault.c:dump_core(218)
>
> samba team seems not to be very interested in AFS integration.
> samba 3.3.0 AFS integration with fake-kaserver is broken.
>
> Somebody out there to help?
>
> Regards
> Axel
> _______________________________________________
> OpenAFS-info mailing list
> OpenAFS-info@openafs.org
> https://lists.openafs.org/mailman/listinfo/openafs-info
>   
Hi,

First of all I'm surprised 3.2.7's fake-kaserver was working. For 3.2.5
(with openafs 1.4.7) I had to create a patch (attached).
Could that help you at least at finding out what did change.

Regards

Geza


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

diff -urN samba-3.2.5.orig/source/configure samba-3.2.5/source/configure
--- samba-3.2.5.orig/source/configure	2008-12-21 20:55:53.000000000 +0100
+++ samba-3.2.5/source/configure	2008-12-23 07:18:40.000000000 +0100
@@ -53863,12 +53863,88 @@
 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"
+else
+  { { echo "$as_me:$LINENO: error: OpenSSL library: libcrypto ot found!" >&5
+echo "$as_me: error: OpenSSL library: libcrypto ot found!" >&2;}
+   { (exit 1); exit 1; }; }
+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 auth.h param.h prs_fs.h stds.h venus.h afssyscalls.h; do
+           cp -a /usr/include/afs/$f ./include/afs/
+         done
+          echo "#include <afs/param.h>" > ./include/afs/afs.h
+          cat /usr/include/afs/afs.h  >> ./include/afs/afs.h
+         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.5.orig/source/configure.in samba-3.2.5/source/configure.in
--- samba-3.2.5.orig/source/configure.in	2008-12-21 20:55:53.000000000 +0100
+++ samba-3.2.5/source/configure.in	2008-12-23 07:17:48.000000000 +0100
@@ -2941,11 +2941,19 @@
 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" , [AC_ERROR(OpenSSL library: libcrypto ot found!)] )
+
     # 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 auth.h param.h prs_fs.h stds.h venus.h afssyscalls.h; do
+           cp -a /usr/include/afs/$f ./include/afs/
+         done
+          echo "#include <afs/param.h>" > ./include/afs/afs.h
+          cat /usr/include/afs/afs.h  >> ./include/afs/afs.h
+         CFLAGS="$CFLAGS -Iinclude/afs"
+          CPPFLAGS="$CPPFLAGS -Iinclude/afs"
           AC_MSG_RESULT(yes)
     else
       AC_MSG_RESULT(no)
diff -urN samba-3.2.5.orig/source/lib/afs.c samba-3.2.5/source/lib/afs.c
--- samba-3.2.5.orig/source/lib/afs.c	2008-12-21 20:55:53.000000000 +0100
+++ samba-3.2.5/source/lib/afs.c	2008-12-23 07:27:15.000000000 +0100
@@ -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.5.orig/source/lib/afs_settoken.c samba-3.2.5/source/lib/afs_settoken.c
--- samba-3.2.5.orig/source/lib/afs_settoken.c	2008-12-21 20:55:53.000000000 +0100
+++ samba-3.2.5/source/lib/afs_settoken.c	2008-12-23 07:36:56.000000000 +0100
@@ -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>
@@ -37,7 +38,24 @@
 	  char * cmarg,
 	  int follow)
 {
+/*
 	return( syscall( SYS_afs_syscall, subcall, path, cmd, cmarg, follow));
+*/
+        int errcode;
+        struct afsprocdata afs_syscall_data;
+        afs_syscall_data.syscall = subcall;
+        afs_syscall_data.param1 = (long)path;
+        afs_syscall_data.param2 = cmd;
+        afs_syscall_data.param3 = (long)cmarg;
+        afs_syscall_data.param4 = follow;
+        int proc_afs_file = open(PROC_SYSCALL_FNAME, O_RDWR);
+        if (proc_afs_file < 0)
+            proc_afs_file = open(PROC_SYSCALL_ARLA_FNAME, O_RDWR);
+        if (proc_afs_file < 0)
+            return -1;
+        errcode = ioctl(proc_afs_file, VIOC_SYSCALL, &afs_syscall_data);
+        close(proc_afs_file);
+        return errcode;
 }
 
 struct ClearToken {

--------------040809070003000302050903--