Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-ftp/proftpd/, net-ftp/proftpd/files/
Date: Fri, 22 Feb 2019 21:00:39
Message-Id: 1550869225.66357ee093d02b0c26c12dcd37cf0a010ba92525.slyfox@gentoo
1 commit: 66357ee093d02b0c26c12dcd37cf0a010ba92525
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 22 21:00:11 2019 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 22 21:00:25 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=66357ee0
7
8 net-ftp/proftpd: apply SIGHUP crash fix, bug #678490
9
10 It's a upstream fix picked as-is from 1.3.6 branch.
11
12 Reported-by: Hanno Boeck
13 Closes: https://bugs.gentoo.org/678490
14 Package-Manager: Portage-2.3.62, Repoman-2.3.12
15 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
16
17 .../proftpd/files/proftpd-1.3.6-sighup-crash.patch | 81 +++++++
18 net-ftp/proftpd/proftpd-1.3.6-r3.ebuild | 267 +++++++++++++++++++++
19 2 files changed, 348 insertions(+)
20
21 diff --git a/net-ftp/proftpd/files/proftpd-1.3.6-sighup-crash.patch b/net-ftp/proftpd/files/proftpd-1.3.6-sighup-crash.patch
22 new file mode 100644
23 index 00000000000..cca550405e1
24 --- /dev/null
25 +++ b/net-ftp/proftpd/files/proftpd-1.3.6-sighup-crash.patch
26 @@ -0,0 +1,81 @@
27 +https://bugs.gentoo.org/678490
28 +
29 +From 345aa19ee2a98a3612d9b64a49107461455031a0 Mon Sep 17 00:00:00 2001
30 +From: TJ Saunders <tj@×××××××××.org>
31 +Date: Tue, 18 Jul 2017 23:00:22 -0700
32 +Subject: [PATCH] Bug#4310: Use of mod_facl as static module causes ProFTPD to
33 + die on SIGHUP/restart.
34 +
35 +---
36 + modules/mod_facl.c | 35 +++++++++++++++++++++++++++++++----
37 + 1 file changed, 31 insertions(+), 4 deletions(-)
38 +
39 +diff --git a/modules/mod_facl.c b/modules/mod_facl.c
40 +index b3ac42b7b..258708cf5 100644
41 +--- a/modules/mod_facl.c
42 ++++ b/modules/mod_facl.c
43 +@@ -1260,16 +1260,34 @@ MODRET set_faclengine(cmd_rec *cmd) {
44 + return PR_HANDLED(cmd);
45 + }
46 +
47 ++/* Event listeners
48 ++ */
49 ++
50 ++static void unmount_facl(void) {
51 ++ pr_fs_t *fs;
52 ++
53 ++ fs = pr_unmount_fs("/", "facl");
54 ++ if (fs != NULL) {
55 ++ destroy_pool(fs->fs_pool);
56 ++ fs->fs_pool = NULL;
57 ++ return;
58 ++ }
59 ++
60 ++ if (errno != ENOENT) {
61 ++ pr_log_debug(DEBUG0, MOD_FACL_VERSION
62 ++ ": error unmounting 'facl' FS: %s", strerror(errno));
63 ++ }
64 ++}
65 ++
66 + #if defined(PR_SHARED_MODULE) && \
67 + defined(PR_USE_FACL) && \
68 + defined(HAVE_POSIX_ACL)
69 + static void facl_mod_unload_ev(const void *event_data, void *user_data) {
70 + if (strcmp("mod_facl.c", (const char *) event_data) == 0) {
71 ++ pr_fs_t *fs;
72 ++
73 + pr_event_unregister(&facl_module, NULL, NULL);
74 +- if (pr_unregister_fs("/") < 0) {
75 +- pr_log_debug(DEBUG0, MOD_FACL_VERSION
76 +- ": error unregistering 'facl' FS: %s", strerror(errno));
77 +- }
78 ++ unmount_facl();
79 + }
80 + }
81 + #endif /* !PR_SHARED_MODULE */
82 +@@ -1303,6 +1321,14 @@ static void facl_postparse_ev(const void *event_data, void *user_data) {
83 + #endif /* PR_USE_FACL and HAVE_POSIX_ACL */
84 + }
85 +
86 ++static void facl_restart_ev(const void *event_data, void *user_data) {
87 ++ if (facl_engine == FALSE) {
88 ++ return;
89 ++ }
90 ++
91 ++ unmount_facl();
92 ++}
93 ++
94 + /* Initialization routines
95 + */
96 +
97 +@@ -1315,6 +1341,7 @@ static int facl_init(void) {
98 + # endif /* !PR_SHARED_MODULE */
99 + #endif /* PR_USE_FACL and HAVE_POSIX_ACL */
100 + pr_event_register(&facl_module, "core.postparse", facl_postparse_ev, NULL);
101 ++ pr_event_register(&facl_module, "core.restart", facl_restart_ev, NULL);
102 +
103 + return 0;
104 + }
105 +--
106 +2.20.1
107 +
108
109 diff --git a/net-ftp/proftpd/proftpd-1.3.6-r3.ebuild b/net-ftp/proftpd/proftpd-1.3.6-r3.ebuild
110 new file mode 100644
111 index 00000000000..c1babbb4fdd
112 --- /dev/null
113 +++ b/net-ftp/proftpd/proftpd-1.3.6-r3.ebuild
114 @@ -0,0 +1,267 @@
115 +# Copyright 1999-2019 Gentoo Authors
116 +# Distributed under the terms of the GNU General Public License v2
117 +
118 +EAPI=6
119 +inherit multilib systemd tmpfiles
120 +
121 +MOD_CASE="0.7"
122 +MOD_CLAMAV="0.11rc"
123 +MOD_DISKUSE="0.9"
124 +MOD_GSS="1.3.6"
125 +MOD_MSG="0.4.1"
126 +MOD_VROOT="0.9.4"
127 +
128 +DESCRIPTION="An advanced and very configurable FTP server"
129 +HOMEPAGE="http://www.proftpd.org/
130 + http://www.castaglia.org/proftpd/
131 + http://www.thrallingpenguin.com/resources/mod_clamav.htm
132 + http://gssmod.sourceforge.net/"
133 +SRC_URI="ftp://ftp.proftpd.org/distrib/source/${P/_/}.tar.gz
134 + case? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-case-${MOD_CASE}.tar.gz )
135 + clamav? ( https://secure.thrallingpenguin.com/redmine/attachments/download/1/mod_clamav-${MOD_CLAMAV}.tar.gz )
136 + diskuse? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-diskuse-${MOD_DISKUSE}.tar.gz )
137 + kerberos? ( mirror://sourceforge/gssmod/mod_gss-${MOD_GSS}.tar.gz )
138 + msg? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-msg-${MOD_MSG}.tar.gz )
139 + vroot? ( https://github.com/Castaglia/${PN}-mod_vroot/archive/v${MOD_VROOT}.tar.gz -> mod_vroot-${MOD_VROOT}.tar.gz )"
140 +LICENSE="GPL-2"
141 +
142 +SLOT="0"
143 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
144 +IUSE="acl authfile ban +caps case clamav copy ctrls deflate diskuse doc dso dynmasq exec ifsession ifversion ident ipv6
145 + kerberos ldap libressl log_forensic memcache msg mysql ncurses nls pam +pcre postgres qos radius
146 + ratio readme rewrite selinux sftp shaper sitemisc snmp sodium softquota sqlite ssl tcpd test unique_id vroot xinetd"
147 +# TODO: geoip
148 +REQUIRED_USE="ban? ( ctrls )
149 + msg? ( ctrls )
150 + sftp? ( ssl )
151 + shaper? ( ctrls )"
152 +
153 +CDEPEND="acl? ( virtual/acl )
154 + caps? ( sys-libs/libcap )
155 + clamav? ( app-antivirus/clamav )
156 + kerberos? ( virtual/krb5 )
157 + ldap? ( net-nds/openldap )
158 + memcache? ( >=dev-libs/libmemcached-0.41 )
159 + mysql? ( dev-db/mysql-connector-c:0= )
160 + nls? ( virtual/libiconv )
161 + ncurses? ( sys-libs/ncurses:0= )
162 + ssl? (
163 + !libressl? ( dev-libs/openssl:0= )
164 + libressl? ( dev-libs/libressl:= )
165 + )
166 + pam? ( virtual/pam )
167 + pcre? ( dev-libs/libpcre )
168 + postgres? ( dev-db/postgresql:= )
169 + sodium? ( dev-libs/libsodium:0= )
170 + sqlite? ( dev-db/sqlite:3 )
171 + xinetd? ( virtual/inetd )"
172 +DEPEND="${CDEPEND}
173 + test? ( dev-libs/check )"
174 +RDEPEND="${CDEPEND}
175 + net-ftp/ftpbase
176 + selinux? ( sec-policy/selinux-ftp )"
177 +
178 +S="${WORKDIR}/${P/_/}"
179 +
180 +PATCHES=(
181 + "${FILESDIR}"/${PN}-1.3.6-use-trace.patch
182 + "${FILESDIR}"/${PN}-1.3.6-sighup-crash.patch
183 +)
184 +
185 +RESTRICT=test # tests corrupt memory. need to be fixed upstream first
186 +
187 +in_dir() {
188 + pushd "${WORKDIR}/${1}" || die
189 + shift
190 + "$@"
191 + popd
192 +}
193 +
194 +src_prepare() {
195 + # Skip 'install-conf' / Support LINGUAS
196 + sed -i -e "/install-all/s/ install-conf//" Makefile.in || die
197 + sed -i -e "s/^LANGS=.*$/LANGS=${LINGUAS}/" locale/Makefile.in || die
198 +
199 + # Prepare external modules
200 + if use case; then
201 + cp -v "${WORKDIR}"/mod_case/mod_case.c contrib || die
202 + cp -v "${WORKDIR}"/mod_case/mod_case.html doc/contrib || die
203 + fi
204 +
205 + if use clamav ; then
206 + cp -v "${WORKDIR}"/mod_clamav-${MOD_CLAMAV}/mod_clamav.{c,h} contrib || die
207 + eapply "${WORKDIR}"/mod_clamav-${MOD_CLAMAV}/${PN}.patch
208 + fi
209 +
210 + if use diskuse; then
211 + in_dir mod_diskuse eapply "${FILESDIR}"/${PN}-1.3.6_rc4-diskuse-refresh-api.patch
212 +
213 + # ./configure will modify files. Symlink them instead of copying
214 + ln -sv "${WORKDIR}"/mod_diskuse/mod_diskuse.h "${S}"/contrib || die
215 +
216 + cp -v "${WORKDIR}"/mod_diskuse/mod_diskuse.c "${S}"/contrib || die
217 + cp -v "${WORKDIR}"/mod_diskuse/mod_diskuse.html "${S}"/doc/contrib || die
218 + fi
219 +
220 + if use msg; then
221 + in_dir mod_msg eapply "${FILESDIR}"/${PN}-1.3.6_rc4-msg-refresh-api.patch
222 +
223 + cp -v "${WORKDIR}"/mod_msg/mod_msg.c contrib || die
224 + cp -v "${WORKDIR}"/mod_msg/mod_msg.html doc/contrib || die
225 + fi
226 +
227 + if use vroot; then
228 + in_dir ${PN}-mod_vroot-${MOD_VROOT} eapply "${FILESDIR}"/${PN}-1.3.6_rc4-vroot-refresh-api.patch
229 +
230 + cp -v "${WORKDIR}"/${PN}-mod_vroot-${MOD_VROOT}/mod_vroot.c contrib || die
231 + cp -v "${WORKDIR}"/${PN}-mod_vroot-${MOD_VROOT}/mod_vroot.html doc/contrib || die
232 + fi
233 +
234 + if use kerberos ; then
235 + in_dir mod_gss-${MOD_GSS} eapply "${FILESDIR}"/${PN}-1.3.6_rc4-gss-refresh-api.patch
236 +
237 + # Support app-crypt/heimdal / Gentoo Bug #284853
238 + sed -i -e "s/krb5_principal2principalname/_\0/" "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_auth_gss.c.in || die
239 +
240 + # Remove obsolete DES / Gentoo Bug #324903
241 + # Replace 'rpm' lookups / Gentoo Bug #391021
242 + sed -i -e "/ac_gss_libs/s/ -ldes425//" \
243 + -e "s/ac_libdir=\`rpm -q -l.*$/ac_libdir=\/usr\/$(get_libdir)\//" \
244 + -e "s/ac_includedir=\`rpm -q -l.*$/ac_includedir=\/usr\/include\//" "${WORKDIR}"/mod_gss-${MOD_GSS}/configure{,.in} || die
245 +
246 + # ./configure will modify files. Symlink them instead of copying
247 + ln -sv "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_auth_gss.c "${S}"/contrib || die
248 + ln -sv "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_gss.c "${S}"/contrib || die
249 + ln -sv "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_gss.h "${S}"/include || die
250 +
251 + cp -v "${WORKDIR}"/mod_gss-${MOD_GSS}/README.mod_{auth_gss,gss} "${S}" || die
252 + cp -v "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_gss.html "${S}"/doc/contrib || die
253 + cp -v "${WORKDIR}"/mod_gss-${MOD_GSS}/rfc{1509,2228}.txt "${S}"/doc/rfc || die
254 + fi
255 +
256 + default
257 +}
258 +
259 +src_configure() {
260 + local c m
261 +
262 + use acl && m="${m}:mod_facl"
263 + use ban && m="${m}:mod_ban"
264 + use case && m="${m}:mod_case"
265 + use clamav && m="${m}:mod_clamav"
266 + use copy && m="${m}:mod_copy"
267 + use ctrls && m="${m}:mod_ctrls_admin"
268 + use deflate && m="${m}:mod_deflate"
269 + if use diskuse ; then
270 + in_dir mod_diskuse econf
271 + m="${m}:mod_diskuse"
272 + fi
273 + use dynmasq && m="${m}:mod_dynmasq"
274 + use exec && m="${m}:mod_exec"
275 + use ifsession && m="${m}:mod_ifsession"
276 + use ifversion && m="${m}:mod_ifversion"
277 + if use kerberos ; then
278 + in_dir mod_gss-${MOD_GSS} econf
279 + m="${m}:mod_gss:mod_auth_gss"
280 + fi
281 + use ldap && m="${m}:mod_ldap"
282 + use log_forensic && m="${m}:mod_log_forensic"
283 + use msg && m="${m}:mod_msg"
284 + if use mysql || use postgres || use sqlite ; then
285 + m="${m}:mod_sql:mod_sql_passwd"
286 + use mysql && m="${m}:mod_sql_mysql"
287 + use postgres && m="${m}:mod_sql_postgres"
288 + use sqlite && m="${m}:mod_sql_sqlite"
289 + fi
290 + use qos && m="${m}:mod_qos"
291 + use radius && m="${m}:mod_radius"
292 + use ratio && m="${m}:mod_ratio"
293 + use readme && m="${m}:mod_readme"
294 + use rewrite && m="${m}:mod_rewrite"
295 + if use sftp ; then
296 + m="${m}:mod_sftp"
297 + use pam && m="${m}:mod_sftp_pam"
298 + use mysql || use postgres || use sqlite && m="${m}:mod_sftp_sql"
299 + fi
300 + use shaper && m="${m}:mod_shaper"
301 + use sitemisc && m="${m}:mod_site_misc"
302 + use snmp && m="${m}:mod_snmp"
303 + if use softquota ; then
304 + m="${m}:mod_quotatab:mod_quotatab_file"
305 + use ldap && m="${m}:mod_quotatab_ldap"
306 + use radius && m="${m}:mod_quotatab_radius"
307 + use mysql || use postgres || use sqlite && m="${m}:mod_quotatab_sql"
308 + fi
309 + if use ssl ; then
310 + m="${m}:mod_tls:mod_tls_shmcache"
311 + use memcache && m="${m}:mod_tls_memcache"
312 + fi
313 + if use tcpd ; then
314 + m="${m}:mod_wrap2:mod_wrap2_file"
315 + use mysql || use postgres || use sqlite && m="${m}:mod_wrap2_sql"
316 + fi
317 + use unique_id && m="${m}:mod_unique_id"
318 + use vroot && m="${m}:mod_vroot"
319 +
320 + if [[ -n ${PROFTP_CUSTOM_MODULES} ]]; then
321 + einfo "Adding user-specified extra modules: '${PROFTP_CUSTOM_MODULES}'"
322 + m="${m}:${PROFTP_CUSTOM_MODULES}"
323 + fi
324 +
325 + [[ -z ${m} ]] || c="${c} --with-modules=${m:1}"
326 +
327 + econf --localstatedir=/var/run/proftpd --sysconfdir=/etc/proftpd --disable-strip \
328 + $(use_enable acl facl) \
329 + $(use_enable authfile auth-file) \
330 + $(use_enable caps cap) \
331 + $(use_enable ctrls) \
332 + $(use_enable dso) \
333 + $(use_enable ident) \
334 + $(use_enable ipv6) \
335 + $(use_enable memcache) \
336 + $(use_enable ncurses) \
337 + $(use_enable nls) \
338 + $(use_enable ssl openssl) \
339 + $(use_enable pam auth-pam) \
340 + $(use_enable pcre) \
341 + $(use_enable sodium) \
342 + $(use_enable test tests) \
343 + --enable-trace \
344 + $(use_enable userland_GNU shadow) \
345 + $(use_enable userland_GNU autoshadow) \
346 + ${c:1}
347 +}
348 +
349 +src_test() {
350 + emake api-tests -C tests
351 +}
352 +
353 +src_install() {
354 + default
355 + [[ -z ${LINGUAS-set} ]] && rm -r "${ED}"/usr/share/locale
356 + rm -rf "${ED}"/var/run
357 +
358 + newinitd "${FILESDIR}"/proftpd.initd proftpd
359 + insinto /etc/proftpd
360 + doins "${FILESDIR}"/proftpd.conf.sample
361 +
362 + if use xinetd ; then
363 + insinto /etc/xinetd.d
364 + newins "${FILESDIR}"/proftpd.xinetd proftpd
365 + fi
366 +
367 + dodoc ChangeLog CREDITS INSTALL NEWS README* RELEASE_NOTES
368 + if use doc ; then
369 + dohtml doc/*.html doc/contrib/*.html doc/howto/*.html doc/modules/*.html
370 + docinto rfc
371 + dodoc doc/rfc/*.txt
372 + fi
373 +
374 + systemd_dounit "${FILESDIR}"/${PN}.service
375 + systemd_newtmpfilesd "${FILESDIR}"/${PN}-tmpfiles.d.conf ${PN}.conf
376 +}
377 +
378 +pkg_postinst() {
379 + # Create /var/run files at package merge time: bug #650000
380 + tmpfiles_process ${PN}.conf
381 +}