Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates-src > by-pkgid > 66cf70cb4b27fe034994d790dba13f43 > files > 22

proftpd-1.3.5e-4.2.mga7.src.rpm

%define	_disable_ld_no_undefined 1
%define	mod_gss_version 1.3.6
%define	mod_autohost_version 0.4
%define	mod_case_version 0.7
%define	mod_vroot_version 0.9.2

%global __requires_exclude ^perl\\(getopts.pl\\)

Summary:	Professional FTP Server
Name:		proftpd
Version:	1.3.5e
%define subrel 2
Release:	%mkrel 4
License:	GPLv2+
Group:		System/Servers
URL:		http://proftpd.org/
Source0:	ftp://ftp.proftpd.org/distrib/source/%{name}-%{version}.tar.gz
Source1:	proftpd.logrotate
Source2:	proftpd.xinetd
Source3:	proftpd.init
Source4:	proftpd.service
Source5:	basic.conf
Source7:	welcome.msg
Source32:	32_mod_shaper.conf
# http://sourceforge.net/projects/gssmod/
Source100:	http://prdownloads.sourceforge.net/gssmod/mod_gss-%{mod_gss_version}.tar.gz
# from http://www.castaglia.org/proftpd/
Source102:	http://www.castaglia.org/proftpd/modules/proftpd-mod-autohost-%{mod_autohost_version}.tar.gz
Source103:	http://www.castaglia.org/proftpd/modules/proftpd-mod-case-%{mod_case_version}.tar.gz
Source108:	http://www.castaglia.org/proftpd/modules/proftpd-mod-vroot-%{mod_vroot_version}.tar.gz
Source150:	%{name}-tmpfiles.conf
Source200:	anonymous.conf
Patch0:		proftpd-1.3.4b-mdv-xferstats_logfile_location.diff
Patch2:		proftpd-1.3.4b-mdv-use-system-auth-instead-of-pam_unix.diff
Patch4:		proftpd-1.3.5-mdv-installfix.diff
Patch7:		proftpd-1.3.4b-mdv-change_pam_name.diff
Patch8:		proftpd-1.3.5a-bug-4206.patch
Patch40:	proftpd-1.3.4b-mdv-mod_gss-format_not_a_string_literal_and_no_format_arguments.diff
Patch41:	proftpd-1.3.5-CVE-2019-12815.patch
Patch42:	proftpd-1.3.5-CVE-2019-18217.patch
Patch43:	proftpd-1.3.5e-CVE-2019-19269-issue_861-null-pointers.patch
Requires:	pam >= 0.59
Requires:	setup
Requires(post): systemd >= %{systemd_required_version}
Requires(post):	rpm-helper
Requires(postun):	rpm-helper
Requires(preun):	rpm-helper
Requires(pre):	rpm-helper
BuildRequires:	pkgconfig(libcap)
BuildRequires:	gettext-devel
BuildRequires:	libacl-devel
BuildRequires:	libattr-devel
BuildRequires:	pkgconfig(krb5)
BuildRequires:	libtool
BuildRequires:	libtool-devel
BuildRequires:	mysql-devel
BuildRequires:	pkgconfig(ncurses)
BuildRequires:	openldap-devel
BuildRequires:	pkgconfig(openssl)
BuildRequires:	pam-devel
BuildRequires:	pkgconfig
BuildRequires:	postgresql-libs-devel
BuildRequires:	sasl-plug-gssapi
BuildRequires:	pkgconfig(sqlite3)
BuildRequires:	tcp_wrappers-devel
BuildRequires:	pkgconfig(zlib)
BuildRequires:	pkgconfig(libmemcached) >= 0.41
BuildRequires:	pkgconfig(libpcre)
BuildRequires:	pkgconfig(libpcreposix)
Conflicts:	vsftpd
Conflicts:	wu-ftpd
Conflicts:	pure-ftpd
Conflicts:	ncftpd
Conflicts:	anonftp

Obsoletes:	proftpd-mod_time < 1.3.5-1

%description
ProFTPd is an enhanced FTP server with a focus toward simplicity, security, and
ease of configuration.  It features a very Apache-like configuration syntax,
and a highly customizable server infrastructure, including support for multiple
'virtual' FTP servers, anonymous FTP, and permission-based directory
visibility.

This version supports both standalone and xinetd operation.

%package	devel
Summary:	Development files for ProFTPD
Group:		Development/C

%description	devel
This package contains the development headers for ProFTPD

