summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hoffmann <hoffie@gentoo.org>2008-11-09 11:56:31 +0000
committerChristian Hoffmann <hoffie@gentoo.org>2008-11-09 11:56:31 +0000
commit7f95e92afdaaa809877bd278a32fd4a0923c2e70 (patch)
treefa3e3617cb790e046ca3c94b661039ed33b751e2 /net-ftp/proftpd
parentFull auto: Version bump KDE-4.1.3. (diff)
downloadgentoo-2-7f95e92afdaaa809877bd278a32fd4a0923c2e70.tar.gz
gentoo-2-7f95e92afdaaa809877bd278a32fd4a0923c2e70.tar.bz2
gentoo-2-7f95e92afdaaa809877bd278a32fd4a0923c2e70.zip
adding proftpd-1.3.1-r1 to get a regression-free version of proftpd which ships a patch for security bug 238762, adding proftpd-1.3.2_rc2-r2 to fix a mod_shaper-related compile failure as pointed out by Joker in bug 238762; also fixing bug 221275
(Portage version: 2.2_rc13/cvs/Linux 2.6.27-gentoo x86_64)
Diffstat (limited to 'net-ftp/proftpd')
-rw-r--r--net-ftp/proftpd/ChangeLog13
-rw-r--r--net-ftp/proftpd/files/proftpd-1.3.1-CVE-2008-4242.patch172
-rw-r--r--net-ftp/proftpd/proftpd-1.3.1-r1.ebuild256
-rw-r--r--net-ftp/proftpd/proftpd-1.3.2_rc2-r2.ebuild250
4 files changed, 690 insertions, 1 deletions
diff --git a/net-ftp/proftpd/ChangeLog b/net-ftp/proftpd/ChangeLog
index 9eaf7027cc3d..f6097c9c5c63 100644
--- a/net-ftp/proftpd/ChangeLog
+++ b/net-ftp/proftpd/ChangeLog
@@ -1,6 +1,17 @@
# ChangeLog for net-ftp/proftpd
# Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-ftp/proftpd/ChangeLog,v 1.180 2008/11/08 19:57:30 klausman Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-ftp/proftpd/ChangeLog,v 1.181 2008/11/09 11:56:30 hoffie Exp $
+
+*proftpd-1.3.2_rc2-r2 (09 Nov 2008)
+*proftpd-1.3.1-r1 (09 Nov 2008)
+
+ 09 Nov 2008; Christian Hoffmann <hoffie@gentoo.org>
+ +files/proftpd-1.3.1-CVE-2008-4242.patch, +proftpd-1.3.1-r1.ebuild,
+ +proftpd-1.3.2_rc2-r2.ebuild:
+ adding proftpd-1.3.1-r1 to get a regression-free version of proftpd which
+ ships a patch for security bug 238762, adding proftpd-1.3.2_rc2-r2 to fix
+ a mod_shaper-related compile failure as pointed out by Joker in bug
+ 238762; also fixing bug 221275
08 Nov 2008; Tobias Klausmann <klausman@gentoo.org>
proftpd-1.3.2_rc2.ebuild:
diff --git a/net-ftp/proftpd/files/proftpd-1.3.1-CVE-2008-4242.patch b/net-ftp/proftpd/files/proftpd-1.3.1-CVE-2008-4242.patch
new file mode 100644
index 000000000000..9b08cade2ab9
--- /dev/null
+++ b/net-ftp/proftpd/files/proftpd-1.3.1-CVE-2008-4242.patch
@@ -0,0 +1,172 @@
+Patch taken from debian, closes
+http://secunia.com/advisories/cve_reference/CVE-2008-4242/
+https://bugs.gentoo.org/show_bug.cgi?id=238762
+diff -urNad trunk~/src/main.c trunk/src/main.c
+--- trunk~/src/main.c 2008-09-21 23:50:55.000000000 +0200
++++ trunk/src/main.c 2008-09-21 23:50:55.000000000 +0200
+@@ -674,12 +674,17 @@
+ while (TRUE) {
+ pr_signals_handle();
+
++ memset(buf,'\0',sizeof(buf));
++
+ if (pr_netio_telnet_gets(buf, sizeof(buf)-1, session.c->instrm,
+ session.c->outstrm) == NULL) {
+
+- if (PR_NETIO_ERRNO(session.c->instrm) == EINTR)
+- /* Simple interrupted syscall */
++ if (errno == E2BIG) {
++ /* The client sent a too-long command which was ignored; give
++ * them another chance?
++ */
+ continue;
++ }
+
+ #ifndef PR_DEVEL_NO_DAEMON
+ /* Otherwise, EOF */
+@@ -695,20 +700,31 @@
+
+ if (cmd_buf_size == -1) {
+ int *bufsz = get_param_ptr(main_server->conf, "CommandBufferSize", FALSE);
++ size_t default_cmd_bufsz;
++
++ /* It's possible for the admin to select a PR_TUNABLE_BUFFER_SIZE which
++ * is smaller than PR_DEFAULT_CMD_BUFSZ. We need to handle such cases
++ * properly.
++ */
++ default_cmd_bufsz = PR_DEFAULT_CMD_BUFSZ;
++ if (default_cmd_bufsz > sizeof(buf)) {
++ default_cmd_bufsz = sizeof(buf);
++ }
++
+ if (bufsz == NULL) {
+- cmd_buf_size = PR_DEFAULT_CMD_BUFSZ;
++ cmd_buf_size = default_cmd_bufsz;
+
+ } else if (*bufsz <= 0) {
+ pr_log_pri(PR_LOG_WARNING, "invalid CommandBufferSize size (%d) "
+ "given, using default buffer size (%u) instead",
+- *bufsz, PR_DEFAULT_CMD_BUFSZ);
+- cmd_buf_size = PR_DEFAULT_CMD_BUFSZ;
++ *bufsz, default_cmd_bufsz);
++ cmd_buf_size = default_cmd_bufsz;
+
+ } else if (*bufsz + 1 > sizeof(buf)) {
+ pr_log_pri(PR_LOG_WARNING, "invalid CommandBufferSize size (%d) "
+ "given, using default buffer size (%u) instead",
+- *bufsz, PR_DEFAULT_CMD_BUFSZ);
+- cmd_buf_size = PR_DEFAULT_CMD_BUFSZ;
++ *bufsz, default_cmd_bufsz);
++ cmd_buf_size = default_cmd_bufsz;
+
+ } else {
+ pr_log_debug(DEBUG1, "setting CommandBufferSize to %d", *bufsz);
+diff -urNad trunk~/src/netio.c trunk/src/netio.c
+--- trunk~/src/netio.c 2008-09-21 23:39:34.000000000 +0200
++++ trunk/src/netio.c 2008-09-21 23:52:17.000000000 +0200
+@@ -1,6 +1,6 @@
+ /*
+ * ProFTPD - FTP server daemon
+- * Copyright (c) 2001-2007 The ProFTPD Project team
++ * Copyright (c) 2001-2008 The ProFTPD Project team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+@@ -30,19 +30,19 @@
+ #include <signal.h>
+
+ #ifndef IAC
+-#define IAC 255
++# define IAC 255
+ #endif
+ #ifndef DONT
+-#define DONT 254
++# define DONT 254
+ #endif
+ #ifndef DO
+-#define DO 253
++# define DO 253
+ #endif
+ #ifndef WONT
+-#define WONT 252
++# define WONT 252
+ #endif
+ #ifndef WILL
+-#define WILL 251
++# define WILL 251
+ #endif
+
+ static const char *trace_channel = "netio";
+@@ -51,6 +51,17 @@
+ static pr_netio_t *core_data_netio = NULL, *data_netio = NULL;
+ static pr_netio_t *core_othr_netio = NULL, *othr_netio = NULL;
+
++/* Used to track whether the previous text read from the client's control
++ * connection was a properly-terminated command. If so, then read in the
++ * next/current text as per normal. If NOT (e.g. the client sent a too-long
++ * command), then read in the next/current text, but ignore it. Only clear
++ * this flag if the next/current command can be read as per normal.
++ *
++ * The pr_netio_telnet_gets() uses this variable, in conjunction with its
++ * saw_newline flag, for handling too-long commands from clients.
++ */
++static int properly_terminated_prev_command = TRUE;
++
+ static pr_netio_stream_t *netio_stream_alloc(pool *parent_pool) {
+ pool *netio_pool = NULL;
+ pr_netio_stream_t *nstrm = NULL;
+@@ -911,7 +922,7 @@
+ char *bp = buf;
+ unsigned char cp;
+ static unsigned char mode = 0;
+- int toread;
++ int toread, saw_newline = FALSE;
+ pr_buffer_t *pbuf = NULL;
+
+ if (buflen == 0) {
+@@ -940,8 +951,9 @@
+ *bp = '\0';
+ return buf;
+
+- } else
++ } else {
+ return NULL;
++ }
+ }
+
+ pbuf->remaining = pbuf->buflen - toread;
+@@ -1004,6 +1016,8 @@
+ toread--;
+ *bp++ = *pbuf->current++;
+ pbuf->remaining++;
++
++ saw_newline = TRUE;
+ break;
+ }
+
+@@ -1011,6 +1025,25 @@
+ pbuf->current = NULL;
+ }
+
++ if (!saw_newline) {
++ /* If we haven't seen a newline, then assume the client is deliberately
++ * sending a too-long command, trying to exploit buffer sizes and make
++ * the server make some possibly bad assumptions.
++ */
++
++ properly_terminated_prev_command = FALSE;
++ errno = E2BIG;
++ return NULL;
++ }
++
++ if (!properly_terminated_prev_command) {
++ properly_terminated_prev_command = TRUE;
++ pr_log_pri(PR_LOG_NOTICE, "client sent too-long command, ignoring");
++ errno = E2BIG;
++ return NULL;
++ }
++
++ properly_terminated_prev_command = TRUE;
+ *bp = '\0';
+ return buf;
+ }
diff --git a/net-ftp/proftpd/proftpd-1.3.1-r1.ebuild b/net-ftp/proftpd/proftpd-1.3.1-r1.ebuild
new file mode 100644
index 000000000000..479f625a6dab
--- /dev/null
+++ b/net-ftp/proftpd/proftpd-1.3.1-r1.ebuild
@@ -0,0 +1,256 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-ftp/proftpd/proftpd-1.3.1-r1.ebuild,v 1.1 2008/11/09 11:56:30 hoffie Exp $
+
+inherit eutils flag-o-matic toolchain-funcs autotools
+
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+
+IUSE="acl authfile ban case clamav deflate hardened ifsession ipv6 ldap mysql ncurses nls noauthunix opensslcrypt pam postgres radius rewrite selinux shaper sitemisc softquota ssl tcpd vroot xinetd"
+
+CASE_VER="0.3"
+CLAMAV_VER="0.7"
+DEFLATE_VER="0.3"
+SHAPER_VER="0.6.3"
+VROOT_VER="0.7.2"
+
+DESCRIPTION="An advanced and very configurable FTP server."
+
+SRC_URI="ftp://ftp.proftpd.org/distrib/source/${P/_/}.tar.bz2
+ case? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-case-${CASE_VER}.tar.gz )
+ clamav? ( http://www.thrallingpenguin.com/resources/mod_clamav-${CLAMAV_VER}.tar.gz )
+ deflate? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-deflate-${DEFLATE_VER}.tar.gz )
+ shaper? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-shaper-${SHAPER_VER}.tar.gz )
+ vroot? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-vroot-${VROOT_VER}.tar.gz )"
+
+HOMEPAGE="http://www.proftpd.org/
+ http://www.castaglia.org/proftpd/
+ http://www.thrallingpenguin.com/resources/mod_clamav.htm"
+
+SLOT="0"
+LICENSE="GPL-2"
+
+DEPEND="acl? ( sys-apps/acl sys-apps/attr )
+ clamav? ( app-antivirus/clamav )
+ ldap? ( >=net-nds/openldap-1.2.11 )
+ mysql? ( virtual/mysql )
+ ncurses? ( sys-libs/ncurses )
+ opensslcrypt? ( >=dev-libs/openssl-0.9.6f )
+ pam? ( virtual/pam )
+ postgres? ( virtual/postgresql-base )
+ ssl? ( >=dev-libs/openssl-0.9.6f )
+ tcpd? ( >=sys-apps/tcp-wrappers-7.6-r3 )
+ xinetd? ( virtual/inetd )"
+
+RDEPEND="${DEPEND}
+ net-ftp/ftpbase
+ selinux? ( sec-policy/selinux-ftpd )"
+
+S="${WORKDIR}/${P/_/}"
+
+pkg_setup() {
+ # Add the proftpd user to make the default config
+ # work out-of-the-box
+ enewgroup proftpd
+ enewuser proftpd -1 -1 -1 proftpd
+}
+
+src_unpack() {
+ unpack ${P/_/}.tar.bz2
+
+ cd "${S}"
+
+ epatch "${FILESDIR}/${P}-CVE-2008-4242.patch"
+
+ # Fix stripping of files
+ sed -e "s| @INSTALL_STRIP@||g" -i Make*
+
+ if use case ; then
+ unpack ${PN}-mod-case-${CASE_VER}.tar.gz
+ cp -f mod_case/mod_case.c contrib/
+ cp -f mod_case/mod_case.html doc/
+ fi
+
+ if use clamav ; then
+ unpack mod_clamav-${CLAMAV_VER}.tar.gz
+ cp -f mod_clamav-${CLAMAV_VER}/mod_clamav.* contrib/
+ epatch mod_clamav-${CLAMAV_VER}/${PN}.patch
+ fi
+
+ if use deflate ; then
+ unpack ${PN}-mod-deflate-${DEFLATE_VER}.tar.gz
+ cp -f mod_deflate/mod_deflate.c contrib/
+ cp -f mod_deflate/mod_deflate.html doc/
+ fi
+
+ if use shaper ; then
+ unpack ${PN}-mod-shaper-${SHAPER_VER}.tar.gz
+ cp -f mod_shaper/mod_shaper.c contrib/
+ cp -f mod_shaper/mod_shaper.html doc/
+ fi
+
+ if use vroot ; then
+ unpack ${PN}-mod-vroot-${VROOT_VER}.tar.gz
+ cp -f mod_vroot/mod_vroot.c contrib/
+ cp -f mod_vroot/mod_vroot.html doc/
+ fi
+
+ # Fix bug #218850
+ epatch "${FILESDIR}/${P}-bug218850.patch"
+
+ # Fix bug #208840
+ epatch "${FILESDIR}/${P}-bug208840.patch"
+
+ # Fix bug #221275
+ # extract custom PR_ macros from aclocal.m4 to acinclude.m4
+ # and delete the provided aclocal.m4 before running autoreconf
+ elog "Extract custom m4 macros from aclocal.m4..."
+ sed -e '/libtool\.m4/q' aclocal.m4 > acinclude.m4
+ rm -f aclocal.m4
+
+ eautoreconf
+}
+
+src_compile() {
+ addpredict /etc/krb5.conf
+ local modules myconf
+
+ modules="mod_ratio:mod_readme"
+ use acl && modules="${modules}:mod_facl"
+ use ban && modules="${modules}:mod_ban"
+ use case && modules="${modules}:mod_case"
+ use clamav && modules="${modules}:mod_clamav"
+ use deflate && modules="${modules}:mod_deflate"
+ use pam && modules="${modules}:mod_auth_pam"
+ use radius && modules="${modules}:mod_radius"
+ use rewrite && modules="${modules}:mod_rewrite"
+ use shaper && modules="${modules}:mod_shaper"
+ use sitemisc && modules="${modules}:mod_site_misc"
+ use ssl && modules="${modules}:mod_tls"
+ use tcpd && modules="${modules}:mod_wrap"
+ use vroot && modules="${modules}:mod_vroot"
+
+ # pam needs to be explicitely disabled
+ use pam || myconf="${myconf} --enable-auth-pam=no"
+
+ if use ldap ; then
+ modules="${modules}:mod_ldap"
+ append-ldflags "-lresolv"
+ if use ssl ; then
+ CFLAGS="${CFLAGS} -DUSE_LDAP_TLS"
+ fi
+ fi
+
+ if use opensslcrypt ; then
+ myconf="${myconf} --enable-openssl --with-includes=/usr/include/openssl"
+ append-ldflags "-lcrypto"
+ CFLAGS="${CFLAGS} -DHAVE_OPENSSL"
+ fi
+
+ if use nls ; then
+ myconf="${myconf} --enable-nls"
+ fi
+
+ if use mysql && use postgres ; then
+ ewarn "ProFTPD only supports either the MySQL or PostgreSQL modules."
+ ewarn "Presently this ebuild defaults to mysql. If you would like to"
+ ewarn "change the default behaviour, merge ProFTPD with:"
+ ewarn "USE='-mysql postgres' emerge proftpd"
+ epause 5
+ fi
+
+ if use mysql ; then
+ modules="${modules}:mod_sql:mod_sql_mysql"
+ myconf="${myconf} --with-includes=/usr/include/mysql"
+ elif use postgres ; then
+ modules="${modules}:mod_sql:mod_sql_postgres"
+ myconf="${myconf} --with-includes=/usr/include/postgresql"
+ fi
+
+ if use softquota ; then
+ modules="${modules}:mod_quotatab"
+ if use mysql || use postgres ; then
+ modules="${modules}:mod_quotatab_sql"
+ fi
+ if use radius ; then
+ modules="${modules}:mod_quotatab_radius"
+ fi
+ if use ldap ; then
+ modules="${modules}:mod_quotatab_file:mod_quotatab_ldap"
+ else
+ modules="${modules}:mod_quotatab_file"
+ fi
+ fi
+
+ # mod_ifsession should be the last module in the --with-modules list
+ # see http://www.castaglia.org/proftpd/modules/mod_ifsession.html#Installation
+ use ifsession && modules="${modules}:mod_ifsession"
+
+ # bug #30359
+ use hardened && echo > lib/libcap/cap_sys.c
+ gcc-specs-pie && echo > lib/libcap/cap_sys.c
+
+ if use noauthunix ; then
+ myconf="${myconf} --disable-auth-unix"
+ else
+ myconf="${myconf} --enable-auth-unix"
+ fi
+
+ econf \
+ --sbindir=/usr/sbin \
+ --localstatedir=/var/run \
+ --sysconfdir=/etc/proftpd \
+ --enable-shadow \
+ --enable-autoshadow \
+ --enable-ctrls \
+ --with-modules=${modules} \
+ $(use_enable acl facl) \
+ $(use_enable authfile auth-file) \
+ $(use_enable ipv6) \
+ $(use_enable ncurses) \
+ ${myconf} || die "econf failed"
+
+ emake || die "emake failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ keepdir /var/run/proftpd
+
+ dodoc "${FILESDIR}/proftpd.conf" \
+ COPYING CREDITS ChangeLog NEWS README* \
+ doc/license.txt
+ dohtml doc/*.html
+ dohtml doc/howto/*.html
+
+ docinto rfc
+ dodoc doc/rfc/*.txt
+
+ mv -f "${D}/etc/proftpd/proftpd.conf" "${D}/etc/proftpd/proftpd.conf.distrib"
+
+ insinto /etc/proftpd
+ newins "${FILESDIR}/proftpd.conf" proftpd.conf.sample
+
+ if use xinetd ; then
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}/proftpd.xinetd" proftpd
+ fi
+
+ newinitd "${FILESDIR}/proftpd.rc6" proftpd
+}
+
+pkg_postinst() {
+ elog
+ elog "You can find the config files in /etc/proftpd"
+ elog
+ ewarn "With the introduction of net-ftp/ftpbase the ftp user is now ftp."
+ ewarn "Remember to change that in the configuration file."
+ ewarn
+ if use clamav ; then
+ ewarn "mod_clamav was updated to a new version, which uses Clamd"
+ ewarn "only for virus scanning, so you'll have to set Clamd up"
+ ewarn "and start it, also re-check the mod_clamav docs."
+ ewarn
+ fi
+}
diff --git a/net-ftp/proftpd/proftpd-1.3.2_rc2-r2.ebuild b/net-ftp/proftpd/proftpd-1.3.2_rc2-r2.ebuild
new file mode 100644
index 000000000000..a4766a7c4dcc
--- /dev/null
+++ b/net-ftp/proftpd/proftpd-1.3.2_rc2-r2.ebuild
@@ -0,0 +1,250 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-ftp/proftpd/proftpd-1.3.2_rc2-r2.ebuild,v 1.1 2008/11/09 11:56:30 hoffie Exp $
+
+inherit eutils flag-o-matic toolchain-funcs autotools
+
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+
+IUSE="acl authfile ban case clamav deflate hardened ifsession ipv6 ldap mysql ncurses nls noauthunix opensslcrypt pam postgres radius rewrite selinux shaper sitemisc softquota ssl tcpd vroot xinetd"
+
+CASE_VER="0.3"
+CLAMAV_VER="0.10"
+DEFLATE_VER="0.3"
+SHAPER_VER="0.6.4"
+VROOT_VER="0.7.2"
+
+DESCRIPTION="An advanced and very configurable FTP server."
+
+SRC_URI="ftp://ftp.proftpd.org/distrib/source/${P/_/}.tar.bz2
+ case? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-case-${CASE_VER}.tar.gz )
+ clamav? ( http://www.thrallingpenguin.com/resources/mod_clamav-${CLAMAV_VER}.tar.gz )
+ deflate? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-deflate-${DEFLATE_VER}.tar.gz )
+ shaper? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-shaper-${SHAPER_VER}.tar.gz )
+ vroot? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-vroot-${VROOT_VER}.tar.gz )"
+
+HOMEPAGE="http://www.proftpd.org/
+ http://www.castaglia.org/proftpd/
+ http://www.thrallingpenguin.com/resources/mod_clamav.htm"
+
+SLOT="0"
+LICENSE="GPL-2"
+
+DEPEND="acl? ( sys-apps/acl sys-apps/attr )
+ clamav? ( app-antivirus/clamav )
+ ldap? ( >=net-nds/openldap-1.2.11 )
+ mysql? ( virtual/mysql )
+ ncurses? ( sys-libs/ncurses )
+ opensslcrypt? ( >=dev-libs/openssl-0.9.6f )
+ pam? ( virtual/pam )
+ postgres? ( virtual/postgresql-base )
+ ssl? ( >=dev-libs/openssl-0.9.6f )
+ tcpd? ( >=sys-apps/tcp-wrappers-7.6-r3 )
+ xinetd? ( virtual/inetd )"
+
+RDEPEND="${DEPEND}
+ net-ftp/ftpbase
+ selinux? ( sec-policy/selinux-ftpd )"
+
+S="${WORKDIR}/${P/_/}"
+
+pkg_setup() {
+ # Add the proftpd user to make the default config
+ # work out-of-the-box
+ enewgroup proftpd
+ enewuser proftpd -1 -1 -1 proftpd
+}
+
+src_unpack() {
+ unpack ${P/_/}.tar.bz2
+
+ cd "${S}"
+
+ epatch "${FILESDIR}/${P}-CVE-2008-4242.patch"
+
+ # Fix stripping of files
+ sed -e "s| @INSTALL_STRIP@||g" -i Make*
+
+ if use case ; then
+ unpack ${PN}-mod-case-${CASE_VER}.tar.gz
+ cp -f mod_case/mod_case.c contrib/
+ cp -f mod_case/mod_case.html doc/
+ fi
+
+ if use clamav ; then
+ unpack mod_clamav-${CLAMAV_VER}.tar.gz
+ cp -f mod_clamav-${CLAMAV_VER}/mod_clamav.* contrib/
+ epatch mod_clamav-${CLAMAV_VER}/${PN}.patch
+ fi
+
+ if use deflate ; then
+ unpack ${PN}-mod-deflate-${DEFLATE_VER}.tar.gz
+ cp -f mod_deflate/mod_deflate.c contrib/
+ cp -f mod_deflate/mod_deflate.html doc/
+ fi
+
+ if use shaper ; then
+ unpack ${PN}-mod-shaper-${SHAPER_VER}.tar.gz
+ cp -f mod_shaper/mod_shaper.c contrib/
+ cp -f mod_shaper/mod_shaper.html doc/
+ fi
+
+ if use vroot ; then
+ unpack ${PN}-mod-vroot-${VROOT_VER}.tar.gz
+ cp -f mod_vroot/mod_vroot.c contrib/
+ cp -f mod_vroot/mod_vroot.html doc/
+ fi
+
+ # Fix bug #221275
+ # extract custom PR_ macros from aclocal.m4 to acinclude.m4
+ # and delete the provided aclocal.m4 before running autoreconf
+ elog "Extract custom m4 macros from aclocal.m4..."
+ sed -e '/libtool\.m4/q' aclocal.m4 > acinclude.m4
+ rm -f aclocal.m4
+
+ eautoreconf
+}
+
+src_compile() {
+ addpredict /etc/krb5.conf
+ local modules myconf
+
+ modules="mod_ratio:mod_readme"
+ use acl && modules="${modules}:mod_facl"
+ use ban && modules="${modules}:mod_ban"
+ use case && modules="${modules}:mod_case"
+ use clamav && modules="${modules}:mod_clamav"
+ use deflate && modules="${modules}:mod_deflate"
+ use pam && modules="${modules}:mod_auth_pam"
+ use radius && modules="${modules}:mod_radius"
+ use rewrite && modules="${modules}:mod_rewrite"
+ use shaper && modules="${modules}:mod_shaper"
+ use sitemisc && modules="${modules}:mod_site_misc"
+ use ssl && modules="${modules}:mod_tls"
+ use tcpd && modules="${modules}:mod_wrap"
+ use vroot && modules="${modules}:mod_vroot"
+
+ # pam needs to be explicitely disabled
+ use pam || myconf="${myconf} --enable-auth-pam=no"
+
+ if use ldap ; then
+ modules="${modules}:mod_ldap"
+ append-ldflags "-lresolv"
+ if use ssl ; then
+ CFLAGS="${CFLAGS} -DUSE_LDAP_TLS"
+ fi
+ fi
+
+ if use opensslcrypt ; then
+ myconf="${myconf} --enable-openssl --with-includes=/usr/include/openssl"
+ append-ldflags "-lcrypto"
+ CFLAGS="${CFLAGS} -DHAVE_OPENSSL"
+ fi
+
+ if use nls ; then
+ myconf="${myconf} --enable-nls"
+ fi
+
+ if use mysql && use postgres ; then
+ ewarn "ProFTPD only supports either the MySQL or PostgreSQL modules."
+ ewarn "Presently this ebuild defaults to mysql. If you would like to"
+ ewarn "change the default behaviour, merge ProFTPD with:"
+ ewarn "USE='-mysql postgres' emerge proftpd"
+ epause 5
+ fi
+
+ if use mysql ; then
+ modules="${modules}:mod_sql:mod_sql_mysql"
+ myconf="${myconf} --with-includes=/usr/include/mysql"
+ elif use postgres ; then
+ modules="${modules}:mod_sql:mod_sql_postgres"
+ myconf="${myconf} --with-includes=/usr/include/postgresql"
+ fi
+
+ if use softquota ; then
+ modules="${modules}:mod_quotatab"
+ if use mysql || use postgres ; then
+ modules="${modules}:mod_quotatab_sql"
+ fi
+ if use radius ; then
+ modules="${modules}:mod_quotatab_radius"
+ fi
+ if use ldap ; then
+ modules="${modules}:mod_quotatab_file:mod_quotatab_ldap"
+ else
+ modules="${modules}:mod_quotatab_file"
+ fi
+ fi
+
+ # mod_ifsession should be the last module in the --with-modules list
+ # see http://www.castaglia.org/proftpd/modules/mod_ifsession.html#Installation
+ use ifsession && modules="${modules}:mod_ifsession"
+
+ # bug #30359
+ use hardened && echo > lib/libcap/cap_sys.c
+ gcc-specs-pie && echo > lib/libcap/cap_sys.c
+
+ if use noauthunix ; then
+ myconf="${myconf} --disable-auth-unix"
+ else
+ myconf="${myconf} --enable-auth-unix"
+ fi
+
+ econf \
+ --sbindir=/usr/sbin \
+ --localstatedir=/var/run \
+ --sysconfdir=/etc/proftpd \
+ --enable-shadow \
+ --enable-autoshadow \
+ --enable-ctrls \
+ --with-modules=${modules} \
+ $(use_enable acl facl) \
+ $(use_enable authfile auth-file) \
+ $(use_enable ipv6) \
+ $(use_enable ncurses) \
+ ${myconf} || die "econf failed"
+
+ emake || die "emake failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ keepdir /var/run/proftpd
+
+ dodoc "${FILESDIR}/proftpd.conf" \
+ COPYING CREDITS ChangeLog NEWS README* \
+ doc/license.txt
+ dohtml doc/*.html
+ dohtml doc/howto/*.html
+
+ docinto rfc
+ dodoc doc/rfc/*.txt
+
+ mv -f "${D}/etc/proftpd/proftpd.conf" "${D}/etc/proftpd/proftpd.conf.distrib"
+
+ insinto /etc/proftpd
+ newins "${FILESDIR}/proftpd.conf" proftpd.conf.sample
+
+ if use xinetd ; then
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}/proftpd.xinetd" proftpd
+ fi
+
+ newinitd "${FILESDIR}/proftpd.rc6" proftpd
+}
+
+pkg_postinst() {
+ elog
+ elog "You can find the config files in /etc/proftpd"
+ elog
+ ewarn "With the introduction of net-ftp/ftpbase the ftp user is now ftp."
+ ewarn "Remember to change that in the configuration file."
+ ewarn
+ if use clamav ; then
+ ewarn "mod_clamav was updated to a new version, which uses Clamd"
+ ewarn "only for virus scanning, so you'll have to set Clamd up"
+ ewarn "and start it, also re-check the mod_clamav docs."
+ ewarn
+ fi
+}