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/files/, net-ftp/proftpd/
Date: Tue, 01 Oct 2019 22:16:37
Message-Id: 1569968173.b47b227ea3da7aec35ee5db26ccac8b5be543bda.slyfox@gentoo
1 commit: b47b227ea3da7aec35ee5db26ccac8b5be543bda
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 1 22:15:22 2019 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 1 22:16:13 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b47b227e
7
8 net-ftp/proftpd: backport EINTR/EAGAIN fix, bug #695972
9
10 Reported-by: Dennis Lichtenthäler
11 Closes: https://bugs.gentoo.org/695972
12 Package-Manager: Portage-2.3.76, Repoman-2.3.17
13 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
14
15 .../files/proftpd-1.3.6-EINTR-like-EAGAIN.patch | 54 ++++
16 net-ftp/proftpd/proftpd-1.3.6-r6.ebuild | 277 +++++++++++++++++++++
17 2 files changed, 331 insertions(+)
18
19 diff --git a/net-ftp/proftpd/files/proftpd-1.3.6-EINTR-like-EAGAIN.patch b/net-ftp/proftpd/files/proftpd-1.3.6-EINTR-like-EAGAIN.patch
20 new file mode 100644
21 index 00000000000..43608d96492
22 --- /dev/null
23 +++ b/net-ftp/proftpd/files/proftpd-1.3.6-EINTR-like-EAGAIN.patch
24 @@ -0,0 +1,54 @@
25 +https://bugs.gentoo.org/695972
26 +https://github.com/proftpd/proftpd/commit/f09f0c661621eb22cb1ce579194478007ba62866
27 +
28 +From f09f0c661621eb22cb1ce579194478007ba62866 Mon Sep 17 00:00:00 2001
29 +From: Justin Maggard <jmaggard@×××××××.com>
30 +Date: Tue, 10 Oct 2017 18:20:06 -0700
31 +Subject: [PATCH] Bug #4319: Treat EINTR like EAGAIN
32 +
33 +This bug described a situation where an ongoing transfer would be
34 +prematurely aborted when one of our timers fired. The timer could have
35 +fired for an unrelated reason, but if we were in the process of reading
36 +or writing with pr_netio_read() or pr_netio_write(), those calls would
37 +be interrupted with errno set to EINTR, and an error would be returned.
38 +Then pr_data_xfer() would abort the transfer.
39 +
40 +EAGAIN was already being handled properly, and we can just use the same
41 +treatment for EINTR so that we only respond to the timers we should
42 +actually care about.
43 +---
44 + src/data.c | 6 +++---
45 + 1 file changed, 3 insertions(+), 3 deletions(-)
46 +
47 +--- a/src/data.c
48 ++++ b/src/data.c
49 +@@ -1143,7 +1143,7 @@ int pr_data_xfer(char *cl_buf, size_t cl_size) {
50 + while (len < 0) {
51 + int xerrno = errno;
52 +
53 +- if (xerrno == EAGAIN) {
54 ++ if (xerrno == EAGAIN || xerrno == EINTR) {
55 + /* Since our socket is in non-blocking mode, read(2) can return
56 + * EAGAIN if there is no data yet for us. Handle this by
57 + * delaying temporarily, then trying again.
58 +@@ -1265,7 +1265,7 @@ int pr_data_xfer(char *cl_buf, size_t cl_size) {
59 + while (len < 0) {
60 + int xerrno = errno;
61 +
62 +- if (xerrno == EAGAIN) {
63 ++ if (xerrno == EAGAIN || xerrno == EINTR) {
64 + /* Since our socket is in non-blocking mode, read(2) can return
65 + * EAGAIN if there is no data yet for us. Handle this by
66 + * delaying temporarily, then trying again.
67 +@@ -1362,7 +1362,7 @@ int pr_data_xfer(char *cl_buf, size_t cl_size) {
68 + while (bwrote < 0) {
69 + int xerrno = errno;
70 +
71 +- if (xerrno == EAGAIN) {
72 ++ if (xerrno == EAGAIN || xerrno == EINTR) {
73 + /* Since our socket is in non-blocking mode, write(2) can return
74 + * EAGAIN if there is not enough from for our data yet. Handle
75 + * this by delaying temporarily, then trying again.
76 +--
77 +2.23.0
78 +
79
80 diff --git a/net-ftp/proftpd/proftpd-1.3.6-r6.ebuild b/net-ftp/proftpd/proftpd-1.3.6-r6.ebuild
81 new file mode 100644
82 index 00000000000..ca63d580cfc
83 --- /dev/null
84 +++ b/net-ftp/proftpd/proftpd-1.3.6-r6.ebuild
85 @@ -0,0 +1,277 @@
86 +# Copyright 1999-2019 Gentoo Authors
87 +# Distributed under the terms of the GNU General Public License v2
88 +
89 +EAPI=7
90 +inherit multilib systemd tmpfiles
91 +
92 +MOD_CASE="0.7"
93 +MOD_CLAMAV="0.11rc"
94 +MOD_DISKUSE="0.9"
95 +MOD_GSS="1.3.6"
96 +MOD_MSG="0.4.1"
97 +MOD_VROOT="0.9.4"
98 +
99 +DESCRIPTION="An advanced and very configurable FTP server"
100 +HOMEPAGE="http://www.proftpd.org/
101 + http://www.castaglia.org/proftpd/
102 + http://www.thrallingpenguin.com/resources/mod_clamav.htm
103 + http://gssmod.sourceforge.net/"
104 +SRC_URI="ftp://ftp.proftpd.org/distrib/source/${P/_/}.tar.gz
105 + case? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-case-${MOD_CASE}.tar.gz )
106 + clamav? ( https://secure.thrallingpenguin.com/redmine/attachments/download/1/mod_clamav-${MOD_CLAMAV}.tar.gz )
107 + diskuse? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-diskuse-${MOD_DISKUSE}.tar.gz )
108 + kerberos? ( mirror://sourceforge/gssmod/mod_gss-${MOD_GSS}.tar.gz )
109 + msg? ( http://www.castaglia.org/${PN}/modules/${PN}-mod-msg-${MOD_MSG}.tar.gz )
110 + vroot? ( https://github.com/Castaglia/${PN}-mod_vroot/archive/v${MOD_VROOT}.tar.gz -> mod_vroot-${MOD_VROOT}.tar.gz )"
111 +LICENSE="GPL-2"
112 +
113 +SLOT="0"
114 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
115 +IUSE="acl authfile ban +caps case clamav copy ctrls deflate diskuse dso dynmasq exec ifsession ifversion ident ipv6
116 + kerberos ldap libressl log-forensic memcache msg mysql ncurses nls pam +pcre postgres qos radius
117 + ratio readme rewrite selinux sftp shaper sitemisc snmp sodium softquota sqlite ssl tcpd test unique-id vroot"
118 +# TODO: geoip
119 +REQUIRED_USE="ban? ( ctrls )
120 + msg? ( ctrls )
121 + sftp? ( ssl )
122 + shaper? ( ctrls )
123 +
124 + mysql? ( ssl )
125 + postgres? ( ssl )
126 + sqlite? ( ssl )
127 +"
128 +
129 +CDEPEND="acl? ( virtual/acl )
130 + caps? ( sys-libs/libcap )
131 + clamav? ( app-antivirus/clamav )
132 + kerberos? ( virtual/krb5 )
133 + ldap? ( net-nds/openldap )
134 + memcache? ( >=dev-libs/libmemcached-0.41 )
135 + mysql? ( dev-db/mysql-connector-c:0= )
136 + nls? ( virtual/libiconv )
137 + ncurses? ( sys-libs/ncurses:0= )
138 + ssl? (
139 + !libressl? ( dev-libs/openssl:0= )
140 + libressl? ( dev-libs/libressl:= )
141 + )
142 + pam? ( virtual/pam )
143 + pcre? ( dev-libs/libpcre )
144 + postgres? ( dev-db/postgresql:= )
145 + sodium? ( dev-libs/libsodium:0= )
146 + sqlite? ( dev-db/sqlite:3 )
147 +"
148 +DEPEND="${CDEPEND}
149 + test? ( dev-libs/check )"
150 +RDEPEND="${CDEPEND}
151 + net-ftp/ftpbase
152 + selinux? ( sec-policy/selinux-ftp )"
153 +
154 +S="${WORKDIR}/${P/_/}"
155 +
156 +PATCHES=(
157 + "${FILESDIR}"/${PN}-1.3.6-use-trace.patch
158 + "${FILESDIR}"/${PN}-1.3.6-sighup-crash.patch
159 + "${FILESDIR}"/${PN}-1.3.6-mod_copy.patch
160 + "${FILESDIR}"/${PN}-1.3.6-mysql-8.patch
161 + "${FILESDIR}"/${PN}-1.3.6-EINTR-like-EAGAIN.patch
162 +)
163 +
164 +RESTRICT=test # tests corrupt memory. need to be fixed upstream first
165 +
166 +in_dir() {
167 + pushd "${WORKDIR}/${1}" || die
168 + shift
169 + "$@"
170 + popd
171 +}
172 +
173 +src_prepare() {
174 + # Skip 'install-conf' / Support LINGUAS
175 + sed -i -e "/install-all/s/ install-conf//" Makefile.in || die
176 + sed -i -e "s/^LANGS=.*$/LANGS=${LINGUAS}/" locale/Makefile.in || die
177 +
178 + # Prepare external modules
179 + if use case; then
180 + cp -v "${WORKDIR}"/mod_case/mod_case.c contrib || die
181 + cp -v "${WORKDIR}"/mod_case/mod_case.html doc/contrib || die
182 + fi
183 +
184 + if use clamav ; then
185 + cp -v "${WORKDIR}"/mod_clamav-${MOD_CLAMAV}/mod_clamav.{c,h} contrib || die
186 + eapply "${WORKDIR}"/mod_clamav-${MOD_CLAMAV}/${PN}.patch
187 + fi
188 +
189 + if use diskuse; then
190 + in_dir mod_diskuse eapply "${FILESDIR}"/${PN}-1.3.6_rc4-diskuse-refresh-api.patch
191 +
192 + # ./configure will modify files. Symlink them instead of copying
193 + ln -sv "${WORKDIR}"/mod_diskuse/mod_diskuse.h "${S}"/contrib || die
194 +
195 + cp -v "${WORKDIR}"/mod_diskuse/mod_diskuse.c "${S}"/contrib || die
196 + cp -v "${WORKDIR}"/mod_diskuse/mod_diskuse.html "${S}"/doc/contrib || die
197 + fi
198 +
199 + if use msg; then
200 + in_dir mod_msg eapply "${FILESDIR}"/${PN}-1.3.6_rc4-msg-refresh-api.patch
201 +
202 + cp -v "${WORKDIR}"/mod_msg/mod_msg.c contrib || die
203 + cp -v "${WORKDIR}"/mod_msg/mod_msg.html doc/contrib || die
204 + fi
205 +
206 + if use vroot; then
207 + in_dir ${PN}-mod_vroot-${MOD_VROOT} eapply "${FILESDIR}"/${PN}-1.3.6_rc4-vroot-refresh-api.patch
208 +
209 + cp -v "${WORKDIR}"/${PN}-mod_vroot-${MOD_VROOT}/mod_vroot.c contrib || die
210 + cp -v "${WORKDIR}"/${PN}-mod_vroot-${MOD_VROOT}/mod_vroot.html doc/contrib || die
211 + fi
212 +
213 + if use kerberos ; then
214 + in_dir mod_gss-${MOD_GSS} eapply "${FILESDIR}"/${PN}-1.3.6_rc4-gss-refresh-api.patch
215 +
216 + # Support app-crypt/heimdal / Gentoo Bug #284853
217 + sed -i -e "s/krb5_principal2principalname/_\0/" "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_auth_gss.c.in || die
218 +
219 + # Remove obsolete DES / Gentoo Bug #324903
220 + # Replace 'rpm' lookups / Gentoo Bug #391021
221 + sed -i -e "/ac_gss_libs/s/ -ldes425//" \
222 + -e "s/ac_libdir=\`rpm -q -l.*$/ac_libdir=\/usr\/$(get_libdir)\//" \
223 + -e "s/ac_includedir=\`rpm -q -l.*$/ac_includedir=\/usr\/include\//" "${WORKDIR}"/mod_gss-${MOD_GSS}/configure{,.in} || die
224 +
225 + # ./configure will modify files. Symlink them instead of copying
226 + ln -sv "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_auth_gss.c "${S}"/contrib || die
227 + ln -sv "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_gss.c "${S}"/contrib || die
228 + ln -sv "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_gss.h "${S}"/include || die
229 +
230 + cp -v "${WORKDIR}"/mod_gss-${MOD_GSS}/README.mod_{auth_gss,gss} "${S}" || die
231 + cp -v "${WORKDIR}"/mod_gss-${MOD_GSS}/mod_gss.html "${S}"/doc/contrib || die
232 + cp -v "${WORKDIR}"/mod_gss-${MOD_GSS}/rfc{1509,2228}.txt "${S}"/doc/rfc || die
233 + fi
234 +
235 + default
236 +}
237 +
238 +src_configure() {
239 + local c m
240 +
241 + use acl && m="${m}:mod_facl"
242 + use ban && m="${m}:mod_ban"
243 + use case && m="${m}:mod_case"
244 + use clamav && m="${m}:mod_clamav"
245 + use copy && m="${m}:mod_copy"
246 + use ctrls && m="${m}:mod_ctrls_admin"
247 + use deflate && m="${m}:mod_deflate"
248 + if use diskuse ; then
249 + in_dir mod_diskuse econf
250 + m="${m}:mod_diskuse"
251 + fi
252 + use dynmasq && m="${m}:mod_dynmasq"
253 + use exec && m="${m}:mod_exec"
254 + use ifsession && m="${m}:mod_ifsession"
255 + use ifversion && m="${m}:mod_ifversion"
256 + if use kerberos ; then
257 + in_dir mod_gss-${MOD_GSS} econf
258 + m="${m}:mod_gss:mod_auth_gss"
259 + fi
260 + use ldap && m="${m}:mod_ldap"
261 + use log-forensic && m="${m}:mod_log_forensic"
262 + use msg && m="${m}:mod_msg"
263 + if use mysql || use postgres || use sqlite ; then
264 + m="${m}:mod_sql:mod_sql_passwd"
265 + use mysql && m="${m}:mod_sql_mysql"
266 + use postgres && m="${m}:mod_sql_postgres"
267 + use sqlite && m="${m}:mod_sql_sqlite"
268 + fi
269 + use qos && m="${m}:mod_qos"
270 + use radius && m="${m}:mod_radius"
271 + use ratio && m="${m}:mod_ratio"
272 + use readme && m="${m}:mod_readme"
273 + use rewrite && m="${m}:mod_rewrite"
274 + if use sftp ; then
275 + m="${m}:mod_sftp"
276 + use pam && m="${m}:mod_sftp_pam"
277 + use mysql || use postgres || use sqlite && m="${m}:mod_sftp_sql"
278 + fi
279 + use shaper && m="${m}:mod_shaper"
280 + use sitemisc && m="${m}:mod_site_misc"
281 + use snmp && m="${m}:mod_snmp"
282 + if use softquota ; then
283 + m="${m}:mod_quotatab:mod_quotatab_file"
284 + use ldap && m="${m}:mod_quotatab_ldap"
285 + use radius && m="${m}:mod_quotatab_radius"
286 + use mysql || use postgres || use sqlite && m="${m}:mod_quotatab_sql"
287 + fi
288 + if use ssl ; then
289 + m="${m}:mod_tls:mod_tls_shmcache"
290 + use memcache && m="${m}:mod_tls_memcache"
291 + fi
292 + if use tcpd ; then
293 + m="${m}:mod_wrap2:mod_wrap2_file"
294 + use mysql || use postgres || use sqlite && m="${m}:mod_wrap2_sql"
295 + fi
296 + use unique-id && m="${m}:mod_unique_id"
297 + use vroot && m="${m}:mod_vroot"
298 +
299 + if [[ -n ${PROFTP_CUSTOM_MODULES} ]]; then
300 + einfo "Adding user-specified extra modules: '${PROFTP_CUSTOM_MODULES}'"
301 + m="${m}:${PROFTP_CUSTOM_MODULES}"
302 + fi
303 +
304 + [[ -z ${m} ]] || c="${c} --with-modules=${m:1}"
305 +
306 + econf --localstatedir=/var/run/proftpd --sysconfdir=/etc/proftpd --disable-strip \
307 + $(use_enable acl facl) \
308 + $(use_enable authfile auth-file) \
309 + $(use_enable caps cap) \
310 + $(use_enable ctrls) \
311 + $(use_enable dso) \
312 + $(use_enable ident) \
313 + $(use_enable ipv6) \
314 + $(use_enable memcache) \
315 + $(use_enable ncurses) \
316 + $(use_enable nls) \
317 + $(use_enable ssl openssl) \
318 + $(use_enable pam auth-pam) \
319 + $(use_enable pcre) \
320 + $(use_enable sodium) \
321 + $(use_enable test tests) \
322 + --enable-trace \
323 + $(use_enable userland_GNU shadow) \
324 + $(use_enable userland_GNU autoshadow) \
325 + ${c:1}
326 +}
327 +
328 +src_test() {
329 + emake api-tests -C tests
330 +}
331 +
332 +src_install() {
333 + default
334 + [[ -z ${LINGUAS-set} ]] && rm -r "${ED}"/usr/share/locale
335 + rm -rf "${ED}"/var/run
336 +
337 + newinitd "${FILESDIR}"/proftpd.initd proftpd
338 + insinto /etc/proftpd
339 + doins "${FILESDIR}"/proftpd.conf.sample
340 +
341 + insinto /etc/xinetd.d
342 + newins "${FILESDIR}"/proftpd.xinetd proftpd
343 +
344 + insinto /etc/logrotate.d
345 + newins "${FILESDIR}"/${PN}.logrotate ${PN}
346 +
347 + dodoc ChangeLog CREDITS INSTALL NEWS README* RELEASE_NOTES
348 +
349 + docinto html
350 + dodoc doc/*.html doc/contrib/*.html doc/howto/*.html doc/modules/*.html
351 +
352 + docinto rfc
353 + dodoc doc/rfc/*.txt
354 +
355 + systemd_dounit "${FILESDIR}"/${PN}.service
356 + systemd_newtmpfilesd "${FILESDIR}"/${PN}-tmpfiles.d.conf ${PN}.conf
357 +}
358 +
359 +pkg_postinst() {
360 + # Create /var/run files at package merge time: bug #650000
361 + tmpfiles_process ${PN}.conf
362 +}