%package	mod_ctrls_admin
Summary:	Module implementing admin control handlers
Group:		System/Servers
Requires(post): %{name} >= %{version}-%{release}
Requires(preun): %{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_ctrls_admin
This module implements administrative control actions for the ftpdctl program.

%package	mod_ifsession
Summary:	Module supporting conditional per-user/group/class configuration contexts
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_ifsession
Module supporting conditional per-user/group/class configuration contexts

%package	mod_ldap
Summary:	LDAP password lookup module for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_ldap
LDAP password lookup module for ProFTPD

%package	mod_quotatab
Summary:	Module for managing FTP byte/file quotas via centralized tables
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_quotatab_driver = %{version}-%{release}

%description	mod_quotatab
Module for managing FTP byte/file quotas via centralized tables

%package	mod_quotatab_file
Summary:	Sub-module for managing quota data via file-based tables
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_quotatab = %{version}-%{release}
Provides:	%{name}-mod_quotatab_driver = %{version}-%{release}

%description	mod_quotatab_file
Sub-module for managing quota data via file-based tables

%package	mod_quotatab_ldap
Summary:	Sub-module for obtaining quota information from an LDAP directory
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_quotatab = %{version}-%{release}
Provides:	%{name}-mod_quotatab_driver = %{version}-%{release}

%description	mod_quotatab_ldap
Sub-module for obtaining quota information from an LDAP directory

%package	mod_quotatab_sql
Summary:	Sub-module for managing quota data via SQL-based tables
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_quotatab = %{version}-%{release}
Provides:	%{name}-mod_quotatab_driver = %{version}-%{release}

%description	mod_quotatab_sql
Sub-module for managing quota data via SQL-based tables

%package	mod_quotatab_radius
Summary:	Sub-module for managing quota data via radius
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_quotatab = %{version}-%{release}
Provides:	%{name}-mod_quotatab_driver = %{version}-%{release}

%description	mod_quotatab_radius
Sub-module for managing quota data via radius

%package	mod_radius
Summary:	Module for RADIUS authentication and accounting
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_radius
Module for RADIUS authentication and accounting

%package	mod_ratio
Summary:	Support upload/download ratios
Group:		System/Servers
Requires(post): %{name} >= %{version}-%{release}
Requires(preun): %{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_ratio
Support upload/download ratios

%package	mod_rewrite
Summary:	Module for rewriting FTP commands
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_rewrite
Module for rewriting FTP commands

%package	mod_site_misc
Summary:	Module implementing miscellaneous SITE commands
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_site_misc
Module implementing miscellaneous SITE commands

%package	mod_sql
Summary:	SQL frontend
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_sql_driver = %{version}-%{release}

%description	mod_sql
SQL frontend

%package	mod_sql_mysql
Summary:	Support for connecting to MySQL databases
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_sql = %{version}-%{release}
Provides:	%{name}-mod_sql_driver = %{version}-%{release}

%description	mod_sql_mysql
Support for connecting to MySQL databases

%package	mod_sql_postgres
Summary:	Support for connecting to Postgres databases
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_sql = %{version}-%{release}
Provides:	%{name}-mod_sql_driver = %{version}-%{release}

%description	mod_sql_postgres
Support for connecting to Postgres databases

%package	mod_sql_sqlite
Summary:	Support for connecting to SQLite3 databases
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_sql = %{version}-%{release}
Provides:	%{name}-mod_sql_driver = %{version}-%{release}

%description	mod_sql_sqlite
Support for connecting to SQLite3 databases

%package	mod_sql_passwd
Summary:	Various SQL password handlers
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_sql = %{version}-%{release}
Provides:	%{name}-mod_sql_driver = %{version}-%{release}

%description	mod_sql_passwd
Various SQL password handlers

%package	mod_tls
Summary:	An RFC2228 SSL/TLS module for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_tls
An RFC2228 SSL/TLS module for ProFTPD

%package	mod_tls_shmcache
Summary:	A module which provides a shared SSL session cache using SysV shared memory
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_tls = %{version}-%{release}

%description	mod_tls_shmcache
This submodule provides a SysV shared memory-based implementation of an
external SSL session cache for use by the mod_tls module's TLSSessionCache
directive.

%package	mod_tls_memcache
Summary:	A module which provides a shared SSL session cache using memcached servers
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_tls = %{version}-%{release}
Recommends:	memcached

%description	mod_tls_memcache
This submodule a memcached-based implementation of an external SSL session
cache for use by the mod_tls module's TLSSessionCache directive.

%package	mod_autohost
Summary:	An autohost module for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_autohost
For sites that run a large number of <VirtualHost>s for proftpd, it can be
cumbersome to configure them all in the proftpd.conf file. Adding or removing
virtual server configurations require restarting the daemon, as do changes to
one of the server configurations. The daemon also consumes memory for each
server configuration, and the memory footprint for the daemon process can grow
large for large numbers of servers.

The mod_autohost module allows for server configurations to be configured in
individual files, and for those configuration to be used in an "on demand"
fashion. Rather than loading the configurations into memory when the daemon
starts up, the daemon will check the IP address and port being contacted by a
connecting client, check in the filesystem for a mod_autohost configuration
file for that address/port, dynamically parse the configuration, and insert
the configuration into the session's process space. Thus changes to the
configuration are seen whenever a client connects, without requiring a daemon
restart. The memory footprint is reduced because proftpd, via mod_autohost,
only reads and uses the needed configuration.

%package	mod_case
Summary:	Makes ProFTPD case insensitive
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_case
The mod_case module is designed to help ProFTPD be case-insensitive, for those
sites that may need it (e.g. those that are migrating from a Windows
environment or have mounted Windows filesystems).

mod_case works by performing two checks on the filename used in FTP commands.
First, mod_case will scan the directory to see if there is already a file whose
name exactly matches the given filename. If not, mod_case will scan the
directory again, this time looking for case-insensitive matches. 

%package	mod_gss
Summary:	A Kerberos 5 GSS module for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_gss
A Kerberos 5 GSS module for ProFTPD

%package	mod_load
Summary:	A module that determines average load for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_load
The code for determining load average on a given system is hairy, to say the
least. Unfortunately, it is necessary to do it this way, as there is no
standard method for extracting such information from the kernel. This module
uses code from GNU's make application, which should function properly. If not,
please contact the author as soon as possible.

%package	mod_shaper
Summary:	A shaping module for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_shaper
The mod_shaper module is designed to split overall rates, both download and
upload, for the proftpd daemon among all connected FTP clients, shaping each
session to use only a portion of the overall rate. mod_shaper shapes both
transmitted traffic, e.g. bits being downloaded via the RETR command, and
received traffic, e.g. bits being uploaded via the APPE, STOR, and STOU
commands.

%package	mod_wrap
Summary:	Provides tcpwrapper-like access control rules for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_wrap_driver = %{version}-%{release}
Requires:	tcp_wrappers

%description	mod_wrap
The mod_wrap package allows the proftpd daemon to provide tcpwrapper-like
access control rules while running in standalone mode. It also allows for those
access rules to be stored in various formats, such as files (e.g.
/etc/hosts.allow and /etc/hosts.deny) or in SQL tables.

The most current version of mod_wrap's submodules supports storage of access
table information in various formats:

 o mod_wrap_file for file-based access tables
 o mod_wrap_sql for SQL-based access tables

%package	mod_wrap_file
Summary:	A file-specific driver for the mod_wrap module for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}
Provides:	%{name}-mod_wrap_driver = %{version}-%{release}

%description	mod_wrap_file
This submodule provides the file-specific "driver" for storing IP/DNS-based
access control information in files.

%package	mod_wrap_sql
Summary:	A SQL database driver for the mod_wrap module for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}
Provides:	%{name}-mod_wrap_driver = %{version}-%{release}

