Search code examples
clinuxftpmakefilevsftpd

Compiling vsftpd 3.0.0 is failing


I recently tried to compile vsftpd 3.0.0 but it fails due the following compile error:

gcc -c seccompsandbox.c -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wall -W -               Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE=2  -idirafter dummyinc
seccompsandbox.c:63: error: ‘O_DIRECTORY’ undeclared here (not in a function)
seccompsandbox.c:63: error: ‘O_CLOEXEC’ undeclared here (not in a function)
make: *** [seccompsandbox.o] Error 1

As I'm not very familar with the source and the environment I have no idea how to fix this. I imagine that it has something to do with the new seccomp filter sandbox. A Search on google showed me that the error is reproducible but no solution was submitted.

My linux kernel version is 2.6.32-5-amd64 and I'm using gcc version 4.4.5 (Debian 4.4.5-8)

Any ideas welcome. (If you need additional information's don't hesitate to ask)


Solution

  • At least on Debian O_DIRECTORY and O_CLOEXEC are defined only if _GNU_SOURCE is defined.

    Although _GNU_SOURCE is set for certain modules in the current vsftp release it is not set generally.

    As a work around you might use the following patch:

    diff -Naur vsftpd-3.0.0.orig/seccompsandbox.c vsftpd-3.0.0/seccompsandbox.c
    --- vsftpd-3.0.0.orig/seccompsandbox.c       2012-04-05 00:41:51.000000000 +0200
    +++ vsftpd-3.0.0/seccompsandbox.c  2012-06-30 15:25:52.000000000 +0200
    @@ -11,7 +11,7 @@
     #include "seccompsandbox.h"
    
     #if defined(__linux__) && defined(__x86_64__)
    -
    +#define _GNU_SOURCE
     #include "session.h"
     #include "sysutil.h"
     #include "tunables.h
    

    Disclaimer: Applying this patch makes the current vsftp release compile, I have now clue wether the created binaries work correctly or not.