summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-ftp/vsftpd
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-ftp/vsftpd')
-rw-r--r--net-ftp/vsftpd/Manifest2
-rw-r--r--net-ftp/vsftpd/files/vsftpd-2.1.0-caps.patch15
-rw-r--r--net-ftp/vsftpd/files/vsftpd-2.2.0-dont-link-caps.patch21
-rw-r--r--net-ftp/vsftpd/files/vsftpd-2.2.0-gentoo.patch264
-rw-r--r--net-ftp/vsftpd/files/vsftpd-2.3.2-as-needed.patch13
-rw-r--r--net-ftp/vsftpd/files/vsftpd-2.3.2-kerberos.patch20
-rw-r--r--net-ftp/vsftpd/files/vsftpd-2.3.5-gentoo.patch207
-rw-r--r--net-ftp/vsftpd/files/vsftpd-3.0.0-Makefile.patch34
-rw-r--r--net-ftp/vsftpd/files/vsftpd-3.0.2-alpha.patch16
-rw-r--r--net-ftp/vsftpd/files/vsftpd-3.0.2-aslim.patch13
-rw-r--r--net-ftp/vsftpd/files/vsftpd-3.0.2-remove-legacy-cap.patch57
-rw-r--r--net-ftp/vsftpd/files/vsftpd-checkconfig.sh29
-rw-r--r--net-ftp/vsftpd/files/vsftpd.conf105
-rw-r--r--net-ftp/vsftpd/files/vsftpd.init51
-rw-r--r--net-ftp/vsftpd/files/vsftpd.logrotate4
-rw-r--r--net-ftp/vsftpd/files/vsftpd.service11
-rw-r--r--net-ftp/vsftpd/files/vsftpd.socket9
-rw-r--r--net-ftp/vsftpd/files/vsftpd.xinetd15
-rw-r--r--net-ftp/vsftpd/files/vsftpd_at.service10
-rw-r--r--net-ftp/vsftpd/metadata.xml23
-rw-r--r--net-ftp/vsftpd/vsftpd-2.3.5.ebuild115
-rw-r--r--net-ftp/vsftpd/vsftpd-3.0.2-r1.ebuild122
-rw-r--r--net-ftp/vsftpd/vsftpd-3.0.2-r2.ebuild132
-rw-r--r--net-ftp/vsftpd/vsftpd-3.0.2-r3.ebuild135
-rw-r--r--net-ftp/vsftpd/vsftpd-3.0.2-r4.ebuild135
-rw-r--r--net-ftp/vsftpd/vsftpd-3.0.2.ebuild118
26 files changed, 1676 insertions, 0 deletions
diff --git a/net-ftp/vsftpd/Manifest b/net-ftp/vsftpd/Manifest
new file mode 100644
index 000000000000..a455d558d2ec
--- /dev/null
+++ b/net-ftp/vsftpd/Manifest
@@ -0,0 +1,2 @@
+DIST vsftpd-2.3.5.tar.gz 187691 SHA256 d87ee2987df8f03e1dbe294905f7907b2798deb89c67ca965f6e2f60879e54f1 SHA512 7d58d601c4a14cf16c074f238d557fd28e080d7573a1257f742e43bf97cff455b6bf083d8e3594cc7f8865f9485b307b692e91c17426c7fed11af9e4b41a0643 WHIRLPOOL 2dba4ae125bbd66522f58ce4ffc9d5be8ea2a84876fe6751593b82aa2c3e5fe1e1ed076c1c09268054f7ea6831683a2be0dd4e269e321d572d859d0ae2535406
+DIST vsftpd-3.0.2.tar.gz 192808 SHA256 be46f0e2c5528fe021fafc8dab1ecfea0c1f183063a06977f8537fcd0b195e56 SHA512 d5b978e07d8b0a623b79a531824666fb9b970ad5989a8c34c21b545b62ba07cde4bfe3d77b40a8b6e92d17890c37cae209231af8f106da3404f6548e217bd023 WHIRLPOOL 7a74ab478880d021f7a82ffc6ec3989617003234e30d97063760bc06baeee2ab207861b440896b926b95eed7b3d902ab96c05c1bbd23d494d9ff168f98d3404a
diff --git a/net-ftp/vsftpd/files/vsftpd-2.1.0-caps.patch b/net-ftp/vsftpd/files/vsftpd-2.1.0-caps.patch
new file mode 100644
index 000000000000..bd29762e9f48
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-2.1.0-caps.patch
@@ -0,0 +1,15 @@
+diff -ur vsftpd-2.1.0.orig/sysdeputil.c vsftpd-2.1.0/sysdeputil.c
+--- vsftpd-2.1.0.orig/sysdeputil.c 2009-02-23 18:23:26.000000000 +0100
++++ vsftpd-2.1.0/sysdeputil.c 2009-02-23 18:23:51.000000000 +0100
+@@ -160,10 +160,8 @@
+ #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>
++#include <sys/syscall.h>
+ int capset(cap_user_header_t header, const cap_user_data_t data)
+ {
+ return syscall(__NR_capset, header, data);
diff --git a/net-ftp/vsftpd/files/vsftpd-2.2.0-dont-link-caps.patch b/net-ftp/vsftpd/files/vsftpd-2.2.0-dont-link-caps.patch
new file mode 100644
index 000000000000..debcf06279e3
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-2.2.0-dont-link-caps.patch
@@ -0,0 +1,21 @@
+diff -ur vsftpd-2.2.0.orig/vsf_findlibs.sh vsftpd-2.2.0/vsf_findlibs.sh
+--- vsftpd-2.2.0.orig/vsf_findlibs.sh 2009-08-23 22:15:39.000000000 -0700
++++ vsftpd-2.2.0/vsf_findlibs.sh 2009-08-23 22:16:31.000000000 -0700
+@@ -44,17 +44,6 @@
+ # For older HP-UX...
+ locate_library /usr/lib/libsec.sl && echo "-lsec";
+
+-# Look for libcap (capabilities)
+-if locate_library /lib/libcap.so.1; then
+- echo "/lib/libcap.so.1";
+-elif locate_library /lib/libcap.so.2; then
+- echo "/lib/libcap.so.2";
+-else
+- locate_library /usr/lib/libcap.so && echo "-lcap";
+- locate_library /lib/libcap.so && echo "-lcap";
+- locate_library /lib64/libcap.so && echo "-lcap";
+-fi
+-
+ # Solaris needs this for nanosleep()..
+ locate_library /lib/libposix4.so && echo "-lposix4";
+ locate_library /usr/lib/libposix4.so && echo "-lposix4";
diff --git a/net-ftp/vsftpd/files/vsftpd-2.2.0-gentoo.patch b/net-ftp/vsftpd/files/vsftpd-2.2.0-gentoo.patch
new file mode 100644
index 000000000000..353dff3417a7
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-2.2.0-gentoo.patch
@@ -0,0 +1,264 @@
+diff -NrU5 vsftpd-2.2.0.original/defs.h vsftpd-2.2.0/defs.h
+--- vsftpd-2.2.0.original/defs.h 2009-08-23 15:23:00.000000000 -0600
++++ vsftpd-2.2.0/defs.h 2009-08-23 16:01:20.000000000 -0600
+@@ -1,9 +1,9 @@
+ #ifndef VSF_DEFS_H
+ #define VSF_DEFS_H
+
+-#define VSFTP_DEFAULT_CONFIG "/etc/vsftpd.conf"
++#define VSFTP_DEFAULT_CONFIG "/etc/vsftpd/vsftpd.conf"
+
+ #define VSFTP_COMMAND_FD 0
+
+ #define VSFTP_PASSWORD_MAX 128
+ #define VSFTP_USERNAME_MAX 128
+diff -NrU5 vsftpd-2.2.0.original/tunables.c vsftpd-2.2.0/tunables.c
+--- vsftpd-2.2.0.original/tunables.c 2009-08-23 15:23:00.000000000 -0600
++++ vsftpd-2.2.0/tunables.c 2009-08-23 16:00:14.000000000 -0600
+@@ -244,23 +244,23 @@
+ tunable_delay_successful_login = 0;
+ tunable_max_login_fails = 3;
+ /* -rw------- */
+ tunable_chown_upload_mode = 0600;
+
+- install_str_setting("/usr/share/empty", &tunable_secure_chroot_dir);
++ install_str_setting("/usr/share/vsftpd/empty", &tunable_secure_chroot_dir);
+ install_str_setting("ftp", &tunable_ftp_username);
+ install_str_setting("root", &tunable_chown_username);
+ install_str_setting("/var/log/xferlog", &tunable_xferlog_file);
+ install_str_setting("/var/log/vsftpd.log", &tunable_vsftpd_log_file);
+ install_str_setting(".message", &tunable_message_file);
+ install_str_setting("nobody", &tunable_nopriv_user);
+ install_str_setting(0, &tunable_ftpd_banner);
+- install_str_setting("/etc/vsftpd.banned_emails", &tunable_banned_email_file);
+- install_str_setting("/etc/vsftpd.chroot_list", &tunable_chroot_list_file);
++ install_str_setting("/etc/vsftpd/banned_emails", &tunable_banned_email_file);
++ install_str_setting("/etc/vsftpd/chroot_list", &tunable_chroot_list_file);
+ install_str_setting("ftp", &tunable_pam_service_name);
+ install_str_setting("ftp", &tunable_guest_username);
+- install_str_setting("/etc/vsftpd.user_list", &tunable_userlist_file);
++ install_str_setting("/etc/vsftpd/user_list", &tunable_userlist_file);
+ install_str_setting(0, &tunable_anon_root);
+ install_str_setting(0, &tunable_local_root);
+ install_str_setting(0, &tunable_banner_file);
+ install_str_setting(0, &tunable_pasv_address);
+ install_str_setting(0, &tunable_listen_address);
+@@ -269,11 +269,11 @@
+ install_str_setting(0, &tunable_cmds_allowed);
+ install_str_setting(0, &tunable_cmds_denied);
+ install_str_setting(0, &tunable_hide_file);
+ install_str_setting(0, &tunable_deny_file);
+ install_str_setting(0, &tunable_user_sub_token);
+- install_str_setting("/etc/vsftpd.email_passwords",
++ install_str_setting("/etc/vsftpd/email_passwords",
+ &tunable_email_password_file);
+ install_str_setting("/usr/share/ssl/certs/vsftpd.pem",
+ &tunable_rsa_cert_file);
+ install_str_setting(0, &tunable_dsa_cert_file);
+ install_str_setting("DES-CBC3-SHA", &tunable_ssl_ciphers);
+diff -NrU5 vsftpd-2.2.0.original/vsftpd.8 vsftpd-2.2.0/vsftpd.8
+--- vsftpd-2.2.0.original/vsftpd.8 2009-08-23 15:23:00.000000000 -0600
++++ vsftpd-2.2.0/vsftpd.8 2009-08-23 16:10:03.000000000 -0600
+@@ -19,11 +19,11 @@
+ Alternatively, vsftpd can be launched in standalone mode, in which case vsftpd
+ itself will listen on the network. This latter mode is easier to use, and
+ recommended. It is activated by setting
+ .Pa listen=YES
+ in
+-.Pa /etc/vsftpd.conf .
++.Pa /etc/vsftpd/vsftpd.conf .
+ Direct execution of the
+ .Nm vsftpd
+ binary will then launch the FTP service ready for immediate client connections.
+ .Sh OPTIONS
+ An optional
+@@ -31,11 +31,11 @@
+ may be given on the command line. These files must be owned as root if running
+ as root. Any command line option not starting with a "-" character is treated
+ as a config file that will be loaded. Note that config files are loaded in the
+ strict order that they are encountered on the command line.
+ If no config files are specified, the default configuration file of
+-.Pa /etc/vsftpd.conf
++.Pa /etc/vsftpd/vsftpd.conf
+ will be loaded, after all other command line options are processed.
+ .Pp
+ Supported options are:
+ .Bl -tag -width Ds
+ .It Fl v
+@@ -45,16 +45,16 @@
+ -o options are supported, and they are applied in strict order relative to
+ their appearance on the command line, including intermingling with loading of
+ config files.
+ .El
+ .Sh EXAMPLES
+-vsftpd -olisten=NO /etc/vsftpd.conf -oftpd_banner=blah
++vsftpd -olisten=NO /etc/vsftpd/vsftpd.conf -oftpd_banner=blah
+ .Pp
+ That example overrides vsftpd's built-in default for the "listen" option to be
+-NO, but then loads /etc/vsftpd.conf which may override that setting. Finally,
++NO, but then loads /etc/vsftpd/vsftpd.conf which may override that setting. Finally,
+ the "ftpd_banner" setting is set to "blah", which overrides any default vsftpd
+ setting and any identical setting that was in the config file.
+ .Sh FILES
+-.Pa /etc/vsftpd.conf
++.Pa /etc/vsftpd/vsftpd.conf
+ .Sh SEE ALSO
+ .Xr vsftpd.conf 5
+ .end
+diff -NrU5 vsftpd-2.2.0.original/vsftpd.conf vsftpd-2.2.0/vsftpd.conf
+--- vsftpd-2.2.0.original/vsftpd.conf 2009-08-23 15:23:00.000000000 -0600
++++ vsftpd-2.2.0/vsftpd.conf 2009-08-23 15:35:03.000000000 -0600
+@@ -1,6 +1,6 @@
+-# Example config file /etc/vsftpd.conf
++# Example config file /etc/vsftpd/vsftpd.conf
+ #
+ # The default compiled in settings are fairly paranoid. This sample file
+ # loosens things up a bit, to make the ftp daemon more usable.
+ # Please see vsftpd.conf.5 for all compiled in defaults.
+ #
+@@ -85,19 +85,19 @@
+ #
+ # You may specify a file of disallowed anonymous e-mail addresses. Apparently
+ # useful for combatting certain DoS attacks.
+ #deny_email_enable=YES
+ # (default follows)
+-#banned_email_file=/etc/vsftpd.banned_emails
++#banned_email_file=/etc/vsftpd/banned_emails
+ #
+ # You may specify an explicit list of local users to chroot() to their home
+ # directory. If chroot_local_user is YES, then this list becomes a list of
+ # users to NOT chroot().
+ #chroot_local_user=YES
+ #chroot_list_enable=YES
+ # (default follows)
+-#chroot_list_file=/etc/vsftpd.chroot_list
++#chroot_list_file=/etc/vsftpd/chroot_list
+ #
+ # You may activate the "-R" option to the builtin ls. This is disabled by
+ # default to avoid remote users being able to cause excessive I/O on large
+ # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
+ # the presence of the "-R" option, so there is a strong case for enabling it.
+diff -NrU5 vsftpd-2.2.0.original/vsftpd.conf.5 vsftpd-2.2.0/vsftpd.conf.5
+--- vsftpd-2.2.0.original/vsftpd.conf.5 2009-08-23 15:23:00.000000000 -0600
++++ vsftpd-2.2.0/vsftpd.conf.5 2009-08-23 15:49:59.000000000 -0600
+@@ -2,11 +2,11 @@
+ .SH NAME
+ vsftpd.conf \- config file for vsftpd
+ .SH DESCRIPTION
+ vsftpd.conf may be used to control various aspects of vsftpd's behaviour. By
+ default, vsftpd looks for this file at the location
+-.BR /etc/vsftpd.conf .
++.BR /etc/vsftpd/vsftpd.conf .
+ However, you may override this by specifying a command line argument to
+ vsftpd. The command line argument is the pathname of the configuration file
+ for vsftpd. This behaviour is useful because you may wish to use an advanced
+ inetd such as
+ .BR xinetd
+@@ -136,11 +136,11 @@
+ If activated, you may provide a list of local users who are placed in a
+ chroot() jail in their home directory upon login. The meaning is slightly
+ different if chroot_local_user is set to YES. In this case, the list becomes
+ a list of users which are NOT to be placed in a chroot() jail.
+ By default, the file containing this list is
+-/etc/vsftpd.chroot_list, but you may override this with the
++/etc/vsftpd/chroot_list, but you may override this with the
+ .BR chroot_list_file
+ setting.
+
+ Default: NO
+ .TP
+@@ -175,11 +175,11 @@
+ Default: NO
+ .TP
+ .B deny_email_enable
+ If activated, you may provide a list of anonymous password e-mail responses
+ which cause login to be denied. By default, the file containing this list is
+-/etc/vsftpd.banned_emails, but you may override this with the
++/etc/vsftpd/banned_emails, but you may override this with the
+ .BR banned_email_file
+ setting.
+
+ Default: NO
+ .TP
+@@ -431,11 +431,11 @@
+ access to low-security content without needing virtual users. When enabled,
+ anonymous logins are prevented unless the password provided is listed in the
+ file specified by the
+ .BR email_password_file
+ setting. The file format is one password per line, no extra whitespace. The
+-default filename is /etc/vsftpd.email_passwords.
++default filename is /etc/vsftpd/email_passwords.
+
+ Default: NO
+ .TP
+ .B session_support
+ This controls whether vsftpd attempts to maintain sessions for logins. If
+@@ -762,11 +762,11 @@
+ This option is the name of a file containing a list of anonymous e-mail
+ passwords which are not permitted. This file is consulted if the option
+ .BR deny_email_enable
+ is enabled.
+
+-Default: /etc/vsftpd.banned_emails
++Default: /etc/vsftpd/banned_emails
+ .TP
+ .B banner_file
+ This option is the name of a file containing text to display when someone
+ connects to the server. If set, it overrides the banner string provided by
+ the
+@@ -799,11 +799,11 @@
+ is enabled. If the option
+ .BR chroot_local_user
+ is enabled, then the list file becomes a list of users to NOT place in a
+ chroot() jail.
+
+-Default: /etc/vsftpd.chroot_list
++Default: /etc/vsftpd/chroot_list
+ .TP
+ .B cmds_allowed
+ This options specifies a comma separated list of allowed FTP commands (post
+ login. USER, PASS and QUIT and others are always allowed pre-login). Other
+ commands are rejected. This is a powerful method of really locking down an
+@@ -860,11 +860,11 @@
+ .B email_password_file
+ This option can be used to provide an alternate file for usage by the
+ .BR secure_email_list_enable
+ setting.
+
+-Default: /etc/vsftpd.email_passwords
++Default: /etc/vsftpd/email_passwords
+ .TP
+ .B ftp_username
+ This is the name of the user we use for handling anonymous FTP. The home
+ directory of this user is the root of the anonymous FTP area.
+
+@@ -983,14 +983,14 @@
+ This powerful option allows the override of any config option specified in
+ the manual page, on a per-user basis. Usage is simple, and is best illustrated
+ with an example. If you set
+ .BR user_config_dir
+ to be
+-.BR /etc/vsftpd_user_conf
++.BR /etc/vsftpd/user_conf
+ and then log on as the user "chris", then vsftpd will apply the settings in
+ the file
+-.BR /etc/vsftpd_user_conf/chris
++.BR /etc/vsftpd/user_conf/chris
+ for the duration of the session. The format of this file is as detailed in
+ this manual page! PLEASE NOTE that not all settings are effective on a
+ per-user basis. For example, many settings only prior to the user's session
+ being started. Examples of settings which will not affect any behviour on
+ a per-user basis include listen_address, banner_file, max_per_ip, max_clients,
+@@ -1022,11 +1022,11 @@
+ .B userlist_file
+ This option is the name of the file loaded when the
+ .BR userlist_enable
+ option is active.
+
+-Default: /etc/vsftpd.user_list
++Default: /etc/vsftpd/user_list
+ .TP
+ .B vsftpd_log_file
+ This option is the name of the file to which we write the vsftpd style
+ log file. This log is only written if the option
+ .BR xferlog_enable
diff --git a/net-ftp/vsftpd/files/vsftpd-2.3.2-as-needed.patch b/net-ftp/vsftpd/files/vsftpd-2.3.2-as-needed.patch
new file mode 100644
index 000000000000..330026e47e94
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-2.3.2-as-needed.patch
@@ -0,0 +1,13 @@
+Index: vsftpd-2.3.2/Makefile
+===================================================================
+--- vsftpd-2.3.2.orig/Makefile
++++ vsftpd-2.3.2/Makefile
+@@ -21,7 +21,7 @@ OBJS = main.o utility.o prelogin.o ftpcm
+ $(CC) -c $*.c $(CFLAGS) $(IFLAGS)
+
+ vsftpd: $(OBJS)
+- $(CC) -o vsftpd $(OBJS) $(LINK) $(LIBS) $(LDFLAGS)
++ $(CC) -o vsftpd $(LDFLAGS) $(OBJS) $(LINK) $(LIBS)
+
+ install:
+ if [ -x /usr/local/sbin ]; then \
diff --git a/net-ftp/vsftpd/files/vsftpd-2.3.2-kerberos.patch b/net-ftp/vsftpd/files/vsftpd-2.3.2-kerberos.patch
new file mode 100644
index 000000000000..702363ee472b
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-2.3.2-kerberos.patch
@@ -0,0 +1,20 @@
+Index: vsftpd-2.3.2/twoprocess.c
+===================================================================
+--- vsftpd-2.3.2.orig/twoprocess.c
++++ vsftpd-2.3.2/twoprocess.c
+@@ -284,6 +284,7 @@ process_login_req(struct vsf_session* p_
+ {
+ enum EVSFPrivopLoginResult e_login_result = kVSFLoginNull;
+ char cmd;
++ vsf_sysutil_install_null_sighandler(kVSFSysUtilSigCHLD);
+ /* Blocks */
+ cmd = priv_sock_get_cmd(p_sess->parent_fd);
+ if (cmd != PRIV_SOCK_LOGIN)
+@@ -363,7 +364,6 @@ common_do_login(struct vsf_session* p_se
+ int was_anon = anon;
+ const struct mystr* p_orig_user_str = p_user_str;
+ int newpid;
+- vsf_sysutil_install_null_sighandler(kVSFSysUtilSigCHLD);
+ /* Tells the pre-login child all is OK (it may exit in response) */
+ priv_sock_send_result(p_sess->parent_fd, PRIV_SOCK_RESULT_OK);
+ if (!p_sess->control_use_ssl)
diff --git a/net-ftp/vsftpd/files/vsftpd-2.3.5-gentoo.patch b/net-ftp/vsftpd/files/vsftpd-2.3.5-gentoo.patch
new file mode 100644
index 000000000000..7f1af4beb8c7
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-2.3.5-gentoo.patch
@@ -0,0 +1,207 @@
+Index: vsftpd-2.3.5/defs.h
+===================================================================
+--- vsftpd-2.3.5.orig/defs.h
++++ vsftpd-2.3.5/defs.h
+@@ -1,7 +1,7 @@
+ #ifndef VSF_DEFS_H
+ #define VSF_DEFS_H
+
+-#define VSFTP_DEFAULT_CONFIG "/etc/vsftpd.conf"
++#define VSFTP_DEFAULT_CONFIG "/etc/vsftpd/vsftpd.conf"
+
+ #define VSFTP_COMMAND_FD 0
+
+Index: vsftpd-2.3.5/tunables.c
+===================================================================
+--- vsftpd-2.3.5.orig/tunables.c
++++ vsftpd-2.3.5/tunables.c
+@@ -250,7 +250,7 @@ tunables_load_defaults()
+ /* -rw------- */
+ tunable_chown_upload_mode = 0600;
+
+- install_str_setting("/usr/share/empty", &tunable_secure_chroot_dir);
++ install_str_setting("/usr/share/vsftpd/empty", &tunable_secure_chroot_dir);
+ install_str_setting("ftp", &tunable_ftp_username);
+ install_str_setting("root", &tunable_chown_username);
+ install_str_setting("/var/log/xferlog", &tunable_xferlog_file);
+@@ -258,11 +258,11 @@ tunables_load_defaults()
+ install_str_setting(".message", &tunable_message_file);
+ install_str_setting("nobody", &tunable_nopriv_user);
+ install_str_setting(0, &tunable_ftpd_banner);
+- install_str_setting("/etc/vsftpd.banned_emails", &tunable_banned_email_file);
+- install_str_setting("/etc/vsftpd.chroot_list", &tunable_chroot_list_file);
++ install_str_setting("/etc/vsftpd/vsftpd.banned_emails", &tunable_banned_email_file);
++ install_str_setting("/etc/vsftpd/vsftpd.chroot_list", &tunable_chroot_list_file);
+ install_str_setting("ftp", &tunable_pam_service_name);
+ install_str_setting("ftp", &tunable_guest_username);
+- install_str_setting("/etc/vsftpd.user_list", &tunable_userlist_file);
++ install_str_setting("/etc/vsftpd/vsftpd.user_list", &tunable_userlist_file);
+ install_str_setting(0, &tunable_anon_root);
+ install_str_setting(0, &tunable_local_root);
+ install_str_setting(0, &tunable_banner_file);
+@@ -275,7 +275,7 @@ tunables_load_defaults()
+ install_str_setting(0, &tunable_hide_file);
+ install_str_setting(0, &tunable_deny_file);
+ install_str_setting(0, &tunable_user_sub_token);
+- install_str_setting("/etc/vsftpd.email_passwords",
++ install_str_setting("/etc/vsftpd/vsftpd.email_passwords",
+ &tunable_email_password_file);
+ install_str_setting("/usr/share/ssl/certs/vsftpd.pem",
+ &tunable_rsa_cert_file);
+Index: vsftpd-2.3.5/vsftpd.8
+===================================================================
+--- vsftpd-2.3.5.orig/vsftpd.8
++++ vsftpd-2.3.5/vsftpd.8
+@@ -21,7 +21,7 @@ itself will listen on the network. This
+ recommended. It is activated by setting
+ .Pa listen=YES
+ in
+-.Pa /etc/vsftpd.conf .
++.Pa /etc/vsftpd/vsftpd.conf .
+ Direct execution of the
+ .Nm vsftpd
+ binary will then launch the FTP service ready for immediate client connections.
+@@ -33,7 +33,7 @@ as root. Any command line option not sta
+ as a config file that will be loaded. Note that config files are loaded in the
+ strict order that they are encountered on the command line.
+ If no config files are specified, the default configuration file of
+-.Pa /etc/vsftpd.conf
++.Pa /etc/vsftpd/vsftpd.conf
+ will be loaded, after all other command line options are processed.
+ .Pp
+ Supported options are:
+@@ -47,14 +47,14 @@ their appearance on the command line, in
+ config files.
+ .El
+ .Sh EXAMPLES
+-vsftpd -olisten=NO /etc/vsftpd.conf -oftpd_banner=blah
++vsftpd -olisten=NO /etc/vsftpd/vsftpd.conf -oftpd_banner=blah
+ .Pp
+ That example overrides vsftpd's built-in default for the "listen" option to be
+-NO, but then loads /etc/vsftpd.conf which may override that setting. Finally,
++NO, but then loads /etc/vsftpd/vsftpd.conf which may override that setting. Finally,
+ the "ftpd_banner" setting is set to "blah", which overrides any default vsftpd
+ setting and any identical setting that was in the config file.
+ .Sh FILES
+-.Pa /etc/vsftpd.conf
++.Pa /etc/vsftpd/vsftpd.conf
+ .Sh SEE ALSO
+ .Xr vsftpd.conf 5
+ .end
+Index: vsftpd-2.3.5/vsftpd.conf
+===================================================================
+--- vsftpd-2.3.5.orig/vsftpd.conf
++++ vsftpd-2.3.5/vsftpd.conf
+@@ -1,4 +1,4 @@
+-# Example config file /etc/vsftpd.conf
++# Example config file /etc/vsftpd/vsftpd.conf
+ #
+ # The default compiled in settings are fairly paranoid. This sample file
+ # loosens things up a bit, to make the ftp daemon more usable.
+@@ -87,7 +87,7 @@ connect_from_port_20=YES
+ # useful for combatting certain DoS attacks.
+ #deny_email_enable=YES
+ # (default follows)
+-#banned_email_file=/etc/vsftpd.banned_emails
++#banned_email_file=/etc/vsftpd/vsftpd.banned_emails
+ #
+ # You may specify an explicit list of local users to chroot() to their home
+ # directory. If chroot_local_user is YES, then this list becomes a list of
+@@ -98,7 +98,7 @@ connect_from_port_20=YES
+ #chroot_local_user=YES
+ #chroot_list_enable=YES
+ # (default follows)
+-#chroot_list_file=/etc/vsftpd.chroot_list
++#chroot_list_file=/etc/vsftpd/vsftpd.chroot_list
+ #
+ # You may activate the "-R" option to the builtin ls. This is disabled by
+ # default to avoid remote users being able to cause excessive I/O on large
+Index: vsftpd-2.3.5/vsftpd.conf.5
+===================================================================
+--- vsftpd-2.3.5.orig/vsftpd.conf.5
++++ vsftpd-2.3.5/vsftpd.conf.5
+@@ -4,7 +4,7 @@ vsftpd.conf \- config file for vsftpd
+ .SH DESCRIPTION
+ vsftpd.conf may be used to control various aspects of vsftpd's behaviour. By
+ default, vsftpd looks for this file at the location
+-.BR /etc/vsftpd.conf .
++.BR /etc/vsftpd/vsftpd.conf .
+ However, you may override this by specifying a command line argument to
+ vsftpd. The command line argument is the pathname of the configuration file
+ for vsftpd. This behaviour is useful because you may wish to use an advanced
+@@ -138,7 +138,7 @@ chroot() jail in their home directory up
+ different if chroot_local_user is set to YES. In this case, the list becomes
+ a list of users which are NOT to be placed in a chroot() jail.
+ By default, the file containing this list is
+-/etc/vsftpd.chroot_list, but you may override this with the
++/etc/vsftpd/vsftpd.chroot_list, but you may override this with the
+ .BR chroot_list_file
+ setting.
+
+@@ -177,7 +177,7 @@ Default: NO
+ .B deny_email_enable
+ If activated, you may provide a list of anonymous password e-mail responses
+ which cause login to be denied. By default, the file containing this list is
+-/etc/vsftpd.banned_emails, but you may override this with the
++/etc/vsftpd/vsftpd.banned_emails, but you may override this with the
+ .BR banned_email_file
+ setting.
+
+@@ -433,7 +433,7 @@ anonymous logins are prevented unless th
+ file specified by the
+ .BR email_password_file
+ setting. The file format is one password per line, no extra whitespace. The
+-default filename is /etc/vsftpd.email_passwords.
++default filename is /etc/vsftpd/vsftpd.email_passwords.
+
+ Default: NO
+ .TP
+@@ -764,7 +764,7 @@ passwords which are not permitted. This
+ .BR deny_email_enable
+ is enabled.
+
+-Default: /etc/vsftpd.banned_emails
++Default: /etc/vsftpd/vsftpd.banned_emails
+ .TP
+ .B banner_file
+ This option is the name of a file containing text to display when someone
+@@ -803,7 +803,7 @@ is enabled. If the option
+ is enabled, then the list file becomes a list of users to NOT place in a
+ chroot() jail.
+
+-Default: /etc/vsftpd.chroot_list
++Default: /etc/vsftpd/vsftpd.chroot_list
+ .TP
+ .B cmds_allowed
+ This options specifies a comma separated list of allowed FTP commands (post
+@@ -864,7 +864,7 @@ This option can be used to provide an al
+ .BR secure_email_list_enable
+ setting.
+
+-Default: /etc/vsftpd.email_passwords
++Default: /etc/vsftpd/vsftpd.email_passwords
+ .TP
+ .B ftp_username
+ This is the name of the user we use for handling anonymous FTP. The home
+@@ -987,10 +987,10 @@ the manual page, on a per-user basis. Us
+ with an example. If you set
+ .BR user_config_dir
+ to be
+-.BR /etc/vsftpd_user_conf
++.BR /etc/vsftpd/vsftpd_user_conf
+ and then log on as the user "chris", then vsftpd will apply the settings in
+ the file
+-.BR /etc/vsftpd_user_conf/chris
++.BR /etc/vsftpd/vsftpd_user_conf/chris
+ for the duration of the session. The format of this file is as detailed in
+ this manual page! PLEASE NOTE that not all settings are effective on a
+ per-user basis. For example, many settings only prior to the user's session
+@@ -1026,7 +1026,7 @@ This option is the name of the file load
+ .BR userlist_enable
+ option is active.
+
+-Default: /etc/vsftpd.user_list
++Default: /etc/vsftpd/vsftpd.user_list
+ .TP
+ .B vsftpd_log_file
+ This option is the name of the file to which we write the vsftpd style
diff --git a/net-ftp/vsftpd/files/vsftpd-3.0.0-Makefile.patch b/net-ftp/vsftpd/files/vsftpd-3.0.0-Makefile.patch
new file mode 100644
index 000000000000..5df3b03f3fa9
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-3.0.0-Makefile.patch
@@ -0,0 +1,34 @@
+Index: vsftpd-3.0.0/Makefile
+===================================================================
+--- vsftpd-3.0.0.orig/Makefile
++++ vsftpd-3.0.0/Makefile
+@@ -1,16 +1,16 @@
+ # Makefile for systems with GNU tools
+-CC = gcc
++CC ?= gcc
+ INSTALL = install
+ IFLAGS = -idirafter dummyinc
+ #CFLAGS = -g
+-CFLAGS = -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 \
+- -Wall -W -Wshadow -Werror -Wformat-security \
++CFLAGS += -fPIE -fstack-protector --param=ssp-buffer-size=4 \
++ -Wall -W -Wshadow -Wformat-security \
+ -D_FORTIFY_SOURCE=2 \
+ #-pedantic -Wconversion
+
+ LIBS = `./vsf_findlibs.sh`
+ LINK =
+-LDFLAGS = -fPIE -pie -Wl,-z,relro -Wl,-z,now
++LDFLAGS += -fPIE -pie -Wl,-z,relro -Wl,-z,now
+
+ OBJS = main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o \
+ tunables.o ftpdataio.o secbuf.o ls.o \
+@@ -26,7 +26,7 @@ OBJS = main.o utility.o prelogin.o ftpcm
+ $(CC) -c $*.c $(CFLAGS) $(IFLAGS)
+
+ vsftpd: $(OBJS)
+- $(CC) -o vsftpd $(OBJS) $(LINK) $(LDFLAGS) $(LIBS)
++ $(CC) -o vsftpd $(LDFLAGS) $(OBJS) $(LINK) $(LDFLAGS) $(LIBS)
+
+ install:
+ if [ -x /usr/local/sbin ]; then \
diff --git a/net-ftp/vsftpd/files/vsftpd-3.0.2-alpha.patch b/net-ftp/vsftpd/files/vsftpd-3.0.2-alpha.patch
new file mode 100644
index 000000000000..2445bb54467c
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-3.0.2-alpha.patch
@@ -0,0 +1,16 @@
+Author: Michael Cree <mcree@orcon.net.nz>
+Description: Fixing FTBFS on alpha (Closes: #656182).
+
+diff -Naurp vsftpd.orig/sysdeputil.c vsftpd/sysdeputil.c
+--- vsftpd.orig/sysdeputil.c 2010-03-26 04:25:33.000000000 +0100
++++ vsftpd/sysdeputil.c 2012-01-21 10:53:37.353802546 +0100
+@@ -81,6 +81,9 @@
+ #include <linux/unistd.h>
+ #include <errno.h>
+ #include <syscall.h>
++ #if defined(__alpha__)
++ #define __NR_getpid __NR_getxpid
++ #endif
+ #endif
+
+ #if defined(__linux__) && !defined(__ia64__) && !defined(__s390__)
diff --git a/net-ftp/vsftpd/files/vsftpd-3.0.2-aslim.patch b/net-ftp/vsftpd/files/vsftpd-3.0.2-aslim.patch
new file mode 100644
index 000000000000..9a8f8ea0e254
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-3.0.2-aslim.patch
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/show_bug.cgi?id=522412
+https://bugzilla.redhat.com/show_bug.cgi?id=913519
+--- a/defs.h 2014-09-13 12:04:15.953079704 +0200
++++ b/defs.h 2014-09-13 12:04:48.677080716 +0200
+@@ -19,7 +19,7 @@
+ /* Must be at least the size of VSFTP_MAX_COMMAND_LINE, VSFTP_DIR_BUFSIZE and
+ VSFTP_DATA_BUFSIZE*2 */
+ #define VSFTP_PRIVSOCK_MAXSTR VSFTP_DATA_BUFSIZE * 2
+-#define VSFTP_AS_LIMIT 100UL * 1024 * 1024
++#define VSFTP_AS_LIMIT 400UL * 1024 * 1024
+
+ #endif /* VSF_DEFS_H */
+
diff --git a/net-ftp/vsftpd/files/vsftpd-3.0.2-remove-legacy-cap.patch b/net-ftp/vsftpd/files/vsftpd-3.0.2-remove-legacy-cap.patch
new file mode 100644
index 000000000000..2401f37c7e88
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-3.0.2-remove-legacy-cap.patch
@@ -0,0 +1,57 @@
+https://bugs.gentoo.org/show_bug.cgi?id=450536
+Patch by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
+
+Probe the preferred version
+--- vsftpd-3.0.2/sysdeputil.c.org 2013-01-05 18:32:13.241288839 +0100
++++ vsftpd-3.0.2/sysdeputil.c 2013-01-05 19:41:53.038148078 +0100
+@@ -561,11 +561,17 @@
+ }
+
+ #ifndef VSF_SYSDEP_HAVE_LIBCAP
++static struct __user_cap_header_struct sys_cap_head;
+ static int
+ do_checkcap(void)
+ {
++ int retval;
++
++ /* Store preferred version in sys_cap_head */
++ vsf_sysutil_memclr(&sys_cap_head, sizeof(sys_cap_head));
+ /* EFAULT (EINVAL if page 0 mapped) vs. ENOSYS */
+- int retval = capset(0, 0);
++ retval = capset(&sys_cap_head, 0);
++
+ if (!vsf_sysutil_retval_is_error(retval) ||
+ vsf_sysutil_get_error() != kVSFSysUtilErrNOSYS)
+ {
+@@ -579,17 +585,13 @@
+ {
+ /* n.b. yes I know I should be using libcap!! */
+ int retval;
+- struct __user_cap_header_struct cap_head;
+- struct __user_cap_data_struct cap_data;
++ struct __user_cap_data_struct cap_data[2];
+ __u32 cap_mask = 0;
+ if (!caps)
+ {
+ bug("asked to adopt no capabilities");
+ }
+- vsf_sysutil_memclr(&cap_head, sizeof(cap_head));
+ vsf_sysutil_memclr(&cap_data, sizeof(cap_data));
+- cap_head.version = _LINUX_CAPABILITY_VERSION;
+- cap_head.pid = 0;
+ if (caps & kCapabilityCAP_CHOWN)
+ {
+ cap_mask |= (1 << CAP_CHOWN);
+@@ -598,9 +600,9 @@
+ {
+ cap_mask |= (1 << CAP_NET_BIND_SERVICE);
+ }
+- cap_data.effective = cap_data.permitted = cap_mask;
+- cap_data.inheritable = 0;
+- retval = capset(&cap_head, &cap_data);
++ cap_data[0].effective = cap_data[0].permitted = cap_mask;
++ cap_data[0].inheritable = 0;
++ retval = capset(&sys_cap_head, &cap_data[0]);
+ if (retval != 0)
+ {
+ die("capset");
diff --git a/net-ftp/vsftpd/files/vsftpd-checkconfig.sh b/net-ftp/vsftpd/files/vsftpd-checkconfig.sh
new file mode 100644
index 000000000000..e1d1e5231b67
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd-checkconfig.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+VSFTPD_CONF="${VSFTPD_CONF:-/etc/vsftpd/vsftpd.conf}"
+
+if [ ! -e ${VSFTPD_CONF} ] ; then
+ echo "Please setup ${VSFTPD_CONF} before starting vsftpd" >&2
+ echo "There are sample configurations in /usr/share/doc/vsftpd" >&2
+ exit 1
+fi
+
+if egrep -iq "^ *background *= *yes" "${VSFTPD_CONF}" ; then
+ echo "${VSFTPD_CONF} must not set background=YES" >&2
+ exit 1
+fi
+
+has_ip=false has_ipv6=false ip_error=true
+egrep -iq "^ *listen *= *yes" "${VSFTPD_CONF}" && has_ip=true
+egrep -iq "^ *listen_ipv6 *= *yes" "${VSFTPD_CONF}" && has_ipv6=true
+if ${has_ip} && ! ${has_ipv6} ; then
+ ip_error=false
+elif ! ${has_ip} && ${has_ipv6} ; then
+ ip_error=false
+fi
+if ${ip_error} ; then
+ echo "${VSFTPD_CONF} must contain listen=YES or listen_ipv6=YES" >&2
+ echo "but not both" >&2
+ exit 1
+fi
+
diff --git a/net-ftp/vsftpd/files/vsftpd.conf b/net-ftp/vsftpd/files/vsftpd.conf
new file mode 100644
index 000000000000..9405a3604e13
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd.conf
@@ -0,0 +1,105 @@
+#
+# Example vsftpd config file
+#
+# See man 5 vsftpd.conf for more information.
+#
+# $Id$
+
+# Enable vsftpd to run as a standalone daemon
+# Comment these two out to run under inetd or xinetd
+background=YES
+listen=YES
+
+# Allow anonymous FTP?
+anonymous_enable=YES
+
+# Uncomment this to allow local users to log in.
+#local_enable=YES
+
+# Uncomment this to enable any form of FTP write command.
+#write_enable=YES
+
+# Default umask for local users is 077. You may wish to change this to 022,
+# if your users expect that (022 is used by most other ftpd's)
+#local_umask=022
+
+# Uncomment this to allow the anonymous FTP user to upload files. This only
+# has an effect if the above global write enable is activated. Also, you will
+# obviously need to create a directory writable by the FTP user.
+#anon_upload_enable=YES
+
+# Uncomment this if you want the anonymous FTP user to be able to create
+# new directories.
+#anon_mkdir_write_enable=YES
+
+# Activate directory messages - messages given to remote users when they
+# go into a certain directory.
+dirmessage_enable=YES
+
+# Make sure PORT transfer connections originate from port 20 (ftp-data).
+connect_from_port_20=YES
+
+# If you want, you can arrange for uploaded anonymous files to be owned by
+# a different user. Note! Using "root" for uploaded files is not
+# recommended!
+#chown_uploads=YES
+#chown_username=whoever
+
+# Activate logging of uploads/downloads.
+xferlog_enable=YES
+
+# If you want, you can have your log file in standard ftpd xferlog format
+#xferlog_std_format=YES
+
+# You may override where the log file goes if you like.
+xferlog_file=/var/log/vsftpd.log
+
+# You may change the default value for timing out an idle session.
+#idle_session_timeout=600
+
+# You may change the default value for timing out a data connection.
+#data_connection_timeout=120
+
+# It is recommended that you define on your system a unique user which the
+# ftp server can use as a totally isolated and unprivileged user.
+nopriv_user=nobody
+
+# Enable this and the server will recognise asynchronous ABOR requests. Not
+# recommended for security (the code is non-trivial). Not enabling it,
+# however, may confuse older FTP clients.
+#async_abor_enable=YES
+
+# By default the server will pretend to allow ASCII mode but in fact ignore
+# the request. Turn on the below options to have the server actually do ASCII
+# mangling on files when in ASCII mode.
+# Beware that turning on ascii_download_enable enables malicious remote parties
+# to consume your I/O resources, by issuing the command "SIZE /big/file" in
+# ASCII mode.
+# These ASCII options are split into upload and download because you may wish
+# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
+# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
+# on the client anyway..
+#ascii_upload_enable=YES
+#ascii_download_enable=YES
+
+# You may fully customise the login banner string:
+#ftpd_banner=Welcome to blah FTP service.
+
+# You may specify a file of disallowed anonymous e-mail addresses. Apparently
+# useful for combatting certain DoS attacks.
+#deny_email_enable=YES
+# (default follows)
+#banned_email_file=/etc/vsftpd/banned_emails
+
+# You may specify an explicit list of local users to chroot() to their home
+# directory. If chroot_local_user is YES, then this list becomes a list of
+# users to NOT chroot().
+#chroot_list_enable=YES
+# (default follows)
+#chroot_list_file=/etc/vsftpd/chroot_list
+
+# You may activate the "-R" option to the builtin ls. This is disabled by
+# default to avoid remote users being able to cause excessive I/O on large
+# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
+# the presence of the "-R" option, so there is a strong case for enabling it.
+#ls_recurse_enable=YES
diff --git a/net-ftp/vsftpd/files/vsftpd.init b/net-ftp/vsftpd/files/vsftpd.init
new file mode 100644
index 000000000000..bba2bb0873b0
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd.init
@@ -0,0 +1,51 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Id$
+
+VSFTPD_NAME=${SVCNAME##*.}
+if [ -n "${VSFTPD_NAME}" -a "${SVCNAME}" != "vsftpd" ]; then
+ VSFTPD_PID="/var/run/vsftpd.${VSFTPD_NAME}.pid"
+ VSFTPD_CONF_DEFAULT="/etc/vsftpd/${VSFTPD_NAME}.conf"
+else
+ VSFTPD_PID="/var/run/vsftpd.pid"
+ VSFTPD_CONF_DEFAULT="/etc/vsftpd/vsftpd.conf"
+fi
+VSFTPD_CONF=${VSFTPD_CONF:-${VSFTPD_CONF_DEFAULT}}
+VSFTPD_EXEC=${VSFTPD_EXEC:-/usr/sbin/vsftpd}
+
+depend() {
+ need net
+ use dns logger
+}
+
+checkconfig() {
+ VSFTPD_CONF="${VSFTPD_CONF}" \
+ /usr/libexec/vsftpd-checkconfig.sh || return 1
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --exec ${VSFTPD_EXEC} \
+ --background --make-pidfile --pidfile "${VSFTPD_PID}" \
+ -- "${VSFTPD_CONF}"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ local retval=0
+ if [ -f ${VSFTPD_PID} ]; then
+ start-stop-daemon --stop --pidfile ${VSFTPD_PID} || retval=1
+ pkill --full ${VSFTPD_CONF}
+ else
+ ewarn "Couldn't find ${VSFTPD_PID} trying to stop using the config filename ${VSFTPD_CONF}"
+ pgrep --full ${VSFTPD_CONF} > ${VSFTPD_PID}
+ start-stop-daemon --stop --pidfile ${VSFTPD_PID} || retval=1
+ pkill --full ${VSFTPD_CONF}
+ fi
+ eend ${retval}
+}
+
+# vim: ts=4
diff --git a/net-ftp/vsftpd/files/vsftpd.logrotate b/net-ftp/vsftpd/files/vsftpd.logrotate
new file mode 100644
index 000000000000..b28a2a42628c
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd.logrotate
@@ -0,0 +1,4 @@
+/var/log/vsftpd*.log {
+ missingok
+ notifempty
+}
diff --git a/net-ftp/vsftpd/files/vsftpd.service b/net-ftp/vsftpd/files/vsftpd.service
new file mode 100644
index 000000000000..1445f2769861
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Vsftpd ftp daemon
+After=network.target
+
+[Service]
+Type=simple
+ExecStartPre=/usr/libexec/vsftpd-checkconfig.sh
+ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-ftp/vsftpd/files/vsftpd.socket b/net-ftp/vsftpd/files/vsftpd.socket
new file mode 100644
index 000000000000..cdc0d337efeb
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd.socket
@@ -0,0 +1,9 @@
+[Unit]
+Conflicts=vsftpd.service
+
+[Socket]
+ListenStream=21
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/net-ftp/vsftpd/files/vsftpd.xinetd b/net-ftp/vsftpd/files/vsftpd.xinetd
new file mode 100644
index 000000000000..1027c1f68b2c
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd.xinetd
@@ -0,0 +1,15 @@
+# default: off
+# description: Vsftpd is an FTP server, designed to be secure.
+# $Id$
+
+service ftp
+{
+ socket_type = stream
+ wait = no
+ user = root
+ server = /usr/sbin/vsftpd
+ server_args = /etc/vsftpd/vsftpd.conf
+ log_on_success += DURATION
+ nice = 10
+ disable = yes
+}
diff --git a/net-ftp/vsftpd/files/vsftpd_at.service b/net-ftp/vsftpd/files/vsftpd_at.service
new file mode 100644
index 000000000000..5380b83ffcfe
--- /dev/null
+++ b/net-ftp/vsftpd/files/vsftpd_at.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Very Secure FTP Daemon
+
+[Service]
+Type=simple
+# Note: Do not use ExecStartPre=/usr/libexec/vsftpd-checkconfig.sh, as it
+# requires one of the listen options to be enabled.
+ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf -obackground=NO -olisten=NO -olisten_ipv6=NO
+StandardInput=socket
+SuccessExitStatus=2
diff --git a/net-ftp/vsftpd/metadata.xml b/net-ftp/vsftpd/metadata.xml
new file mode 100644
index 000000000000..53e430c2243d
--- /dev/null
+++ b/net-ftp/vsftpd/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-ftp</herd>
+ <herd>proxy-maintainers</herd>
+ <maintainer>
+ <email>hwoarang@gentoo.org</email>
+ <name>Markos Chandras</name>
+ </maintainer>
+ <maintainer>
+ <email>wired@gentoo.org</email>
+ <name>Alex Alexander</name>
+ </maintainer>
+ <maintainer>
+ <email>bugs@bergstroem.nu</email>
+ <name>Johan Bergström</name>
+ <description>Proxy Maintainer. CC him on bugs</description>
+ </maintainer>
+ <longdescription lang="en">
+ Very Secure FTP Daemon written with speed, size and security
+ in mind
+ </longdescription>
+</pkgmetadata>
diff --git a/net-ftp/vsftpd/vsftpd-2.3.5.ebuild b/net-ftp/vsftpd/vsftpd-2.3.5.ebuild
new file mode 100644
index 000000000000..d28e930f4213
--- /dev/null
+++ b/net-ftp/vsftpd/vsftpd-2.3.5.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Very Secure FTP Daemon written with speed, size and security in mind"
+HOMEPAGE="http://vsftpd.beasts.org/"
+SRC_URI="http://security.appspot.com/downloads/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ~hppa ia64 ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+IUSE="caps pam tcpd ssl selinux xinetd"
+
+DEPEND="caps? ( >=sys-libs/libcap-2 )
+ pam? ( virtual/pam )
+ tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+ ssl? ( >=dev-libs/openssl-0.9.7d )"
+RDEPEND="${DEPEND}
+ net-ftp/ftpbase
+ selinux? ( sec-policy/selinux-ftp )
+ xinetd? ( sys-apps/xinetd )"
+
+src_prepare() {
+
+ # as-needed patch. Bug #335977
+ epatch "${FILESDIR}/${PN}-2.3.2-as-needed.patch"
+
+ # kerberos patch. bug #335980
+ epatch "${FILESDIR}/${PN}-2.3.2-kerberos.patch"
+
+ # Patch the source, config and the manpage to use /etc/vsftpd/
+ epatch "${FILESDIR}/${P}-gentoo.patch"
+
+ # Fix building without the libcap
+ epatch "${FILESDIR}/${PN}-2.1.0-caps.patch"
+
+ # Configure vsftpd build defaults
+ use tcpd && echo "#define VSF_BUILD_TCPWRAPPERS" >> builddefs.h
+ use ssl && echo "#define VSF_BUILD_SSL" >> builddefs.h
+ use pam || echo "#undef VSF_BUILD_PAM" >> builddefs.h
+
+ # Ensure that we don't link against libcap unless asked
+ if ! use caps ; then
+ sed -i '/^#define VSF_SYSDEP_HAVE_LIBCAP$/ d' sysdeputil.c || die
+ epatch "${FILESDIR}"/${PN}-2.2.0-dont-link-caps.patch
+ fi
+
+ # Let portage control stripping
+ sed -i '/^LINK[[:space:]]*=[[:space:]]*/ s/-Wl,-s//' Makefile || die
+}
+
+src_compile() {
+ emake \
+ CFLAGS="${CFLAGS}" \
+ CC="$(tc-getCC)"
+}
+
+src_install() {
+ into /usr
+ doman ${PN}.conf.5 ${PN}.8
+ dosbin ${PN} || die "disbin failed"
+
+ dodoc AUDIT BENCHMARKS BUGS Changelog FAQ \
+ README README.security REWARD SIZE \
+ SPEED TODO TUNING || die "dodoc failed"
+ newdoc ${PN}.conf ${PN}.conf.example
+
+ docinto security
+ dodoc SECURITY/* || die "dodoc failed"
+
+ insinto "/usr/share/doc/${PF}/examples"
+ doins -r EXAMPLE/* || die "doins faileD"
+
+ insinto /etc/${PN}
+ newins ${PN}.conf{,.example}
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}.logrotate" ${PN}
+
+ if use xinetd ; then
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}/${PN}.xinetd" ${PN}
+ fi
+
+ newinitd "${FILESDIR}/${PN}.init" ${PN}
+
+ keepdir /usr/share/${PN}/empty
+
+ exeinto /usr/libexec
+ doexe "${FILESDIR}/vsftpd-checkconfig.sh"
+}
+
+pkg_preinst() {
+ # If we use xinetd, then we set listen=NO
+ # so that our default config works under xinetd - fixes #78347
+ if use xinetd ; then
+ sed -i 's/listen=YES/listen=NO/g' "${D}"/etc/${PN}/${PN}.conf.example
+ fi
+}
+
+pkg_postinst() {
+ einfo "vsftpd init script can now be multiplexed."
+ einfo "The default init script forces /etc/vsftpd/vsftpd.conf to exist."
+ einfo "If you symlink the init script to another one, say vsftpd.foo"
+ einfo "then that uses /etc/vsftpd/foo.conf instead."
+ einfo
+ einfo "Example:"
+ einfo " cd /etc/init.d"
+ einfo " ln -s vsftpd vsftpd.foo"
+ einfo "You can now treat vsftpd.foo like any other service"
+}
diff --git a/net-ftp/vsftpd/vsftpd-3.0.2-r1.ebuild b/net-ftp/vsftpd/vsftpd-3.0.2-r1.ebuild
new file mode 100644
index 000000000000..9ecd93631b08
--- /dev/null
+++ b/net-ftp/vsftpd/vsftpd-3.0.2-r1.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils systemd toolchain-funcs
+
+DESCRIPTION="Very Secure FTP Daemon written with speed, size and security in mind"
+HOMEPAGE="http://vsftpd.beasts.org/"
+SRC_URI="http://security.appspot.com/downloads/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd"
+IUSE="caps pam tcpd ssl selinux xinetd"
+
+DEPEND="caps? ( >=sys-libs/libcap-2 )
+ pam? ( virtual/pam )
+ tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+ ssl? ( >=dev-libs/openssl-0.9.7d )"
+RDEPEND="${DEPEND}
+ net-ftp/ftpbase
+ selinux? ( sec-policy/selinux-ftp )
+ xinetd? ( sys-apps/xinetd )"
+
+src_prepare() {
+
+ # kerberos patch. bug #335980
+ epatch "${FILESDIR}/${PN}-2.3.2-kerberos.patch"
+
+ # Patch the source, config and the manpage to use /etc/vsftpd/
+ epatch "${FILESDIR}/${PN}-2.3.5-gentoo.patch"
+
+ # Fix building without the libcap
+ epatch "${FILESDIR}/${PN}-2.1.0-caps.patch"
+
+ # Fix building on alpha. Bug #405829
+ epatch "${FILESDIR}/${PN}-3.0.2-alpha.patch"
+
+ # Configure vsftpd build defaults
+ use tcpd && echo "#define VSF_BUILD_TCPWRAPPERS" >> builddefs.h
+ use ssl && echo "#define VSF_BUILD_SSL" >> builddefs.h
+ use pam || echo "#undef VSF_BUILD_PAM" >> builddefs.h
+
+ # Ensure that we don't link against libcap unless asked
+ if ! use caps ; then
+ sed -i '/^#define VSF_SYSDEP_HAVE_LIBCAP$/ d' sysdeputil.c || die
+ epatch "${FILESDIR}"/${PN}-2.2.0-dont-link-caps.patch
+ fi
+
+ # Let portage control stripping
+ sed -i '/^LINK[[:space:]]*=[[:space:]]*/ s/-Wl,-s//' Makefile || die
+
+ #Bug #335977
+ epatch "${FILESDIR}"/${PN}-3.0.0-Makefile.patch
+
+ #Bug #450536
+ epatch "${FILESDIR}"/${P}-remove-legacy-cap.patch
+}
+
+src_compile() {
+ CFLAGS="${CFLAGS}" \
+ CC="$(tc-getCC)" \
+ emake
+}
+
+src_install() {
+ into /usr
+ doman ${PN}.conf.5 ${PN}.8
+ dosbin ${PN} || die "disbin failed"
+
+ dodoc AUDIT BENCHMARKS BUGS Changelog FAQ \
+ README README.security REWARD SIZE \
+ SPEED TODO TUNING || die "dodoc failed"
+ newdoc ${PN}.conf ${PN}.conf.example
+
+ docinto security
+ dodoc SECURITY/* || die "dodoc failed"
+
+ insinto "/usr/share/doc/${PF}/examples"
+ doins -r EXAMPLE/* || die "doins faileD"
+
+ insinto /etc/${PN}
+ newins ${PN}.conf{,.example}
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}.logrotate" ${PN}
+
+ if use xinetd ; then
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}/${PN}.xinetd" ${PN}
+ fi
+
+ newinitd "${FILESDIR}/${PN}.init" ${PN}
+
+ keepdir /usr/share/${PN}/empty
+
+ exeinto /usr/libexec
+ doexe "${FILESDIR}/vsftpd-checkconfig.sh"
+ systemd_dounit "${FILESDIR}/${PN}.service"
+}
+
+pkg_preinst() {
+ # If we use xinetd, then we set listen=NO
+ # so that our default config works under xinetd - fixes #78347
+ if use xinetd ; then
+ sed -i 's/listen=YES/listen=NO/g' "${D}"/etc/${PN}/${PN}.conf.example
+ fi
+}
+
+pkg_postinst() {
+ einfo "vsftpd init script can now be multiplexed."
+ einfo "The default init script forces /etc/vsftpd/vsftpd.conf to exist."
+ einfo "If you symlink the init script to another one, say vsftpd.foo"
+ einfo "then that uses /etc/vsftpd/foo.conf instead."
+ einfo
+ einfo "Example:"
+ einfo " cd /etc/init.d"
+ einfo " ln -s vsftpd vsftpd.foo"
+ einfo "You can now treat vsftpd.foo like any other service"
+}
diff --git a/net-ftp/vsftpd/vsftpd-3.0.2-r2.ebuild b/net-ftp/vsftpd/vsftpd-3.0.2-r2.ebuild
new file mode 100644
index 000000000000..593b4e9db24f
--- /dev/null
+++ b/net-ftp/vsftpd/vsftpd-3.0.2-r2.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils systemd toolchain-funcs
+
+DESCRIPTION="Very Secure FTP Daemon written with speed, size and security in mind"
+HOMEPAGE="http://vsftpd.beasts.org/"
+SRC_URI="http://security.appspot.com/downloads/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="caps pam tcpd ssl selinux xinetd"
+
+DEPEND="caps? ( >=sys-libs/libcap-2 )
+ pam? ( virtual/pam )
+ tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+ ssl? ( >=dev-libs/openssl-0.9.7d )"
+RDEPEND="${DEPEND}
+ net-ftp/ftpbase
+ selinux? ( sec-policy/selinux-ftp )
+ xinetd? ( sys-apps/xinetd )"
+
+src_prepare() {
+ # kerberos patch. bug #335980
+ epatch "${FILESDIR}/${PN}-2.3.2-kerberos.patch"
+
+ # Patch the source, config and the manpage to use /etc/vsftpd/
+ epatch "${FILESDIR}/${PN}-2.3.5-gentoo.patch"
+
+ # Fix building without the libcap
+ epatch "${FILESDIR}/${PN}-2.1.0-caps.patch"
+
+ # Fix building on alpha. Bug #405829
+ epatch "${FILESDIR}/${PN}-3.0.2-alpha.patch"
+
+ # Configure vsftpd build defaults
+ use tcpd && echo "#define VSF_BUILD_TCPWRAPPERS" >> builddefs.h
+ use ssl && echo "#define VSF_BUILD_SSL" >> builddefs.h
+ use pam || echo "#undef VSF_BUILD_PAM" >> builddefs.h
+
+ # Ensure that we don't link against libcap unless asked
+ if ! use caps ; then
+ sed -i '/^#define VSF_SYSDEP_HAVE_LIBCAP$/ d' sysdeputil.c || die
+ epatch "${FILESDIR}"/${PN}-2.2.0-dont-link-caps.patch
+ fi
+
+ # Let portage control stripping
+ sed -i '/^LINK[[:space:]]*=[[:space:]]*/ s/-Wl,-s//' Makefile || die
+
+ #Bug #335977
+ epatch "${FILESDIR}"/${PN}-3.0.0-Makefile.patch
+
+ #Bug #450536
+ epatch "${FILESDIR}"/${P}-remove-legacy-cap.patch
+
+ epatch_user
+}
+
+src_compile() {
+ # Override LIBS variable. Bug #508192
+ LIBS=
+ use caps && LIBS+=" -lcap"
+ use pam && LIBS+=" -lpam"
+ use tcpd && LIBS+=" -lwrap"
+ use ssl && LIBS+=" -lssl -lcrypto"
+
+ CFLAGS="${CFLAGS}" \
+ CC="$(tc-getCC)" \
+ emake LIBS="${LIBS}"
+}
+
+src_install() {
+ into /usr
+ doman ${PN}.conf.5 ${PN}.8
+ dosbin ${PN} || die "disbin failed"
+
+ dodoc AUDIT BENCHMARKS BUGS Changelog FAQ \
+ README README.security REWARD SIZE \
+ SPEED TODO TUNING || die "dodoc failed"
+ newdoc ${PN}.conf ${PN}.conf.example
+
+ docinto security
+ dodoc SECURITY/* || die "dodoc failed"
+
+ insinto "/usr/share/doc/${PF}/examples"
+ doins -r EXAMPLE/* || die "doins faileD"
+
+ insinto /etc/${PN}
+ newins ${PN}.conf{,.example}
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}.logrotate" ${PN}
+
+ if use xinetd ; then
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}/${PN}.xinetd" ${PN}
+ fi
+
+ newinitd "${FILESDIR}/${PN}.init" ${PN}
+
+ keepdir /usr/share/${PN}/empty
+
+ exeinto /usr/libexec
+ doexe "${FILESDIR}/vsftpd-checkconfig.sh"
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_newunit "${FILESDIR}/${PN}_at.service" "${PN}@.service"
+ systemd_dounit "${FILESDIR}/${PN}.socket"
+}
+
+pkg_preinst() {
+ # If we use xinetd, then we set listen=NO
+ # so that our default config works under xinetd - fixes #78347
+ if use xinetd ; then
+ sed -i 's/listen=YES/listen=NO/g' "${D}"/etc/${PN}/${PN}.conf.example
+ fi
+}
+
+pkg_postinst() {
+ einfo "vsftpd openRC init script can now be multiplexed."
+ einfo "The default init script forces /etc/vsftpd/vsftpd.conf to exist."
+ einfo "If you symlink the init script to another one, say vsftpd.foo"
+ einfo "then that uses /etc/vsftpd/foo.conf instead."
+ einfo
+ einfo "Example:"
+ einfo " cd /etc/init.d"
+ einfo " ln -s vsftpd vsftpd.foo"
+ einfo "You can now treat vsftpd.foo like any other service"
+}
diff --git a/net-ftp/vsftpd/vsftpd-3.0.2-r3.ebuild b/net-ftp/vsftpd/vsftpd-3.0.2-r3.ebuild
new file mode 100644
index 000000000000..1a1530a7d9c6
--- /dev/null
+++ b/net-ftp/vsftpd/vsftpd-3.0.2-r3.ebuild
@@ -0,0 +1,135 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils systemd toolchain-funcs
+
+DESCRIPTION="Very Secure FTP Daemon written with speed, size and security in mind"
+HOMEPAGE="http://vsftpd.beasts.org/"
+SRC_URI="http://security.appspot.com/downloads/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="caps pam tcpd ssl selinux xinetd"
+
+DEPEND="caps? ( >=sys-libs/libcap-2 )
+ pam? ( virtual/pam )
+ tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+ ssl? ( >=dev-libs/openssl-0.9.7d )"
+RDEPEND="${DEPEND}
+ net-ftp/ftpbase
+ selinux? ( sec-policy/selinux-ftp )
+ xinetd? ( sys-apps/xinetd )"
+
+src_prepare() {
+ # kerberos patch. bug #335980
+ epatch "${FILESDIR}/${PN}-2.3.2-kerberos.patch"
+
+ # Patch the source, config and the manpage to use /etc/vsftpd/
+ epatch "${FILESDIR}/${PN}-2.3.5-gentoo.patch"
+
+ # Fix building without the libcap
+ epatch "${FILESDIR}/${PN}-2.1.0-caps.patch"
+
+ # Fix building on alpha. Bug #405829
+ epatch "${FILESDIR}/${PN}-3.0.2-alpha.patch"
+
+ # Increase AS_LIMIT. Bug #522412
+ epatch "${FILESDIR}/${P}-aslim.patch"
+
+ # Configure vsftpd build defaults
+ use tcpd && echo "#define VSF_BUILD_TCPWRAPPERS" >> builddefs.h
+ use ssl && echo "#define VSF_BUILD_SSL" >> builddefs.h
+ use pam || echo "#undef VSF_BUILD_PAM" >> builddefs.h
+
+ # Ensure that we don't link against libcap unless asked
+ if ! use caps ; then
+ sed -i '/^#define VSF_SYSDEP_HAVE_LIBCAP$/ d' sysdeputil.c || die
+ epatch "${FILESDIR}"/${PN}-2.2.0-dont-link-caps.patch
+ fi
+
+ # Let portage control stripping
+ sed -i '/^LINK[[:space:]]*=[[:space:]]*/ s/-Wl,-s//' Makefile || die
+
+ #Bug #335977
+ epatch "${FILESDIR}"/${PN}-3.0.0-Makefile.patch
+
+ #Bug #450536
+ epatch "${FILESDIR}"/${P}-remove-legacy-cap.patch
+
+ epatch_user
+}
+
+src_compile() {
+ # Override LIBS variable. Bug #508192
+ LIBS=
+ use caps && LIBS+=" -lcap"
+ use pam && LIBS+=" -lpam"
+ use tcpd && LIBS+=" -lwrap"
+ use ssl && LIBS+=" -lssl -lcrypto"
+
+ CFLAGS="${CFLAGS}" \
+ CC="$(tc-getCC)" \
+ emake LIBS="${LIBS}"
+}
+
+src_install() {
+ into /usr
+ doman ${PN}.conf.5 ${PN}.8
+ dosbin ${PN} || die "disbin failed"
+
+ dodoc AUDIT BENCHMARKS BUGS Changelog FAQ \
+ README README.security REWARD SIZE \
+ SPEED TODO TUNING || die "dodoc failed"
+ newdoc ${PN}.conf ${PN}.conf.example
+
+ docinto security
+ dodoc SECURITY/* || die "dodoc failed"
+
+ insinto "/usr/share/doc/${PF}/examples"
+ doins -r EXAMPLE/* || die "doins faileD"
+
+ insinto /etc/${PN}
+ newins ${PN}.conf{,.example}
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}.logrotate" ${PN}
+
+ if use xinetd ; then
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}/${PN}.xinetd" ${PN}
+ fi
+
+ newinitd "${FILESDIR}/${PN}.init" ${PN}
+
+ keepdir /usr/share/${PN}/empty
+
+ exeinto /usr/libexec
+ doexe "${FILESDIR}/vsftpd-checkconfig.sh"
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_newunit "${FILESDIR}/${PN}_at.service" "${PN}@.service"
+ systemd_dounit "${FILESDIR}/${PN}.socket"
+}
+
+pkg_preinst() {
+ # If we use xinetd, then we set listen=NO
+ # so that our default config works under xinetd - fixes #78347
+ if use xinetd ; then
+ sed -i 's/listen=YES/listen=NO/g' "${D}"/etc/${PN}/${PN}.conf.example
+ fi
+}
+
+pkg_postinst() {
+ einfo "vsftpd openRC init script can now be multiplexed."
+ einfo "The default init script forces /etc/vsftpd/vsftpd.conf to exist."
+ einfo "If you symlink the init script to another one, say vsftpd.foo"
+ einfo "then that uses /etc/vsftpd/foo.conf instead."
+ einfo
+ einfo "Example:"
+ einfo " cd /etc/init.d"
+ einfo " ln -s vsftpd vsftpd.foo"
+ einfo "You can now treat vsftpd.foo like any other service"
+}
diff --git a/net-ftp/vsftpd/vsftpd-3.0.2-r4.ebuild b/net-ftp/vsftpd/vsftpd-3.0.2-r4.ebuild
new file mode 100644
index 000000000000..44c28846bad2
--- /dev/null
+++ b/net-ftp/vsftpd/vsftpd-3.0.2-r4.ebuild
@@ -0,0 +1,135 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils systemd toolchain-funcs
+
+DESCRIPTION="Very Secure FTP Daemon written with speed, size and security in mind"
+HOMEPAGE="http://vsftpd.beasts.org/"
+SRC_URI="http://security.appspot.com/downloads/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="caps pam tcpd ssl selinux xinetd"
+
+DEPEND="caps? ( >=sys-libs/libcap-2 )
+ pam? ( virtual/pam )
+ tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+ ssl? ( >=dev-libs/openssl-0.9.7d )"
+RDEPEND="${DEPEND}
+ net-ftp/ftpbase
+ selinux? ( sec-policy/selinux-ftp )
+ xinetd? ( sys-apps/xinetd )"
+
+src_prepare() {
+ # kerberos patch. bug #335980
+ epatch "${FILESDIR}/${PN}-2.3.2-kerberos.patch"
+
+ # Patch the source, config and the manpage to use /etc/vsftpd/
+ epatch "${FILESDIR}/${PN}-2.3.5-gentoo.patch"
+
+ # Fix building without the libcap
+ epatch "${FILESDIR}/${PN}-2.1.0-caps.patch"
+
+ # Fix building on alpha. Bug #405829
+ epatch "${FILESDIR}/${PN}-3.0.2-alpha.patch"
+
+ # Increase AS_LIMIT. Bug #522412
+ epatch "${FILESDIR}/${P}-aslim.patch"
+
+ # Configure vsftpd build defaults
+ use tcpd && echo "#define VSF_BUILD_TCPWRAPPERS" >> builddefs.h
+ use ssl && echo "#define VSF_BUILD_SSL" >> builddefs.h
+ use pam || echo "#undef VSF_BUILD_PAM" >> builddefs.h
+
+ # Ensure that we don't link against libcap unless asked
+ if ! use caps ; then
+ sed -i '/^#define VSF_SYSDEP_HAVE_LIBCAP$/ d' sysdeputil.c || die
+ epatch "${FILESDIR}"/${PN}-2.2.0-dont-link-caps.patch
+ fi
+
+ # Let portage control stripping
+ sed -i '/^LINK[[:space:]]*=[[:space:]]*/ s/-Wl,-s//' Makefile || die
+
+ #Bug #335977
+ epatch "${FILESDIR}"/${PN}-3.0.0-Makefile.patch
+
+ #Bug #450536
+ epatch "${FILESDIR}"/${P}-remove-legacy-cap.patch
+
+ epatch_user
+}
+
+src_compile() {
+ # Override LIBS variable. Bug #508192
+ LIBS=
+ use caps && LIBS+=" -lcap"
+ use pam && LIBS+=" -lpam"
+ use tcpd && LIBS+=" -lwrap"
+ use ssl && LIBS+=" -lssl -lcrypto"
+
+ CFLAGS="${CFLAGS}" \
+ CC="$(tc-getCC)" \
+ emake LIBS="${LIBS}"
+}
+
+src_install() {
+ into /usr
+ doman ${PN}.conf.5 ${PN}.8
+ dosbin ${PN} || die "disbin failed"
+
+ dodoc AUDIT BENCHMARKS BUGS Changelog FAQ \
+ README README.security REWARD SIZE \
+ SPEED TODO TUNING || die "dodoc failed"
+ newdoc ${PN}.conf ${PN}.conf.example
+
+ docinto security
+ dodoc SECURITY/* || die "dodoc failed"
+
+ insinto "/usr/share/doc/${PF}/examples"
+ doins -r EXAMPLE/* || die "doins faileD"
+
+ insinto /etc/${PN}
+ newins ${PN}.conf{,.example}
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}.logrotate" ${PN}
+
+ if use xinetd ; then
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}/${PN}.xinetd" ${PN}
+ fi
+
+ newinitd "${FILESDIR}/${PN}.init" ${PN}
+
+ keepdir /usr/share/${PN}/empty
+
+ exeinto /usr/libexec
+ doexe "${FILESDIR}/vsftpd-checkconfig.sh"
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_newunit "${FILESDIR}/${PN}_at.service" "${PN}@.service"
+ systemd_dounit "${FILESDIR}/${PN}.socket"
+}
+
+pkg_preinst() {
+ # If we use xinetd, then we set listen=NO
+ # so that our default config works under xinetd - fixes #78347
+ if use xinetd ; then
+ sed -i 's/listen=YES/listen=NO/g' "${D}"/etc/${PN}/${PN}.conf.example
+ fi
+}
+
+pkg_postinst() {
+ einfo "vsftpd openRC init script can now be multiplexed."
+ einfo "The default init script forces /etc/vsftpd/vsftpd.conf to exist."
+ einfo "If you symlink the init script to another one, say vsftpd.foo"
+ einfo "then that uses /etc/vsftpd/foo.conf instead."
+ einfo
+ einfo "Example:"
+ einfo " cd /etc/init.d"
+ einfo " ln -s vsftpd vsftpd.foo"
+ einfo "You can now treat vsftpd.foo like any other service"
+}
diff --git a/net-ftp/vsftpd/vsftpd-3.0.2.ebuild b/net-ftp/vsftpd/vsftpd-3.0.2.ebuild
new file mode 100644
index 000000000000..eaebab280fb4
--- /dev/null
+++ b/net-ftp/vsftpd/vsftpd-3.0.2.ebuild
@@ -0,0 +1,118 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Very Secure FTP Daemon written with speed, size and security in mind"
+HOMEPAGE="http://vsftpd.beasts.org/"
+SRC_URI="http://security.appspot.com/downloads/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~hppa ia64 ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+IUSE="caps pam tcpd ssl selinux xinetd"
+
+DEPEND="caps? ( >=sys-libs/libcap-2 )
+ pam? ( virtual/pam )
+ tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+ ssl? ( >=dev-libs/openssl-0.9.7d )"
+RDEPEND="${DEPEND}
+ net-ftp/ftpbase
+ selinux? ( sec-policy/selinux-ftp )
+ xinetd? ( sys-apps/xinetd )"
+
+src_prepare() {
+
+ # kerberos patch. bug #335980
+ epatch "${FILESDIR}/${PN}-2.3.2-kerberos.patch"
+
+ # Patch the source, config and the manpage to use /etc/vsftpd/
+ epatch "${FILESDIR}/${PN}-2.3.5-gentoo.patch"
+
+ # Fix building without the libcap
+ epatch "${FILESDIR}/${PN}-2.1.0-caps.patch"
+
+ # Fix building on alpha. Bug #405829
+ epatch "${FILESDIR}/${PN}-3.0.2-alpha.patch"
+
+ # Configure vsftpd build defaults
+ use tcpd && echo "#define VSF_BUILD_TCPWRAPPERS" >> builddefs.h
+ use ssl && echo "#define VSF_BUILD_SSL" >> builddefs.h
+ use pam || echo "#undef VSF_BUILD_PAM" >> builddefs.h
+
+ # Ensure that we don't link against libcap unless asked
+ if ! use caps ; then
+ sed -i '/^#define VSF_SYSDEP_HAVE_LIBCAP$/ d' sysdeputil.c || die
+ epatch "${FILESDIR}"/${PN}-2.2.0-dont-link-caps.patch
+ fi
+
+ # Let portage control stripping
+ sed -i '/^LINK[[:space:]]*=[[:space:]]*/ s/-Wl,-s//' Makefile || die
+
+ #Bug #335977
+ epatch "${FILESDIR}"/${PN}-3.0.0-Makefile.patch
+}
+
+src_compile() {
+ CFLAGS="${CFLAGS}" \
+ CC="$(tc-getCC)" \
+ emake
+}
+
+src_install() {
+ into /usr
+ doman ${PN}.conf.5 ${PN}.8
+ dosbin ${PN} || die "disbin failed"
+
+ dodoc AUDIT BENCHMARKS BUGS Changelog FAQ \
+ README README.security REWARD SIZE \
+ SPEED TODO TUNING || die "dodoc failed"
+ newdoc ${PN}.conf ${PN}.conf.example
+
+ docinto security
+ dodoc SECURITY/* || die "dodoc failed"
+
+ insinto "/usr/share/doc/${PF}/examples"
+ doins -r EXAMPLE/* || die "doins faileD"
+
+ insinto /etc/${PN}
+ newins ${PN}.conf{,.example}
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}.logrotate" ${PN}
+
+ if use xinetd ; then
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}/${PN}.xinetd" ${PN}
+ fi
+
+ newinitd "${FILESDIR}/${PN}.init" ${PN}
+
+ keepdir /usr/share/${PN}/empty
+
+ exeinto /usr/libexec
+ doexe "${FILESDIR}/vsftpd-checkconfig.sh"
+}
+
+pkg_preinst() {
+ # If we use xinetd, then we set listen=NO
+ # so that our default config works under xinetd - fixes #78347
+ if use xinetd ; then
+ sed -i 's/listen=YES/listen=NO/g' "${D}"/etc/${PN}/${PN}.conf.example
+ fi
+}
+
+pkg_postinst() {
+ einfo "vsftpd init script can now be multiplexed."
+ einfo "The default init script forces /etc/vsftpd/vsftpd.conf to exist."
+ einfo "If you symlink the init script to another one, say vsftpd.foo"
+ einfo "then that uses /etc/vsftpd/foo.conf instead."
+ einfo
+ einfo "Example:"
+ einfo " cd /etc/init.d"
+ einfo " ln -s vsftpd vsftpd.foo"
+ einfo "You can now treat vsftpd.foo like any other service"
+}