%description	mod_wrap_sql
This submodule provides the SQL database "driver" for storing IP/DNS-based
access control information in SQL tables.

%package	mod_ban
Summary:	Adds dynamic "ban" lists to ProFTPD
Group:		System/Servers
Requires(post): %{name} >= %{version}-%{release}
Requires(preun): %{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_ban
The mod_ban module is designed to add dynamic "ban" lists to proftpd. A ban
prevents the banned user, host, or class from logging in to the server; it does
not prevent the banned user, host, or class from connecting to the server.
mod_ban is not a firewall. The module also provides automatic bans that are
triggered based on configurable criteria.

%package	mod_vroot
Summary:	Adds virtual chroot capability to ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_vroot
The purpose of this module to is to implement a virtual chroot capability that
does not require root privileges. The mod_vroot module provides this capability
by using ProFTPD's FS API, available as of 1.2.8rc1.

%package	mod_sftp
Summary:	Implements the SSH2 protocol and its SFTP subsystem for ProFTPD
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_sftp
The mod_sftp module implements the SSH2 protocol and its SFTP subsystem, for
secure file transfer over an SSH2 connection. The mod_sftp module supports:

 o Public key authentication
 o Password authentication (e.g. user authentication via mod_sql, mod_ldap,
   mod_auth_file, mod_auth_unix, mod_auth_pam)
 o SCP support
 o Quotas (via the mod_quotatab module)
 o FIPS support (see Usage section)
 o Throttled transfers (via TransferRate, and/or the mod_shaper module)
 o Blacklisted public keys
 o Configurable traffic analysis protection
 o Passphrase-protected host keys 

%package	mod_sftp_pam
Summary:	A module which provides an SSH2 "keyboard-interactive" driver using PAM
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_sftp >= %{version}-%{release}

%description	mod_sftp_pam
The mod_sftp_pam module provides support for the "SSH Keyboard-Interactive
Authentication" RFC (RFC4256).

%package	mod_sftp_sql
Summary:	SQL backend module for retrieving authorized keys
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}
Requires:	%{name}-mod_sftp >= %{version}-%{release}
Requires:	%{name}-mod_sql >= %{version}-%{release}

%description	mod_sftp_sql
The mod_sftp module for ProFTPD can support different storage formats for its
user- and host-based authorized keys. By default, the mod_sftp module supports
storing authorized keys in flats. This mod_sftp_sql module allows for
authorized SSH keys to be stored in SQL tables.

%package	mod_memcache
Summary:	A module for managing memcache data
Group:		System/Servers
Requires(post):	%{name} >= %{version}-%{release}
Requires(preun):	%{name} >= %{version}-%{release}
Requires:	%{name} >= %{version}-%{release}

%description	mod_memcache
The mod_memcache module enables ProFTPD support for caching data in memcached
servers, using the libmemcached client library.

%prep

%setup -q -n %{name}-%{version} -a100 -a102 -a103 -a108

%patch0 -p0 -b .logfile_location
%patch2 -p0 -b .pam
%patch4 -p1 -b .installfix
%patch7 -p0 -b .change_pam_name
%patch8 -p1
%patch41 -p1 -b .CVE-2019-12815
%patch42 -p1 -b .CVE-2019-18217
%patch43 -p1 -b .CVE-2019-19269

pushd mod_gss-%{mod_gss_version}
%patch40 -p1 -b .format_not_a_string_literal_and_no_format_arguments
popd

# ours config
mkdir -p %{_vendor}
install -m0644 %{SOURCE1} %{_vendor}/proftpd.logrotate
install -m0644 %{SOURCE2} %{_vendor}/proftpd.xinetd
install -m0644 %{SOURCE3} %{_vendor}/proftpd.init
install -m0644 %{SOURCE4} %{_vendor}/proftpd.service
install -m0644 %{SOURCE5} %{_vendor}/basic.conf
install -m0644 %{SOURCE7} %{_vendor}/welcome.msg
install -m0644 %{SOURCE32} %{_vendor}/32_mod_shaper.conf

# lib64 fix
perl -pi -e "s|/usr/lib|%{_libdir}|g" %{_vendor}/basic.conf

