2011-04-23 08:58:57 +02:00
|
|
|
{ stdenv, fetchurl, openssl, sslEnable ? false, libcap, pam }:
|
2005-09-12 17:20:57 +02:00
|
|
|
|
2013-11-07 16:14:59 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2015-07-28 13:11:25 +02:00
|
|
|
name = "vsftpd-3.0.3";
|
2013-11-07 16:14:59 +01:00
|
|
|
|
2005-09-12 17:20:57 +02:00
|
|
|
src = fetchurl {
|
2012-12-29 12:22:20 +01:00
|
|
|
url = "https://security.appspot.com/downloads/${name}.tar.gz";
|
2015-07-28 13:11:25 +02:00
|
|
|
sha256 = "1xsyjn68k3fgm2incpb3lz2nikffl9by2safp994i272wvv2nkcx";
|
2005-09-12 17:20:57 +02:00
|
|
|
};
|
2011-04-29 20:18:56 +02:00
|
|
|
|
2015-07-15 22:12:29 +02:00
|
|
|
patches = [ ./CVE-2015-1419.patch ];
|
|
|
|
|
2013-11-07 16:14:59 +01:00
|
|
|
preConfigure = stdenv.lib.optionalString sslEnable ''
|
|
|
|
echo "Will enable SSL"
|
|
|
|
sed -i "/VSF_BUILD_SSL/s/^#undef/#define/" builddefs.h
|
|
|
|
'';
|
|
|
|
|
2011-04-29 20:18:56 +02:00
|
|
|
# The gcc-wrappers use -idirafter for glibc, and vsftpd also, and
|
|
|
|
# their dummyinc come before those of glibc, then the build works bad.
|
|
|
|
prePatch = ''
|
|
|
|
sed -i -e 's/-idirafter.*//' Makefile
|
|
|
|
'';
|
2013-11-07 16:14:59 +01:00
|
|
|
|
|
|
|
preBuild =
|
|
|
|
let
|
|
|
|
sslLibs = if sslEnable then "-lcrypt -lssl -lcrypto" else "";
|
2013-01-03 19:52:14 +01:00
|
|
|
in ''
|
2013-11-07 16:14:59 +01:00
|
|
|
makeFlagsArray=( "LIBS=${sslLibs} -lpam -lcap -fstack-protector" )
|
2013-01-03 19:52:14 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
# It won't link without this flag, used in CFLAGS
|
2005-09-12 17:20:57 +02:00
|
|
|
|
2011-04-23 08:58:57 +02:00
|
|
|
buildInputs = [ openssl libcap pam ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -pv $out/sbin
|
|
|
|
install -v -m 755 vsftpd $out/sbin/vsftpd
|
|
|
|
|
|
|
|
mkdir -pv $out/share/man/man{5,8}
|
|
|
|
install -v -m 644 vsftpd.8 $out/share/man/man8/vsftpd.8
|
|
|
|
install -v -m 644 vsftpd.conf.5 $out/share/man/man5/vsftpd.conf.5
|
|
|
|
|
|
|
|
mkdir -pv $out/etc/xinetd.d
|
|
|
|
install -v -m 644 xinetd.d/vsftpd $out/etc/xinetd.d/vsftpd
|
|
|
|
'';
|
2013-11-07 16:14:59 +01:00
|
|
|
}
|