samba-technical@lists.samba.org
[Top] [All Lists]

Bugs 5799 and 6316 (Samba and AFS)

Subject: Bugs 5799 and 6316 Samba and AFS
From: Gémes Géza
Date: Sun, 03 May 2009 08:44:59 +0200
Hi Samba developers,

I've submitted a patch to fix bug #5799 to bugzilla the patch is
non-intrusive and has no effect if none of the afs related configure
options are enabled. I've used it (the patched version with
fake-kaserver and vfs-afsacl) in production without side effects for
more than two months.
Please apply it to future releases int the 3.2 branch.

As a related note I've changed the aforementioned patch to work with the
3.3 branch as well (reported bug #6316) unfortunately due to a bugzilla
error I couldn't submit the patch yet. It is attached. I havn't tested
it as well as the previous one, but the difference between them is just
related to the changes introduced in the connection_struct structure.
Please apply it to the 3.3 branch.

Currently checking the attached patch against samba-3.4.0pre1.

Cheers

Geza
diff -ur samba-3.3.4.orig/source/configure.in samba-3.3.4/source/configure.in
--- samba-3.3.4.orig/source/configure.in        2009-05-02 12:17:58.000000000 
+0200
+++ samba-3.3.4/source/configure.in     2009-05-02 13:06:03.000000000 +0200
@@ -3099,13 +3099,22 @@
 # decide whether we can support WITH_AFS and / or WITH_FAKE_KASERVER
 if test x"$samba_cv_WITH_AFS" != x"no" ||
    test x"$samba_cv_WITH_FAKE_KASERVER" != x"no"; then
+ 
+    # see if this box has the OpenSSL DES libraries 
+    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"
-          AC_MSG_RESULT(yes)
+       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)
     fi
diff -ur samba-3.3.4.orig/source/lib/afs.c samba-3.3.4/source/lib/afs.c
--- samba-3.3.4.orig/source/lib/afs.c   2009-05-02 12:17:58.000000000 +0200
+++ samba-3.3.4/source/lib/afs.c        2009-05-02 15:23:22.000000000 +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>
@@ -230,8 +231,8 @@
        }
 
        afs_username = talloc_sub_advanced(ctx,
-                               SNUM(conn), conn->user,
-                               conn->connectpath, conn->gid,
+                               SNUM(conn), conn->server_info->unix_name,
+                               conn->connectpath, conn->server_info->utok.gid,
                                conn->server_info->sanitized_username,
                                pdb_get_domain(conn->server_info->sam_account),
                                afs_username);
diff -ur samba-3.3.4.orig/source/lib/afs_settoken.c 
samba-3.3.4/source/lib/afs_settoken.c
--- samba-3.3.4.orig/source/lib/afs_settoken.c  2009-05-02 12:17:58.000000000 
+0200
+++ samba-3.3.4/source/lib/afs_settoken.c       2009-05-02 12:25:36.000000000 
+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>
@@ -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 {
<Prev in Thread] Current Thread [Next in Thread>