# fix includes, instead of a patch
perl -pi -e "s|\<mysql\.h\>|\<mysql\/mysql\.h\>|g" contrib/mod_sql_mysql.c


%build

%serverbuild

export CFLAGS="$CFLAGS -DLDAP_DEPRECATED -DUSE_LDAP_TLS -DHAVE_OPENSSL"

pushd mod_gss-%{mod_gss_version}
perl -pi -e "s|<gssapi.h>|<gssapi/gssapi.h>|" configure*
perl -pi -e "s|NULL,code|kc,code|" *.in

%configure2_5x

# Workaround a missing dcl in kerberos...
cat >> mod_gss.h <<EOF
#ifndef GSS_C_AF_INET6
#define GSS_C_AF_INET6 24
#endif
EOF
popd

pushd contrib/mod_load
%configure2_5x
popd

pushd contrib/mod_wrap2
%configure2_5x
popd

# put extra modules in place 
for i in `find mod_* -type f -name "*.c"` `find mod_* -type f -name "*.h"`; do
    cp $i contrib/
done


%configure2_5x \
    --libexecdir=%{_libdir}/%{name} \
    --enable-auth-pam \
    --enable-cap \
    --disable-facl \
    --enable-dso \
    --enable-nls \
    --enable-openssl \
    --with-lastlog=/var/log/lastlog \
    --enable-ipv6 \
    --enable-shadow \
    --enable-ctrls \
    --with-shared="mod_ratio:mod_tls:mod_tls_shmcache:mod_radius:mod_ldap:mod_sql:mod_sql_mysql:mod_sql_postgres:mod_sql_sqlite:mod_sql_passwd:mod_rewrite:mod_gss:mod_load:mod_ctrls_admin:mod_quotatab:mod_quotatab_file:mod_quotatab_ldap:mod_quotatab_sql:mod_quotatab_radius:mod_site_misc:mod_wrap2:mod_wrap2_file:mod_wrap2_sql:mod_autohost:mod_case:mod_shaper:mod_ban:mod_vroot:mod_sftp:mod_sftp_pam:mod_sftp_sql:mod_ifsession:mod_memcache:mod_tls_memcache" \
    --with-modules="mod_readme:mod_auth_pam" \
    --disable-strip \
    --enable-pcre


# libcap hack
perl -pi -e "s|/lib/libcap|/blabla|g" Make.rules
echo "#define HAVE_LINUX_CAPABILITY_H 1" >> config.h

%make


%install
install -d %{buildroot}%{_initrddir}
install -d %{buildroot}%{_libdir}/%{name}
install -d %{buildroot}%{_sysconfdir}/logrotate.d
install -d %{buildroot}%{_sysconfdir}/%{name}.d
install -d %{buildroot}%{_sysconfdir}/pam.d
install -d %{buildroot}%{_sysconfdir}/xinetd.d
install -d %{buildroot}%{_localstatedir}/ftp/pub
install -d %{buildroot}%{_localstatedir}/log/%{name}
install -D -p -m 0644 %{SOURCE150} %{buildroot}%{_tmpfilesdir}/%{name}.conf

%makeinstall \
    LIBEXECDIR=%{buildroot}%{_libdir}/%{name} \
    SHARED_MODULE_DIRS="" \
    pkgconfigdir=%{buildroot}%{_libdir}/pkgconfig

