On 10/19/06, Jim Gifford <[EMAIL PROTECTED]> wrote:
I actually talked with the Linux MIPS guys and they gave me some ideas,
I came up with this patch and so far it seems to do the job.

http://svn.cross-lfs.org/svn/repos/patches/vsftpd/vsftpd-2.0.5-syscall-1.patch

Interesting. I did a bit of googling, and it seems the real fix is to
use the syscall() interface from glibc. Here are a couple examples
from LKML a while back:

http://lkml.org/lkml/2001/2/20/195
http://lkml.org/lkml/2006/9/20/169

Testing out my minimal C skills, I came up with the attached patch. It
built for me, but I don't have a system with the new headers to test
against. YMMV.

--
Dan
diff -pNur vsftpd-2.0.5.orig/sysdeputil.c vsftpd-2.0.5/sysdeputil.c
--- vsftpd-2.0.5.orig/sysdeputil.c	2006-07-02 15:14:10.000000000 -0700
+++ vsftpd-2.0.5/sysdeputil.c	2006-10-19 23:17:21.000000000 -0700
@@ -155,14 +155,10 @@
 #include <sys/capability.h>
 
 #if defined(VSF_SYSDEP_HAVE_CAPABILITIES) && !defined(VSF_SYSDEP_HAVE_LIBCAP)
-#include <linux/unistd.h>
 #include <linux/capability.h>
 #include <errno.h>
-#include <syscall.h>
-_syscall2(int, capset, cap_user_header_t, header, const cap_user_data_t, data)
-/* Gross HACK to avoid warnings - linux headers overlap glibc headers */
-#undef __NFDBITS
-#undef __FDMASK
+#include <sys/syscall.h>
+#include <unistd.h>
 #endif /* VSF_SYSDEP_HAVE_CAPABILITIES */
 
 #if defined(VSF_SYSDEP_HAVE_LINUX_SENDFILE) || \
@@ -513,7 +509,7 @@ static int
 do_checkcap(void)
 {
   /* EFAULT (EINVAL if page 0 mapped) vs. ENOSYS */
-  int retval = capset(0, 0);
+  int retval = syscall(SYS_capset, 0, 0);
   if (!vsf_sysutil_retval_is_error(retval) ||
       vsf_sysutil_get_error() != kVSFSysUtilErrNOSYS)
   {
@@ -548,7 +544,7 @@ vsf_sysdep_adopt_capabilities(unsigned i
   }
   cap_data.effective = cap_data.permitted = cap_mask;
   cap_data.inheritable = 0;
-  retval = capset(&cap_head, &cap_data);
+  retval = syscall(SYS_capset, &cap_head, &cap_data);
   if (retval != 0)
   {
     die("capset");
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to