From 70f48441b976cbaa5c7a80c2e4b4f635949e294f Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Thu, 25 Apr 2024 01:36:25 +0200 Subject: [PATCH] - merged changes from PLD --- proftpd-link.patch | 70 ++++++++ proftpd-pool.patch | 11 ++ proftpd-wtmp.patch | 39 +++++ proftpd.spec | 396 ++++++++++++++++++++++++++++++++++----------- 4 files changed, 426 insertions(+), 90 deletions(-) create mode 100644 proftpd-link.patch create mode 100644 proftpd-pool.patch create mode 100644 proftpd-wtmp.patch diff --git a/proftpd-link.patch b/proftpd-link.patch new file mode 100644 index 0000000..1a2a411 --- /dev/null +++ b/proftpd-link.patch @@ -0,0 +1,70 @@ +With -Werror=implicit-function-declaration prototypes must exist. + +mod_wrap doesn't need -lnsl (it's dependency of libwrap on some systems). + +--- proftpd-1.3.7a/configure.in.orig 2020-08-30 11:46:50.771847975 +0200 ++++ proftpd-1.3.7a/configure.in 2020-08-30 12:26:24.125657081 +0200 +@@ -1367,7 +1367,10 @@ + + dnl Checks for libraries. Yes, this is the hard way, but it's necessary. + AC_CACHE_CHECK(for standalone crypt,pr_cv_lib_standalone_crypt, +- AC_TRY_LINK(,[crypt();], ++ AC_TRY_LINK([ ++ #define _MISC_SOURCE ++ #include ++ ],[crypt("", "");], + pr_cv_lib_standalone_crypt="yes", pr_cv_lib_standalone_crypt="no" )) + + if test "$pr_cv_lib_standalone_crypt" = "no"; then +@@ -1375,7 +1378,7 @@ + fi + + AC_CACHE_CHECK(for standalone gethostbyname,pr_cv_lib_standalone_gethost, +- AC_TRY_LINK(,[gethostbyname();], ++ AC_TRY_LINK([#include ],[gethostbyname("");], + pr_cv_lib_standalone_gethost="yes", + pr_cv_lib_standalone_gethost="no" )) + +@@ -1385,7 +1388,12 @@ + fi + + AC_CACHE_CHECK(for standalone inet_aton,pr_cv_lib_standalone_aton, +- AC_TRY_LINK(,[inet_aton();], ++ AC_TRY_LINK([ ++ #define _DEFAULT_SOURCE ++ #include ++ #include ++ #include ++ ],[inet_aton("", (void*)0);], + pr_cv_lib_standalone_aton="yes", + pr_cv_lib_standalone_aton="no" )) + +@@ -1394,7 +1402,7 @@ + fi + + AC_CACHE_CHECK(for standalone nsl functions,pr_cv_lib_standalone_nsl,[ +- AC_TRY_LINK(,[gethostent();], ++ AC_TRY_LINK([#include ],[gethostent();], + pr_cv_lib_standalone_nsl="yes", pr_cv_lib_standalone_nsl="no") ]) + + if test "$pr_cv_lib_standalone_nsl" = "no"; then +@@ -1402,7 +1410,7 @@ + fi + + AC_CACHE_CHECK(for standalone socket functions,pr_cv_lib_standalone_sockets, +- AC_TRY_LINK(,[bind();], ++ AC_TRY_LINK([#include ],[bind(0, (void*)0, 0);], + pr_cv_lib_standalone_sockets="yes", pr_cv_lib_standalone_sockets="no")) + + if test "$pr_cv_lib_standalone_sockets" = "no"; then +--- proftpd-1.3.7a/contrib/mod_wrap.c.orig 2020-08-30 12:55:56.649387829 +0200 ++++ proftpd-1.3.7a/contrib/mod_wrap.c 2020-08-30 12:56:04.492678672 +0200 +@@ -22,7 +22,7 @@ + * the source code for OpenSSL in the source distribution. + * + * -- DO NOT MODIFY THE TWO LINES BELOW -- +- * $Libraries: -lwrap -lnsl$ ++ * $Libraries: -lwrap$ + */ + + #define MOD_WRAP_VERSION "mod_wrap/1.2.4" diff --git a/proftpd-pool.patch b/proftpd-pool.patch new file mode 100644 index 0000000..6ecaeba --- /dev/null +++ b/proftpd-pool.patch @@ -0,0 +1,11 @@ +--- proftpd-1.3.0/src/pool.c.orig 2005-03-08 18:06:39.000000000 +0100 ++++ proftpd-1.3.0/src/pool.c 2006-10-24 12:53:07.000000000 +0200 +@@ -47,7 +47,7 @@ + union align a; + + /* Padding */ +-#if defined(_LP64) || defined(__LP64__) ++#if defined(_LP64) || defined(__LP64__) || defined(__alpha__) + char pad[32]; + #endif + diff --git a/proftpd-wtmp.patch b/proftpd-wtmp.patch new file mode 100644 index 0000000..fb84cbd --- /dev/null +++ b/proftpd-wtmp.patch @@ -0,0 +1,39 @@ +diff -ruNp proftpd-1.3.5.orig/src/wtmp.c proftpd-1.3.5/src/wtmp.c +--- proftpd-1.3.5.orig/src/wtmp.c 2013-12-09 20:16:15.000000000 +0100 ++++ proftpd-1.3.5/src/wtmp.c 2015-04-03 11:47:21.710554599 +0200 +@@ -136,11 +136,33 @@ int log_wtmp(const char *line, const cha + struct utmp ut; + static int fd = -1; + ++#if defined(HAVE_UTMPX_H) ++#if !defined(WTMPX_FILE) && defined(_PATH_WTMPX) ++# define WTMPX_FILE _PATH_WTMPX ++#endif ++ static char *wtmp_file = NULL; ++ if (wtmp_file == NULL) { ++ if (access(WTMPX_FILE"x", F_OK) == 0) ++ wtmp_file = WTMPX_FILE"x"; ++ else if (access(WTMPX_FILE, F_OK) == 0) ++ wtmp_file = WTMPX_FILE; ++ else if (access(WTMP_FILE"x", F_OK) == 0) ++ wtmp_file = WTMP_FILE"x"; ++ else if (access(WTMP_FILE, F_OK) == 0) ++ wtmp_file = WTMP_FILE; ++ else { ++ pr_log_pri(PR_LOG_WARNING, "cannot find "WTMPX_FILE); ++ return -1; ++ } ++ } ++#else ++ static char *wtmp_file = WTMP_FILE; ++#endif + if (fd < 0 && +- (fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) < 0) { ++ (fd = open(wtmp_file, O_WRONLY|O_APPEND, 0)) < 0) { + int xerrno = errno; + +- pr_log_pri(PR_LOG_WARNING, "failed to open wtmp %s: %s", WTMP_FILE, ++ pr_log_pri(PR_LOG_WARNING, "failed to open wtmp %s: %s", wtmp_file, + strerror(xerrno)); + + errno = xerrno; diff --git a/proftpd.spec b/proftpd.spec index 60301d5..0a615a6 100644 --- a/proftpd.spec +++ b/proftpd.spec @@ -1,19 +1,22 @@ # TODO +# - test mod_clamav as DSO (README says it's allowed) # - mod_caps uses uname -r for detection # - don't use internal libltdl # - package contrib/ftp* perl scripts. # # Conditional build: -%bcond_without pam # disable PAM support -%bcond_without ipv6 # disable IPv6 and TCPD support -%bcond_without ssl # disbale TLS/SSL support -%bcond_without ldap # disable LDAP support -%bcond_without mysql # disable MySQL support -%bcond_without pgsql # disable PostgreSQL support -%bcond_without quotafile # disable quota file support -%bcond_without quotaldap # disable quota ldap support -%bcond_without quotamysql # disable quota mysql support -%bcond_without quotapgsql # disable quota pgsql support +%bcond_without pam # PAM support +%bcond_without ipv6 # IPv6 and TCPD support +%bcond_without ssl # TLS/SSL support +%bcond_without ldap # LDAP support +%bcond_without mysql # MySQL support +%bcond_without pgsql # PostgreSQL support +%bcond_without quotafile # quota file support +%bcond_without quotaldap # quota ldap support +%bcond_without quotamysql # quota mysql support +%bcond_without quotapgsql # quota pgsql support +%bcond_without wrap2file # wrap2 file support + # %define mod_clamav_version 0.13 @@ -24,15 +27,15 @@ Summary(pt_BR.UTF-8): Servidor FTP profissional, com sintaxe de configuração s Summary(zh_CN.UTF-8): 易于管理的,安全的 FTP 服务器 Name: proftpd Version: 1.3.7f -Release: 1 +Release: 4 Epoch: 2 License: GPL v2+ Group: Networking/Daemons Source0: ftp://ftp.proftpd.org/distrib/source/%{name}-%{version}.tar.gz # Source0-md5: 5dab21933de54926fa0bb0a51a5a8578 -# https://github.com/jbenden/mod_clamav -Source1: mod_clamav-%{mod_clamav_version}.tar.xz -# Source1-md5: 89ec19115d9ea7c7f4e0b0c4551e69bc +# https://github.com/jbenden/mod_clamav/releases +Source1: https://github.com/jbenden/mod_clamav/archive/v%{mod_clamav_version}/mod_clamav-%{mod_clamav_version}.tar.gz +# Source1-md5: 955269eb8b00ebcc217bbd6f74df4e1c Source2: %{name}.conf Source3: ftp.pamd Source4: %{name}.inetd @@ -49,11 +52,18 @@ Source14: %{name}-server.crt Source15: %{name}-server.key Patch0: %{name}-paths.patch Patch1: %{name}-noautopriv.patch +Patch2: %{name}-wtmp.patch +Patch3: %{name}-pool.patch +Patch4: %{name}-link.patch URL: http://www.proftpd.org/ +BuildRequires: GeoIP-devel BuildRequires: acl-devel BuildRequires: autoconf BuildRequires: automake +BuildRequires: hiredis-devel BuildRequires: libcap-devel +BuildRequires: libmemcached-devel +BuildRequires: libnsl-devel BuildRequires: libstdc++-devel BuildRequires: libwrap-devel %if %{with mysql} || %{with quotamysql} @@ -68,40 +78,15 @@ BuildRequires: openldap-devel %if %{with pgsql} || %{with quotapgsql} BuildRequires: postgresql-devel %endif -BuildRequires: rpmbuild(macros) >= 1.268 +BuildRequires: rpm-perlprov +BuildRequires: rpmbuild(macros) >= 1.745 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %define _sysconfdir /etc/proftpd %define _localstatedir /var/run %define _libexecdir %{_prefix}/%{_lib}/%{name} -# macro called at module post scriptlet -%define module_post \ -if [ "$1" = "1" ]; then \ - if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \ - %service -q rc-inetd reload \ - elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \ - %service -q proftpd restart \ - fi \ -fi - -# macro called at module postun scriptlet -%define module_postun \ -if [ "$1" = "0" ]; then \ - if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \ - %service -q rc-inetd reload \ - elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \ - %service -q proftpd restart \ - fi \ -fi - -# it's sooo annoying to write them -%define module_scripts() \ -%post %1 \ -%module_post \ -\ -%postun %1 \ -%module_postun +%define filterout -flto %description ProFTPD is a highly configurable FTP daemon for Unix and Unix-like @@ -175,8 +160,7 @@ Summary(pl.UTF-8): Pliki konfiguracyjne do użycia proftpd poprzez inetd Group: Networking/Daemons Requires(post): fileutils Requires(post): grep -Requires(post): sed >= 4.0 -Requires(triggerpostun): sed >= 4.0 +Requires(post,postun): sed >= 4.0 Requires: %{name}-common = %{epoch}:%{version}-%{release} Requires: rc-inetd Provides: ftpserver @@ -210,9 +194,8 @@ Summary(pl.UTF-8): Pliki konfiguracyjne do startowania proftpd w trybie standalo Group: Networking/Daemons Requires(post): fileutils Requires(post): grep -Requires(post): sed >= 4.0 +Requires(post,postun): sed >= 4.0 Requires(post,preun): /sbin/chkconfig -Requires(triggerpostun): sed >= 4.0 Requires: %{name}-common = %{epoch}:%{version}-%{release} Requires: rc-scripts Provides: ftpserver @@ -470,12 +453,119 @@ w trybie samodzielnym adaptować te wpisy w miarę dodawania. Robi tak na przykład program portsentry: przy próbie niedozwolonego dostępu dodaje hosty do pliku /etc/hosts.deny. +%package mod_wrap2 +Summary: ProFTPD mod_wrap2 module +Summary(pl.UTF-8): Moduł mod_wrap2 dla ProFTPD +Group: Networking/Daemons +Requires: %{name}-common = %{epoch}:%{version}-%{release} + +%description mod_wrap2 +The mod_wrap2 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. Note that the mod_wrap2 module does not require or use the +standard tcpwrappers libwrap library, and instead implements the same +functionality internally (in order to support SQL-based access rules). + +%description mod_wrap2 -l pl.UTF-8 +Udostępnia funkcjonalność kontroli dostępu podobną do modułu mod_wrap, +ale do działanie nie wymaga systemowej biblioteki libwrap. +http://www.proftpd.org/docs/contrib/mod_wrap2.html + +%package mod_wrap2_file +Summary: ProFTPD wrap2 file module +Summary(pl.UTF-8): Moduł wrap2_file dla ProFTPD +Group: Networking/Daemons +Requires: %{name}-common = %{epoch}:%{version}-%{release} +Requires: %{name}-mod_wrap2 = %{epoch}:%{version}-%{release} + +%description mod_wrap2_file +A mod_wrap2 sub-module for file-based access tables. + +%description mod_wrap2_file -l pl.UTF-8 +Podmoduł mod_wrap2 wymagany jeśli tabele dostępu trzymane są w plikach. + +%package mod_dnsbl +Summary: ProFTPD mod_dnsbl module +Summary(pl.UTF-8): Moduł mod_dnsbl dla ProFTPD +Group: Networking/Daemons +Requires: %{name}-common = %{epoch}:%{version}-%{release} + +%description mod_dnsbl +DNSBL module for ProFTPD. +http://www.proftpd.org/docs/contrib/mod_dnsbl.html + +%description mod_dnsbl -l pl.UTF-8 +Moduł zapewniający kontrolę dostępu przy użyciu DNS blacklist (dnsbl). +http://www.proftpd.org/docs/contrib/mod_dnsbl.html + +%package mod_geoip +Summary: ProFTPD mod_geoip module +Summary(pl.UTF-8): Moduł mod_geoip dla ProFTPD +Group: Networking/Daemons +Requires: %{name}-common = %{epoch}:%{version}-%{release} + +%description mod_geoip +GeoIP module for ProFTPD. +http://www.proftpd.org/docs/contrib/mod_geoip.html + +%description mod_geoip -l pl.UTF-8 +Moduł zapewniający kontrolę dostępu przy użyciu bibliotek +geolokalizacji firmy MaxMind. +http://www.proftpd.org/docs/contrib/mod_geoip.html + +%package mod_memcache +Summary: ProFTPD mod_memcache module +Summary(pl.UTF-8): Moduł mod_memcache dla ProFTPD +Group: Networking/Daemons +Requires: %{name}-common = %{epoch}:%{version}-%{release} + +%description mod_memcache +Memcache module for ProFTPD. +http://www.proftpd.org/docs/howto/Memcache.html + +%description mod_memcache -l pl.UTF-8 +Moduł zapewniający dostęp do wydajnego systemu cache'owania Memcache +http://www.proftpd.org/docs/howto/Memcache.html + +%package mod_redis +Summary: ProFTPD mod_redis module +Summary(pl.UTF-8): Moduł mod_redis dla ProFTPD +Group: Networking/Daemons +Requires: %{name}-common = %{epoch}:%{version}-%{release} + +%description mod_redis +Redis module for ProFTPD. http://www.proftpd.org/docs/howto/Redis.html + +%description mod_redis -l pl.UTF-8 +Moduł zapewniający dostęp do wydajnego systemu cache'owania Redis +http://www.proftpd.org/docs/howto/Redis.html + +%package mod_sftp +Summary: ProFTPD mod_sftp module +Summary(pl.UTF-8): Moduł mod_sftp dla ProFTPD +Group: Networking/Daemons +Requires: %{name}-common = %{epoch}:%{version}-%{release} + +%description mod_sftp +http://www.proftpd.org/docs/contrib/mod_sftp.html + +%description mod_sftp -l pl.UTF-8 +Moduł zapewniający serwerowi ProFTPD obsługę protokołu SFTP +http://www.proftpd.org/docs/contrib/mod_sftp.html + %prep %setup -q -n %{name}-%{version}%{?_rc} -a1 %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 # mod_clamav +# no patch as of 0.13 +#patch -p0 < mod_clamav-%{mod_clamav_version}/proftpd.patch || exit 1 cp -a mod_clamav-%{mod_clamav_version}/*.{c,h} contrib/ cp -f /usr/share/automake/config.sub . @@ -483,6 +573,13 @@ cp -f /usr/share/automake/config.sub . # cleanup backups after patching find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f +sed -E -i -e '1s,#![[:space:]]*/usr/bin/env[[:space:]]+perl,#!%{__perl},' \ + contrib/ftpasswd \ + contrib/ftpmail \ + contrib/ftpquota \ + contrib/xferstats.holger-preiss \ + src/prxs.in + %build %{__autoconf} @@ -494,8 +591,13 @@ mod_readme mod_rewrite mod_wrap mod_facl +mod_dnsbl +mod_geoip +mod_memcache +mod_redis +mod_sftp +mod_wrap2 mod_ifsession -mod_lang %{?with_ssl:mod_tls} %{?with_pam:mod_auth_pam} %{?with_ldap:mod_ldap} @@ -505,24 +607,27 @@ mod_lang %{?with_quotapgsql:mod_quotatab mod_quotatab_sql} %{?with_mysql:mod_sql mod_sql_mysql} %{?with_pgsql:mod_sql mod_sql_postgres} +%{?with_wrap2file:mod_wrap2 mod_wrap2_file} " MODARG=$(echo $MODULES | tr ' ' '\n' | sort -u | xargs | tr ' ' ':') %configure \ - --with-includes=/usr/include/ncurses%{?with_mysql::%{_includedir}/mysql} \ - --disable-strip \ - --enable-buffer-size=4096 \ + ac_cv_lib_iconv_iconv_open=no \ + ac_cv_lib_iconv_libiconv_open=no \ + ac_cv_lib_intl_bindtextdomain=no \ --disable-auth-file \ + --enable-buffer-size=4096 \ --enable-autoshadow \ --enable-ctrls \ --enable-dso \ - --enable-facls \ %{?with_ipv6:--enable-ipv6} \ --enable-nls \ --enable-sendfile \ + --disable-strip \ %{!?with_ssl:--disable-tls} \ - --with-shared=$MODARG \ - --with-modules=mod_clamav + --with-includes=/usr/include/ncurses%{?with_mysql::%{_includedir}/mysql} \ + --with-modules=mod_clamav \ + --with-shared=$MODARG %{__make} -j1 @@ -533,15 +638,15 @@ install -d $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,security,sysconfig/rc-inetd,rc $RPM_BUILD_ROOT%{_sysconfdir}/conf.d \ $RPM_BUILD_ROOT%{_includedir}/%{name} -%{__make} install \ +%{__make} -j1 install \ DESTDIR=$RPM_BUILD_ROOT \ INSTALL_USER=%(id -u) \ INSTALL_GROUP=%(id -g) -rm $RPM_BUILD_ROOT%{_sbindir}/in.proftpd +%{__rm} $RPM_BUILD_ROOT%{_sbindir}/in.proftpd -install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir} -cp -a %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_auth_pam.conf +cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir} +cp -p %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_auth_pam.conf MODULES=" mod_auth_file mod_ident @@ -549,6 +654,12 @@ mod_ratio mod_readme mod_rewrite mod_wrap +mod_wrap2 +mod_dnsbl +mod_geoip +mod_memcache +mod_redis +mod_sftp %{?with_ldap:mod_ldap} %{?with_quotafile:mod_quotatab mod_quotatab_file} %{?with_quotaldap:mod_quotatab mod_quotatab_ldap} @@ -556,41 +667,53 @@ mod_wrap %{?with_quotapgsql:mod_quotatab mod_quotatab_sql} %{?with_mysql:mod_sql mod_sql_mysql} %{?with_pgsql:mod_sql mod_sql_postgres} +%{?with_wrap2file:mod_wrap2 mod_wrap2_file} " for module in $MODULES; do echo "LoadModule $module.c" > $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/$module.conf done -cp -a %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_tls.conf -cp -a %{SOURCE11} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/anonftp.conf -cp -a %{SOURCE12} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_clamav.conf - -cp -a %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/server.crt -cp -a %{SOURCE15} $RPM_BUILD_ROOT%{_sysconfdir}/server.key +cp -p %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_tls.conf +cp -p %{SOURCE11} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/anonftp.conf +cp -p %{SOURCE12} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/mod_clamav.conf -cp -a %{SOURCE13} $RPM_BUILD_ROOT/etc/logrotate.d/proftpd - -%{?with_pam:cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/ftp} -cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/rc-inetd/ftpd -cp -a %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/proftpd -install %{SOURCE6} $RPM_BUILD_ROOT/etc/rc.d/init.d/proftpd -install contrib/xferstats.holger-preiss $RPM_BUILD_ROOT%{_bindir}/xferstat +%{?with_pam:install %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/ftp} +cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/rc-inetd/ftpd +cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/proftpd +cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/rc.d/init.d/proftpd +cp -p contrib/xferstats.holger-preiss $RPM_BUILD_ROOT%{_bindir}/xferstat bzip2 -dc %{SOURCE7} | tar xf - -C $RPM_BUILD_ROOT%{_mandir} :> $RPM_BUILD_ROOT%{_sysconfdir}/ftpusers.default :> $RPM_BUILD_ROOT%{_sysconfdir}/ftpusers +cp -p %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/server.crt +cp -p %{SOURCE15} $RPM_BUILD_ROOT%{_sysconfdir}/server.key + +cp -p %{SOURCE13} $RPM_BUILD_ROOT/etc/logrotate.d/proftpd + # only for -inetd package? ln -sf proftpd $RPM_BUILD_ROOT%{_sbindir}/ftpd :> $RPM_BUILD_ROOT/etc/security/blacklist.ftp -rm $RPM_BUILD_ROOT%{_libexecdir}/*.a -rm $RPM_BUILD_ROOT%{_libexecdir}/*.la +# cannot just --disable-static because build process depend on static objects +%{__rm} $RPM_BUILD_ROOT%{_libexecdir}/*.a +%{__rm} $RPM_BUILD_ROOT%{_libexecdir}/*.la -rm -f $RPM_BUILD_ROOT%{_mandir}/ftpusers-path.diff* +%{__rm} $RPM_BUILD_ROOT%{_mandir}/ftpusers-path.diff* cp -aL include/* config.h $RPM_BUILD_ROOT%{_includedir}/%{name} +%{__mv} $RPM_BUILD_ROOT%{_localedir}/bg{_BG,} +%{__mv} $RPM_BUILD_ROOT%{_localedir}/es{_ES,} +%{__mv} $RPM_BUILD_ROOT%{_localedir}/fr{_FR,} +%{__mv} $RPM_BUILD_ROOT%{_localedir}/it{_IT,} +%{__mv} $RPM_BUILD_ROOT%{_localedir}/ja{_JP,} +%{__mv} $RPM_BUILD_ROOT%{_localedir}/ko{_KR,} +%{__mv} $RPM_BUILD_ROOT%{_localedir}/ru{_RU,} + +%find_lang %{name} + %clean rm -rf $RPM_BUILD_ROOT @@ -634,6 +757,34 @@ if [ "$2" != 1 ]; then %service -q proftpd restart fi +# macro called at module post scriptlet +%define module_post \ +if [ "$1" = "1" ]; then \ + if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \ + %service -q rc-inetd reload \ + elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \ + %service -q proftpd restart \ + fi \ +fi + +# macro called at module postun scriptlet +%define module_postun \ +if [ "$1" = "0" ]; then \ + if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \ + %service -q rc-inetd reload \ + elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \ + %service -q proftpd restart \ + fi \ +fi + +# it's sooo annoying to write them +%define module_scripts() \ +%post %1 \ +%module_post \ +\ +%postun %1 \ +%module_postun + %module_scripts mod_auth_pam %module_scripts mod_ldap %module_scripts mod_quotatab @@ -648,15 +799,20 @@ fi %module_scripts mod_sql_postgres %module_scripts mod_tls %module_scripts mod_wrap - -%files common +%module_scripts mod_wrap2 +%module_scripts mod_dnsbl +%module_scripts mod_geoip +%module_scripts mod_memcache +%module_scripts mod_redis +%module_scripts mod_sftp + +%files common -f %{name}.lang %defattr(644,root,root,755) -%doc sample-configurations/*.conf CREDITS ChangeLog NEWS RELEASE_NOTES -%doc README.md README.modules -%doc doc/*.html doc/contrib doc/howto doc/modules +%doc CREDITS ChangeLog NEWS README.md README.modules RELEASE_NOTES +%doc doc/{*.html,contrib,howto,modules} sample-configurations/*.conf %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/proftpd %dir %attr(750,root,ftp) %dir %{_sysconfdir} -%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.conf +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/proftpd.conf %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %ghost %{_sysconfdir}/ftpusers %attr(640,root,root) %{_sysconfdir}/ftpusers.default %dir %attr(750,root,root) %{_sysconfdir}/conf.d @@ -665,21 +821,42 @@ fi %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_clamav.conf %attr(750,root,root) %dir /var/log/proftpd %attr(750,root,root) %dir /var/log/archive/proftpd -%attr(755,root,root) %{_bindir}/* -%attr(755,root,root) %{_sbindir}/* +%attr(755,root,root) %{_bindir}/ftpasswd +%attr(755,root,root) %{_bindir}/ftpcount +%attr(755,root,root) %{_bindir}/ftpdctl +%attr(755,root,root) %{_bindir}/ftpmail +%attr(755,root,root) %{_bindir}/ftpquota +%attr(755,root,root) %{_bindir}/ftptop +%attr(755,root,root) %{_bindir}/ftpwho +%attr(755,root,root) %{_bindir}/prxs +%attr(755,root,root) %{_bindir}/xferstat +%attr(755,root,root) %{_sbindir}/ftpscrub +%attr(755,root,root) %{_sbindir}/ftpshut +%attr(755,root,root) %{_sbindir}/proftpd +%attr(755,root,root) %{_sbindir}/ftpd %dir %{_libexecdir} %attr(755,root,root) %{_libexecdir}/mod_auth_file.so %attr(755,root,root) %{_libexecdir}/mod_facl.so %attr(755,root,root) %{_libexecdir}/mod_ident.so %attr(755,root,root) %{_libexecdir}/mod_ifsession.so -%attr(755,root,root) %{_libexecdir}/mod_lang.so %dir %{_localstatedir}/proftpd -%{_mandir}/man5/* -%lang(ja) %{_mandir}/ja/man5/ftpusers* -%lang(pl) %{_mandir}/pl/man5/ftpusers* -%lang(pt_BR) %{_mandir}/pt_BR/man5/ftpusers* -%lang(ru) %{_mandir}/ru/man5/ftpusers* -%{_mandir}/man[18]/* +%{_mandir}/man1/ftpasswd.1* +%{_mandir}/man1/ftpcount.1* +%{_mandir}/man1/ftpmail.1* +%{_mandir}/man1/ftpquota.1* +%{_mandir}/man1/ftptop.1* +%{_mandir}/man1/ftpwho.1* +%{_mandir}/man5/ftpusers.5* +%{_mandir}/man5/proftpd.conf.5* +%{_mandir}/man5/xferlog.5* +%{_mandir}/man8/ftpdctl.8* +%{_mandir}/man8/ftpscrub.8* +%{_mandir}/man8/ftpshut.8* +%{_mandir}/man8/proftpd.8* +%lang(ja) %{_mandir}/ja/man5/ftpusers.5* +%lang(pl) %{_mandir}/pl/man5/ftpusers.5* +%lang(pt_BR) %{_mandir}/pt_BR/man5/ftpusers.5* +%lang(ru) %{_mandir}/ru/man5/ftpusers.5* %dir /var/lib/ftp %dir /var/lib/ftp/pub %attr(711,ftp,ftp) %dir /var/lib/ftp/pub/Incoming @@ -696,7 +873,7 @@ fi %files devel %defattr(644,root,root,755) %{_includedir}/%{name} -%{_pkgconfigdir}/%{name}.pc +%{_pkgconfigdir}/proftpd.pc %files anonftp %defattr(644,root,root,755) @@ -705,7 +882,7 @@ fi %if %{with pam} %files mod_auth_pam %defattr(644,root,root,755) -%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/* +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/ftp %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/security/blacklist.ftp %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_auth_pam.conf %attr(755,root,root) %{_libexecdir}/mod_auth_pam.so @@ -793,3 +970,42 @@ fi %defattr(644,root,root,755) %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_wrap.conf %attr(755,root,root) %{_libexecdir}/mod_wrap.so + +%files mod_wrap2 +%defattr(644,root,root,755) +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_wrap2.conf +%attr(755,root,root) %{_libexecdir}/mod_wrap2.so + +%if %{with wrap2file} +%files mod_wrap2_file +%defattr(644,root,root,755) +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_wrap2_file.conf +%attr(755,root,root) %{_libexecdir}/mod_wrap2_file.so +%endif + +%files mod_dnsbl +%defattr(644,root,root,755) +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_dnsbl.conf +%attr(755,root,root) %{_libexecdir}/mod_dnsbl.so + +%files mod_geoip +%defattr(644,root,root,755) +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_geoip.conf +%attr(755,root,root) %{_libexecdir}/mod_geoip.so + +%files mod_memcache +%defattr(644,root,root,755) +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_memcache.conf +%attr(755,root,root) %{_libexecdir}/mod_memcache.so + +%files mod_redis +%defattr(644,root,root,755) +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_redis.conf +%attr(755,root,root) %{_libexecdir}/mod_redis.so + +%files mod_sftp +%defattr(644,root,root,755) +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mod_sftp.conf +%{_sysconfdir}/blacklist.dat +%{_sysconfdir}/dhparams.pem +%attr(755,root,root) %{_libexecdir}/mod_sftp.so -- 2.46.0