# fix borked pkgconfig file
perl -pi -e "s|^prefix.*|prefix=%{_prefix}|g" %{buildroot}%{_libdir}/pkgconfig/*.pc
perl -pi -e "s|/lib/|/%{_lib}/|g" %{buildroot}%{_libdir}/pkgconfig/*.pc

%makeinstall -C contrib/mod_wrap2 LIBEXECDIR=%{buildroot}%{_libdir}/%{name}
%makeinstall -C contrib/mod_load LIBEXECDIR=%{buildroot}%{_libdir}/%{name}
%makeinstall -C contrib/mod_sftp LIBEXECDIR=%{buildroot}%{_libdir}/%{name}

install -m0644 contrib/dist/rpm/ftp.pamd %{buildroot}%{_sysconfdir}/pam.d/%{name}
install -m0755 contrib/xferstats.holger-preiss %{buildroot}%{_sbindir}

install -m0644 %{_vendor}/proftpd.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -m0644 %{_vendor}/proftpd.xinetd %{buildroot}%{_sysconfdir}/xinetd.d/%{name}-xinetd
install -m0755 %{_vendor}/proftpd.init %{buildroot}%{_initrddir}/%{name}
install -m0644 %{_vendor}/basic.conf %{buildroot}%{_sysconfdir}/%{name}.conf
install -m0644 %{_vendor}/welcome.msg %{buildroot}%{_localstatedir}/ftp/pub/welcome.msg

install -m0644 %{SOURCE200} %{buildroot}%{_sysconfdir}/proftpd-anonymous.conf

ln -snf %{name} %{buildroot}%{_sbindir}/in.%{name}
ln -snf %{name} %{buildroot}%{_sbindir}/in.ftpd

# config
echo "LoadModule mod_ctrls_admin.c" > %{buildroot}%{_sysconfdir}/%{name}.d/10_mod_ctrls_admin.conf
echo "LoadModule mod_tls.c" > %{buildroot}%{_sysconfdir}/%{name}.d/11_mod_tls.conf
echo "LoadModule mod_tls_shmcache.c" > %{buildroot}%{_sysconfdir}/%{name}.d/12_mod_tls_shmcache.conf
echo "LoadModule mod_sql.c" > %{buildroot}%{_sysconfdir}/%{name}.d/12_mod_sql.conf
echo "LoadModule mod_ldap.c" > %{buildroot}%{_sysconfdir}/%{name}.d/13_mod_ldap.conf
echo "LoadModule mod_sql_mysql.c" > %{buildroot}%{_sysconfdir}/%{name}.d/14_mod_sql_mysql.conf
echo "LoadModule mod_sql_postgres.c" > %{buildroot}%{_sysconfdir}/%{name}.d/15_mod_sql_postgres.conf
echo "LoadModule mod_sql_sqlite.c" > %{buildroot}%{_sysconfdir}/%{name}.d/16_mod_sql_sqlite.conf
echo "LoadModule mod_sql_passwd.c" > %{buildroot}%{_sysconfdir}/%{name}.d/17_mod_sql_passwd.conf
echo "LoadModule mod_quotatab.c" > %{buildroot}%{_sysconfdir}/%{name}.d/16_mod_quotatab.conf
echo "LoadModule mod_quotatab_file.c" > %{buildroot}%{_sysconfdir}/%{name}.d/17_mod_quotatab_file.conf
echo "LoadModule mod_quotatab_ldap.c" > %{buildroot}%{_sysconfdir}/%{name}.d/18_mod_quotatab_ldap.conf
echo "LoadModule mod_quotatab_sql.c" > %{buildroot}%{_sysconfdir}/%{name}.d/19_mod_quotatab_sql.conf
echo "LoadModule mod_quotatab_radius.c" > %{buildroot}%{_sysconfdir}/%{name}.d/20_mod_quotatab_radius.conf
echo "LoadModule mod_radius.c" > %{buildroot}%{_sysconfdir}/%{name}.d/20_mod_radius.conf
echo "LoadModule mod_wrap2.c" > %{buildroot}%{_sysconfdir}/%{name}.d/21_mod_wrap2.conf
echo "LoadModule mod_wrap2_file.c" > %{buildroot}%{_sysconfdir}/%{name}.d/22_mod_wrap2_file.conf
echo "LoadModule mod_wrap2_sql.c" > %{buildroot}%{_sysconfdir}/%{name}.d/23_mod_wrap2_sql.conf
echo "LoadModule mod_rewrite.c" > %{buildroot}%{_sysconfdir}/%{name}.d/24_mod_rewrite.conf
echo "LoadModule mod_ratio.c" > %{buildroot}%{_sysconfdir}/%{name}.d/25_mod_ratio.conf
echo "LoadModule mod_gss.c" > %{buildroot}%{_sysconfdir}/%{name}.d/26_mod_gss.conf
echo "LoadModule mod_autohost.c" > %{buildroot}%{_sysconfdir}/%{name}.d/27_mod_autohost.conf
echo "LoadModule mod_case.c" > %{buildroot}%{_sysconfdir}/%{name}.d/28_mod_case.conf
echo "LoadModule mod_load.c" > %{buildroot}%{_sysconfdir}/%{name}.d/31_mod_load.conf
install -m0644 %{_vendor}/32_mod_shaper.conf %{buildroot}%{_sysconfdir}/%{name}.d/32_mod_shaper.conf
echo "LoadModule mod_site_misc.c" > %{buildroot}%{_sysconfdir}/%{name}.d/33_mod_site_misc.conf
echo "LoadModule mod_ban.c" > %{buildroot}%{_sysconfdir}/%{name}.d/35_mod_ban.conf
echo "LoadModule mod_vroot.c" > %{buildroot}%{_sysconfdir}/%{name}.d/36_mod_vroot.conf
echo "LoadModule mod_sftp.c" > %{buildroot}%{_sysconfdir}/%{name}.d/37_mod_sftp.conf
echo "LoadModule mod_sftp_pam.c" > %{buildroot}%{_sysconfdir}/%{name}.d/38_mod_sftp_pam.conf
echo "LoadModule mod_sftp_sql.c" > %{buildroot}%{_sysconfdir}/%{name}.d/39_mod_sftp_sql.conf
echo "LoadModule mod_memcache.c" > %{buildroot}%{_sysconfdir}/%{name}.d/40_mod_memcache.conf
echo "LoadModule mod_tls_memcache.c" > %{buildroot}%{_sysconfdir}/%{name}.d/41_mod_tls_memcache.conf

cat > %{buildroot}%{_sysconfdir}/%{name}.d/99_mod_ifsession.conf << EOF
# keep this module the last one
LoadModule mod_ifsession.c
EOF

%find_lang %{name}

# cleanup
find %{buildroot} -name '*.la' -delete
find %{buildroot} -name '*.a' -delete
rm -f contrib/README.mod_sql contrib/README.linux-privs

cat > %{buildroot}%{_sysconfdir}/ftpusers << EOF
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
EOF

%post
%_tmpfilescreate %{name}
%_post_service %{name}

%pre
%_pre_useradd ftp /var/ftp /bin/false

%postun
%_postun_userdel ftp

%preun
%_preun_service %{name}

%files -f %{name}.lang
%doc README* INSTALL NEWS CREDITS COPYING doc/* 
%doc sample-configurations/*
%dir %{_sysconfdir}/proftpd.d
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/%{name}-anonymous.conf
%config(noreplace) %{_sysconfdir}/pam.d/%{name}
%config(noreplace) %{_sysconfdir}/xinetd.d/%{name}-xinetd
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/ftpusers
%{_initrddir}/%{name}
%{_sbindir}/%{name}
%{_sbindir}/ftpscrub
%{_sbindir}/ftpshut
%{_sbindir}/in.ftpd
%{_sbindir}/in.%{name}
%{_sbindir}/xferstats.holger-preiss
%{_bindir}/ftpasswd
%{_bindir}/ftpcount
%{_bindir}/ftpdctl
%{_bindir}/ftpmail
%{_bindir}/ftpquota
%{_bindir}/ftptop
%{_bindir}/ftpwho
%{_bindir}/prxs
%dir %{_libdir}/%{name}
%dir %{_localstatedir}/ftp
%dir %{_localstatedir}/ftp/pub
%config(noreplace) %{_localstatedir}/ftp/pub/welcome.msg
%{_tmpfilesdir}/%{name}.conf
%dir %{_localstatedir}/log/%{name}
%{_mandir}/man*/*

%files devel
%doc ChangeLog
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*.h
%{_libdir}/pkgconfig/*.pc

%files mod_ctrls_admin
%doc doc/contrib/mod_ctrls_admin.html
%config(noreplace) %{_sysconfdir}/%{name}.d/10_mod_ctrls_admin.conf
%{_libdir}/%{name}/mod_ctrls_admin.so

%files mod_ifsession
%doc doc/contrib/mod_ifsession.html
%config(noreplace) %{_sysconfdir}/%{name}.d/99_mod_ifsession.conf
%{_libdir}/%{name}/mod_ifsession.so

%files mod_ldap
%config(noreplace) %{_sysconfdir}/%{name}.d/13_mod_ldap.conf
%{_libdir}/%{name}/mod_ldap.so

%files mod_quotatab
%doc doc/contrib/mod_quotatab.html
%config(noreplace) %{_sysconfdir}/%{name}.d/16_mod_quotatab.conf
%{_libdir}/%{name}/mod_quotatab.so

%files mod_quotatab_file
%doc doc/contrib/mod_quotatab_file.html
%config(noreplace) %{_sysconfdir}/%{name}.d/17_mod_quotatab_file.conf
%{_libdir}/%{name}/mod_quotatab_file.so

%files mod_quotatab_ldap
%doc doc/contrib/mod_quotatab_ldap.html
%config(noreplace) %{_sysconfdir}/%{name}.d/18_mod_quotatab_ldap.conf
%{_libdir}/%{name}/mod_quotatab_ldap.so

%files mod_quotatab_sql
%doc doc/contrib/mod_quotatab_sql.html
%config(noreplace) %{_sysconfdir}/%{name}.d/19_mod_quotatab_sql.conf
%{_libdir}/%{name}/mod_quotatab_sql.so

%files mod_quotatab_radius
%doc doc/contrib/mod_quotatab_radius.html
%config(noreplace) %{_sysconfdir}/%{name}.d/20_mod_quotatab_radius.conf
%{_libdir}/%{name}/mod_quotatab_radius.so

%files mod_radius
%doc doc/contrib/mod_radius.html
%config(noreplace) %{_sysconfdir}/%{name}.d/20_mod_radius.conf
%{_libdir}/%{name}/mod_radius.so

%files mod_ratio
%doc contrib/README.ratio
%config(noreplace) %{_sysconfdir}/%{name}.d/25_mod_ratio.conf
%{_libdir}/%{name}/mod_ratio.so

%files mod_rewrite
%doc doc/contrib/mod_rewrite.html
%config(noreplace) %{_sysconfdir}/%{name}.d/24_mod_rewrite.conf
%{_libdir}/%{name}/mod_rewrite.so

%files mod_site_misc
%doc doc/contrib/mod_site_misc.html
%config(noreplace) %{_sysconfdir}/%{name}.d/33_mod_site_misc.conf
%{_libdir}/%{name}/mod_site_misc.so

%files mod_sql
%doc doc/contrib/mod_sql.html
%config(noreplace) %{_sysconfdir}/%{name}.d/12_mod_sql.conf
%{_libdir}/%{name}/mod_sql.so

%files mod_sql_mysql
%config(noreplace) %{_sysconfdir}/%{name}.d/14_mod_sql_mysql.conf
%{_libdir}/%{name}/mod_sql_mysql.so

%files mod_sql_postgres
%config(noreplace) %{_sysconfdir}/%{name}.d/15_mod_sql_postgres.conf
%{_libdir}/%{name}/mod_sql_postgres.so

%files mod_sql_sqlite
%config(noreplace) %{_sysconfdir}/%{name}.d/16_mod_sql_sqlite.conf
%{_libdir}/%{name}/mod_sql_sqlite.so

%files mod_sql_passwd
%config(noreplace) %{_sysconfdir}/%{name}.d/17_mod_sql_passwd.conf
%{_libdir}/%{name}/mod_sql_passwd.so

%files mod_tls
%doc doc/contrib/mod_tls.html
%config(noreplace) %{_sysconfdir}/%{name}.d/11_mod_tls.conf
%{_libdir}/%{name}/mod_tls.so

%files mod_tls_shmcache
%doc doc/contrib/mod_tls_shmcache.html
%config(noreplace) %{_sysconfdir}/%{name}.d/12_mod_tls_shmcache.conf
%{_libdir}/%{name}/mod_tls_shmcache.so

%files mod_tls_memcache
%doc doc/contrib/mod_tls_memcache.html
%config(noreplace) %{_sysconfdir}/%{name}.d/41_mod_tls_memcache.conf
%{_libdir}/%{name}/mod_tls_memcache.so

%files mod_autohost
%doc mod_autohost/mod_autohost.html
%config(noreplace) %{_sysconfdir}/%{name}.d/27_mod_autohost.conf
%{_libdir}/%{name}/mod_autohost.so

%files mod_case
%doc mod_case/mod_case.html
%config(noreplace) %{_sysconfdir}/%{name}.d/28_mod_case.conf
%{_libdir}/%{name}/mod_case.so

%files mod_gss
%doc mod_gss-*/COPYING mod_gss-*/mod_gss.html mod_gss-*/README.mod_gss mod_gss-*/rfc1509.txt mod_gss-*/rfc2228.txt
%config(noreplace) %{_sysconfdir}/%{name}.d/26_mod_gss.conf
%{_libdir}/%{name}/mod_gss.so

%files mod_load
%doc doc/contrib/mod_load.html
%config(noreplace) %{_sysconfdir}/%{name}.d/31_mod_load.conf
%{_libdir}/%{name}/mod_load.so

%files mod_shaper
%doc doc/contrib/mod_shaper.html
%config(noreplace) %{_sysconfdir}/%{name}.d/32_mod_shaper.conf
%{_libdir}/%{name}/mod_shaper.so

%files mod_wrap
%doc doc/contrib/mod_wrap2.html
%config(noreplace) %{_sysconfdir}/%{name}.d/21_mod_wrap2.conf
%{_libdir}/%{name}/mod_wrap2.so

%files mod_wrap_file
%doc doc/contrib/mod_wrap2_file.html
%config(noreplace) %{_sysconfdir}/%{name}.d/22_mod_wrap2_file.conf
%{_libdir}/%{name}/mod_wrap2_file.so

%files mod_wrap_sql
%doc doc/contrib/mod_wrap2_sql.html
%config(noreplace) %{_sysconfdir}/%{name}.d/23_mod_wrap2_sql.conf
%{_libdir}/%{name}/mod_wrap2_sql.so

%files mod_ban
%doc doc/contrib/mod_ban.html
%config(noreplace) %{_sysconfdir}/%{name}.d/35_mod_ban.conf
%{_libdir}/%{name}/mod_ban.so

%files mod_vroot
%doc mod_vroot/mod_vroot.html
%config(noreplace) %{_sysconfdir}/%{name}.d/36_mod_vroot.conf
%{_libdir}/%{name}/mod_vroot.so

%files mod_sftp
%doc doc/contrib/mod_sftp.html
%config(noreplace) %{_sysconfdir}/blacklist.dat
%config(noreplace) %{_sysconfdir}/dhparams.pem
%config(noreplace) %{_sysconfdir}/%{name}.d/37_mod_sftp.conf
%{_libdir}/%{name}/mod_sftp.so

%files mod_sftp_pam
%doc doc/contrib/mod_sftp_pam.html
%config(noreplace) %{_sysconfdir}/%{name}.d/38_mod_sftp_pam.conf
%{_libdir}/%{name}/mod_sftp_pam.so

%files mod_sftp_sql
%doc doc/contrib/mod_sftp_sql.html
%config(noreplace) %{_sysconfdir}/%{name}.d/39_mod_sftp_sql.conf
%{_libdir}/%{name}/mod_sftp_sql.so

%files mod_memcache
%doc doc/modules/mod_memcache.html
%config(noreplace) %{_sysconfdir}/%{name}.d/40_mod_memcache.conf
%{_libdir}/%{name}/mod_memcache.so

# automatic reloading for new plugins
%transfiletriggerin -- %{_sysconfdir}/proftpd.d/
systemctl try-restart proftpd.service


%changelog
* Wed Dec 11 2019 mrambo3501 <mrambo3501> 1.3.5e-4.2.mga7
+ Revision: 1465940
- rediff debian patch which fixes CVE-2019-19269 (mga#25844)
- add debian patches which fix CVE-2019-12815 and CVE-2019-18217 (mga#25287)

* Sun Sep 23 2018 umeabot <umeabot> 1.3.5e-4.mga7
+ Revision: 1300380
- Mageia 7 Mass Rebuild

* Sat Dec 23 2017 wally <wally> 1.3.5e-3.mga7
+ Revision: 1184224
- rebuild for new mariadb

* Wed Aug 30 2017 guillomovitch <guillomovitch> 1.3.5e-2.mga7
+ Revision: 1148591
- rebuild for latest openssl

* Mon Apr 10 2017 luigiwalser <luigiwalser> 1.3.5e-1.mga6
+ Revision: 1096237
- 1.3.5e

* Mon Jan 16 2017 luigiwalser <luigiwalser> 1.3.5d-1.mga6
+ Revision: 1082006
- 1.3.5d

* Sun Jan 15 2017 luigiwalser <luigiwalser> 1.3.5c-1.mga6
+ Revision: 1081839
- 1.3.5c

* Fri Mar 11 2016 luigiwalser <luigiwalser> 1.3.5b-1.mga6
+ Revision: 989154
- 1.3.5b
- remove upstreamed patch9

* Thu Mar 03 2016 umeabot <umeabot> 1.3.5a-4.mga6
+ Revision: 983931
- Rebuild for openssl

* Sun Feb 28 2016 oden <oden> 1.3.5a-3.mga6
+ Revision: 980345
- rebuilt for postgresql 9.5.x

* Fri Feb 12 2016 doktor5000 <doktor5000> 1.3.5a-2.mga6
+ Revision: 957478
- put new filetriggers at the very end
  o otherwise greedily includes up to next macro
- drop old deprecated filetriggers
- add transaction-based filetrigger

* Tue Dec 15 2015 luigiwalser <luigiwalser> 1.3.5a-1.mga6
+ Revision: 910575
- 1.3.5a

* Tue Dec 15 2015 luigiwalser <luigiwalser> 1.3.5-6.mga6
+ Revision: 910569
- add patches from fedora to fix upstream bugs 4206 and 4210

* Tue Nov 25 2014 cjw <cjw> 1.3.5-5.mga5
+ Revision: 798982
- rebuild against postgresql9.4

* Wed Oct 15 2014 umeabot <umeabot> 1.3.5-4.mga5
+ Revision: 745314
- Second Mageia 5 Mass Rebuild

* Sat Sep 27 2014 tv <tv> 1.3.5-3.mga5
+ Revision: 729462
- add exclude

* Tue Sep 16 2014 umeabot <umeabot> 1.3.5-2.mga5
+ Revision: 687791
- Mageia 5 Mass Rebuild
+ tv <tv>
- s/uggests:/Recommends:/

* Tue Sep 09 2014 luigiwalser <luigiwalser> 1.3.5-1.mga5
+ Revision: 674395
- 1.3.5
- rediff patch 4
- drop patch 10 (no longer needed)
- drop mod_time (no longer builds)

* Fri May 16 2014 luigiwalser <luigiwalser> 1.3.4e-1.mga5
+ Revision: 623017
- 1.3.4e
- drop upstreamed patch 42

* Sun Oct 20 2013 umeabot <umeabot> 1.3.4d-3.mga4
+ Revision: 536771
- Mageia 4 Mass Rebuild

* Tue Sep 24 2013 luigiwalser <luigiwalser> 1.3.4d-2.mga4
+ Revision: 485501
- add patch from fedora to fix CVE-2013-4359
+ fwang <fwang>
- cleanup spec

* Sat Jun 15 2013 fwang <fwang> 1.3.4d-1.mga4
+ Revision: 443214
- new version 1.3.4d

* Sun Mar 24 2013 colin <colin> 1.3.4c-2.mga3
+ Revision: 404859
- Add systemd requires and general post/pre fixes (mga#9302)

* Thu Mar 14 2013 luigiwalser <luigiwalser> 1.3.4c-1.mga3
+ Revision: 403223
- 1.3.4c
- CVE-2012-6095 patch upstreamed

* Tue Feb 12 2013 luigiwalser <luigiwalser> 1.3.4b-6.mga3
+ Revision: 397951
- also conflicts with vsftpd

* Tue Jan 15 2013 luigiwalser <luigiwalser> 1.3.4b-5.mga3
+ Revision: 388146
- add patch from debian to fix CVE-2012-6095

* Sun Jan 13 2013 umeabot <umeabot> 1.3.4b-4.mga3
+ Revision: 378232
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild

* Sat Jan 12 2013 colin <colin> 1.3.4b-3.mga3
+ Revision: 358828
- Reapply filetrigger reload changes r129946 lost after import
- Reapply ftpusers fix r129950 lost after import
- Reapply xinetd fixes (r129948 and r129949) lost on import
- Reapply tmpfiles conversion after it was lost on import
- Use systemctl in favour of service

* Sat Jan 12 2013 colin <colin> 1.3.4b-2.mga3
+ Revision: 358377
- Rebuild (testing rpmlint)

* Wed Jan 02 2013 juancho <juancho> 1.3.4b-1.mga3
+ Revision: 337542
- Added missing %%mkrel macro on the release.
+ bersuit <bersuit>
- New version 1.3.4b, import from mdv 2012 package

* Sun Dec 16 2012 colin <colin> 1.3.3g-3.mga3
+ Revision: 331662
- Fix stupid typo in tmpfiles

* Sat Dec 15 2012 colin <colin> 1.3.3g-2.mga3
+ Revision: 331311
- Switch to tmpfiles for /run dir

* Mon Jan 02 2012 dmorgan <dmorgan> 1.3.3g-1.mga2
+ Revision: 189507
- Fix init script
- New version 1.3.3g
+ misc <misc>
- make ftpusers a real configuration managed like the others
- also clean %%postun from xinetd related stuff
- remove old script to install xinetd if present, as this is already
  done by xinetd rpm
- fix useless use of cat
- replace old script by a filetrigger ( thus removing 200 lines
  of cut and paste from the spec )
- remove old trigger, as it use a package dating back before 2008.1
- remove huge README.urpmi giving old news
- remove old conflicts against rpm we do not ship

* Sun May 15 2011 pterjan <pterjan> 1.3.3e-3.mga1
+ Revision: 99028
- Rebuild for fixed find-requires

* Thu Apr 21 2011 rapsys <rapsys> 1.3.3e-2.mga1
+ Revision: 89466
- Enable mod_sql_passwd module
  Fix buffer size to allow bw transfer over 1-2MB/s

* Mon Apr 18 2011 ahmad <ahmad> 1.3.3e-1.mga1
+ Revision: 87865
- Update to proftpd-1.3.3e
- Update to mod-vroot-0.9.2
- Fix License
- Improve description a bit
- Remove references of Mandriva in README.urpmi (mga#875); and improve the
  Anonymous access configuration part a bit

* Fri Mar 25 2011 dmorgan <dmorgan> 1.3.3d-2.mga1
+ Revision: 77248
- Rebuild against new mysql

* Fri Jan 21 2011 ennael <ennael> 1.3.3d-1.mga1
+ Revision: 30556
- imported package proftpd