Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-mail/dovecot/
Date: Wed, 28 Feb 2018 22:18:57
Message-Id: 1519856315.5a2f53f6a6fa9cac9d50615dbaa03e10a784e672.whissi@gentoo
1 commit: 5a2f53f6a6fa9cac9d50615dbaa03e10a784e672
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 28 22:15:20 2018 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 28 22:18:35 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a2f53f6
7
8 net-mail/dovecot: Bump to fix CVE-2017-14461 & CVE-2017-15130
9
10 Bug: https://bugs.gentoo.org/648894
11 Package-Manager: Portage-2.3.24, Repoman-2.3.6
12
13 net-mail/dovecot/Manifest | 2 +
14 net-mail/dovecot/dovecot-2.2.34.ebuild | 290 ++++++++++++++++++++++++++++++++
15 net-mail/dovecot/dovecot-2.3.0.1.ebuild | 284 +++++++++++++++++++++++++++++++
16 3 files changed, 576 insertions(+)
17
18 diff --git a/net-mail/dovecot/Manifest b/net-mail/dovecot/Manifest
19 index cab1375332a..1a212faeccf 100644
20 --- a/net-mail/dovecot/Manifest
21 +++ b/net-mail/dovecot/Manifest
22 @@ -6,6 +6,8 @@ DIST dovecot-2.2.19.tar.gz 5256627 BLAKE2B 0b7fe57ced1b1f7eb5e29e8d6723d237cc107
23 DIST dovecot-2.2.29.1.tar.gz 5972119 BLAKE2B 9b05e9976369757de07471c2e499a863efbd94b51d8aefdeb2144c01596f03f9ea02670ee9cac9590615e4139dc754c11eb4777d791f87a2e6031302155d9f05 SHA512 1e5ea6080ebe7dd4afe6fcfe8e98ed6d2ad2735655a18cc96e439dd044ccc3a1a6a80428bc746b4d6250820895d6a62121562e97e4b46c8b1cf88a19443bc111
24 DIST dovecot-2.2.32.tar.gz 6100268 BLAKE2B e7d79f81fe06565d254c46de5cd7f4565883a029f4fa409d9f3c6ff75d599fb3f1ce5f8a32b96b9bebe4654de2be4998d0e178f1784e00d246186727324c6e80 SHA512 a26ce763fdea7d72ff9801d3b7d57a1f0d00278e4a1aa60d1be070fe5a6d2c6a15f266a519119492bee7a3e7a6b7d0732e9879e5c5841adbab8c0952cd1b7c7c
25 DIST dovecot-2.2.33.2.tar.gz 6131086 BLAKE2B 5bfa9f52e7263e778b717d52f540682574e4bbcb04fc003e78b9ce94562d092f1c5360f835ee8cea912afbed7351be9f06dd321df3f7893d27544ede00c682ca SHA512 028910a4d02b1630f1ada4d1c45fcc3ea2057969db7078a78d46e2a578b4dceaf8be0ac8de4a613b4890019e721871f2d366ec651db658da4cc72977d3e09931
26 +DIST dovecot-2.2.34.tar.gz 6181270 BLAKE2B dfdb1e6812574e79595202e830167400569adf61155aa5ddaae443e798c4a05ccec2acd2975e00e9e7ffc63ee1dcf7e4e2a9288b1e6e1e1427d1e89790a8fa13 SHA512 9f08a7116a08a08495aa0e7b4cb6b11a924ea61006970487946e338bc79bba7fd7619c345cbf278a74de285d548af04fc66eaaee508185b8b9d7335cf5612055
27 DIST dovecot-2.3-pigeonhole-0.5.0.1.tar.gz 1783039 BLAKE2B 8452c11d1c5f26d2ee9a0c54a2c30642bce5117f1ad140db8a8509a2bcc03236361a99c6f622267279eb75c19c68de7d96947557b595c345db34e34a135b492c SHA512 60016145caa444eeba13b49735f87ab2ebe7f178f104ad57283b5aa7e5119920d9f579032b775547e0866e86045a4ab653fd084068187d0cbe2e088cc15fc288
28 DIST dovecot-2.3-pigeonhole-0.5.0.tar.gz 1782375 BLAKE2B ecbf20ec3a12d72d6040d4d4fffc63e44dd80c28d3b5ad62a97bfefffc0d3063114cd46cacfd1e24f1000829f28d457d3b68773cdecf151ef20e5e0ccb899c3b SHA512 c338a94ff5db1cc34cac10da2854cd2905567addf5e40f36fe24958abeae1ae9900461f0aeda4f2133eecb2762005c0d6414a109538a1da7aabdd7a4a8eeb127
29 +DIST dovecot-2.3.0.1.tar.gz 6499984 BLAKE2B 4bfb38ba8bed154e58db03c53c0a6958632841fd66a118571c341be90f9d20a570a22699d4b8d117b72d4599fe074248c96cf4e7fc78ddd65c69662b4275cf97 SHA512 2b30c46c1660f425f6303a15cf638388439fd7a8065c91d28caf41d9a6403a4fccb530df3f69037a634bc3b0b9e498037da6b0b93c176f5e3b5808907d3f759d
30 DIST dovecot-2.3.0.tar.gz 6635541 BLAKE2B 3c76ccc0fac19511c9852aabd5d86c2fb815893b983b8bdf74a48c4c9040efe95fceff49189d6ed7eb4b1c2cbc47472630a367891950690feec68190d518a565 SHA512 8d8591e371ba2ebf8d3c1561af49b970d8351c4acdde8a97ff0ab403bf4cad6e4d96e9556c9be747a85085552449cab4c52bb41bda36e1a822594ec87661ce7f
31
32 diff --git a/net-mail/dovecot/dovecot-2.2.34.ebuild b/net-mail/dovecot/dovecot-2.2.34.ebuild
33 new file mode 100644
34 index 00000000000..ec44729eb33
35 --- /dev/null
36 +++ b/net-mail/dovecot/dovecot-2.2.34.ebuild
37 @@ -0,0 +1,290 @@
38 +# Copyright 1999-2018 Gentoo Foundation
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=6
42 +inherit ssl-cert systemd user versionator
43 +
44 +MY_P="${P/_/.}"
45 +major_minor="$(get_version_component_range 1-2)"
46 +sieve_version="0.4.21"
47 +if [[ ${PV} == *_rc* ]] ; then
48 + rc_dir="rc/"
49 +else
50 + rc_dir=""
51 +fi
52 +SRC_URI="https://dovecot.org/releases/${major_minor}/${rc_dir}${MY_P}.tar.gz
53 + sieve? (
54 + https://pigeonhole.dovecot.org/releases/${major_minor}/${PN}-${major_minor}-pigeonhole-${sieve_version}.tar.gz
55 + )
56 + managesieve? (
57 + https://pigeonhole.dovecot.org/releases/${major_minor}/${PN}-${major_minor}-pigeonhole-${sieve_version}.tar.gz
58 + ) "
59 +DESCRIPTION="An IMAP and POP3 server written with security primarily in mind"
60 +HOMEPAGE="http://www.dovecot.org/"
61 +
62 +SLOT="0"
63 +LICENSE="LGPL-2.1 MIT"
64 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86"
65 +
66 +IUSE_DOVECOT_AUTH="kerberos ldap mysql pam postgres sqlite vpopmail"
67 +IUSE_DOVECOT_COMPRESS="bzip2 lzma lz4 zlib"
68 +IUSE_DOVECOT_OTHER="caps doc ipv6 libressl lucene managesieve selinux sieve solr +ssl static-libs suid tcpd textcat"
69 +
70 +IUSE="${IUSE_DOVECOT_AUTH} ${IUSE_DOVECOT_STORAGE} ${IUSE_DOVECOT_COMPRESS} ${IUSE_DOVECOT_OTHER}"
71 +
72 +DEPEND="bzip2? ( app-arch/bzip2 )
73 + caps? ( sys-libs/libcap )
74 + kerberos? ( virtual/krb5 )
75 + ldap? ( net-nds/openldap )
76 + lucene? ( >=dev-cpp/clucene-2.3 )
77 + lzma? ( app-arch/xz-utils )
78 + lz4? ( app-arch/lz4 )
79 + mysql? ( virtual/mysql )
80 + pam? ( virtual/pam )
81 + postgres? ( dev-db/postgresql:* !dev-db/postgresql[ldap,threads] )
82 + selinux? ( sec-policy/selinux-dovecot )
83 + solr? ( net-misc/curl dev-libs/expat )
84 + sqlite? ( dev-db/sqlite:* )
85 + ssl? (
86 + !libressl? ( dev-libs/openssl:0 )
87 + libressl? ( dev-libs/libressl )
88 + )
89 + tcpd? ( sys-apps/tcp-wrappers )
90 + textcat? ( app-text/libexttextcat )
91 + vpopmail? ( net-mail/vpopmail )
92 + zlib? ( sys-libs/zlib )
93 + virtual/libiconv
94 + dev-libs/icu:="
95 +
96 +RDEPEND="${DEPEND}
97 + net-mail/mailbase"
98 +
99 +# Dovecot does not support building without ssl. Force it for now
100 +REQUIRED_USE="ssl"
101 +
102 +S=${WORKDIR}/${MY_P}
103 +
104 +pkg_setup() {
105 + if use managesieve && ! use sieve; then
106 + ewarn "managesieve USE flag selected but sieve USE flag unselected"
107 + ewarn "sieve USE flag will be turned on"
108 + fi
109 + # default internal user
110 + enewgroup dovecot 97
111 + enewuser dovecot 97 -1 /dev/null dovecot
112 + # default login user
113 + enewuser dovenull -1 -1 /dev/null
114 + # add "mail" group for suid'ing. Better security isolation.
115 + if use suid; then
116 + enewgroup mail
117 + fi
118 +}
119 +
120 +src_prepare() {
121 + eapply -p0 "${FILESDIR}/${PN}-10-ssl.patch"
122 + eapply_user
123 +}
124 +
125 +src_configure() {
126 + local conf=""
127 +
128 + if use postgres || use mysql || use sqlite; then
129 + conf="${conf} --with-sql"
130 + fi
131 +
132 + # turn valgrind tests off. Bug #340791
133 + VALGRIND=no econf \
134 + --localstatedir="${EPREFIX}/var" \
135 + --runstatedir="${EPREFIX}/run" \
136 + --with-moduledir="${EPREFIX}/usr/$(get_libdir)/dovecot" \
137 + --without-stemmer \
138 + --disable-rpath \
139 + --with-icu \
140 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
141 + $( use_with bzip2 bzlib ) \
142 + $( use_with caps libcap ) \
143 + $( use_with kerberos gssapi ) \
144 + $( use_with ldap ) \
145 + $( use_with lucene ) \
146 + $( use_with lz4 ) \
147 + $( use_with lzma ) \
148 + $( use_with mysql ) \
149 + $( use_with pam ) \
150 + $( use_with postgres pgsql ) \
151 + $( use_with sqlite ) \
152 + $( use_with solr ) \
153 + $( use_with ssl ) \
154 + $( use_with tcpd libwrap ) \
155 + $( use_with textcat ) \
156 + $( use_with vpopmail ) \
157 + $( use_with zlib ) \
158 + $( use_enable static-libs static ) \
159 + ${conf}
160 +
161 + if use sieve || use managesieve ; then
162 + # The sieve plugin needs this file to be build to determine the plugin
163 + # directory and the list of libraries to link to.
164 + emake dovecot-config
165 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
166 + econf \
167 + $( use_enable static-libs static ) \
168 + --localstatedir="${EPREFIX}/var" \
169 + --enable-shared \
170 + --with-dovecot="../${MY_P}" \
171 + $( use_with managesieve )
172 + fi
173 +}
174 +
175 +src_compile() {
176 + default
177 + if use sieve || use managesieve ; then
178 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
179 + emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"
180 + fi
181 +}
182 +
183 +src_test() {
184 + default
185 + if use sieve || use managesieve ; then
186 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
187 + default
188 + fi
189 +}
190 +
191 +src_install () {
192 + default
193 +
194 + # insecure:
195 + # use suid && fperms u+s /usr/libexec/dovecot/deliver
196 + # better:
197 + if use suid;then
198 + einfo "Changing perms to allow deliver to be suided"
199 + fowners root:mail "${EPREFIX}/usr/libexec/dovecot/dovecot-lda"
200 + fperms 4750 "${EPREFIX}/usr/libexec/dovecot/dovecot-lda"
201 + fi
202 +
203 + newinitd "${FILESDIR}"/dovecot.init-r4 dovecot
204 +
205 + rm -rf "${ED}"/usr/share/doc/dovecot
206 +
207 + dodoc AUTHORS NEWS README TODO
208 + dodoc doc/*.{txt,cnf,xml,sh}
209 + docinto example-config
210 + dodoc doc/example-config/*.{conf,ext}
211 + docinto example-config/conf.d
212 + dodoc doc/example-config/conf.d/*.{conf,ext}
213 + docinto wiki
214 + dodoc doc/wiki/*
215 + doman doc/man/*.{1,7}
216 +
217 + # Create the dovecot.conf file from the dovecot-example.conf file that
218 + # the dovecot folks nicely left for us....
219 + local conf="${ED}/etc/dovecot/dovecot.conf"
220 + local confd="${ED}/etc/dovecot/conf.d"
221 +
222 + insinto /etc/dovecot
223 + doins doc/example-config/*.{conf,ext}
224 + insinto /etc/dovecot/conf.d
225 + doins doc/example-config/conf.d/*.{conf,ext}
226 + fperms 0600 "${EPREFIX}"/etc/dovecot/dovecot-{ldap,sql}.conf.ext
227 + rm -f "${confd}/../README"
228 +
229 + # .maildir is the Gentoo default
230 + local mail_location="maildir:~/.maildir"
231 + sed -i -e \
232 + "s|#mail_location =|mail_location = ${mail_location}|" \
233 + "${confd}/10-mail.conf" \
234 + || die "failed to update mail location settings in 10-mail.conf"
235 +
236 + # We're using pam files (imap and pop3) provided by mailbase
237 + if use pam; then
238 + sed -i -e '/driver = pam/,/^[ \t]*}/ s|#args = dovecot|args = "\*"|' \
239 + "${confd}/auth-system.conf.ext" \
240 + || die "failed to update PAM settings in auth-system.conf.ext"
241 + # mailbase does not provide a sieve pam file
242 + use managesieve && dosym imap /etc/pam.d/sieve
243 + sed -i -e \
244 + 's/#!include auth-system.conf.ext/!include auth-system.conf.ext/' \
245 + "${confd}/10-auth.conf" \
246 + || die "failed to update PAM settings in 10-auth.conf"
247 + fi
248 +
249 + # Disable ipv6 if necessary
250 + if ! use ipv6; then
251 + sed -i -e 's/^#listen = \*, ::/listen = \*/g' "${conf}" \
252 + || die "failed to update listen settings in dovecot.conf"
253 + fi
254 +
255 + # Update ssl cert locations
256 + if use ssl; then
257 + sed -i -e 's:^#ssl = yes:ssl = yes:' "${confd}/10-ssl.conf" \
258 + || die "ssl conf failed"
259 + sed -i -e 's:^ssl_cert =.*:ssl_cert = </etc/ssl/dovecot/server.pem:' \
260 + -e 's:^ssl_key =.*:ssl_key = </etc/ssl/dovecot/server.key:' \
261 + "${confd}/10-ssl.conf" || die "failed to update SSL settings in 10-ssl.conf"
262 + fi
263 +
264 + # Install SQL configuration
265 + if use mysql || use postgres; then
266 + sed -i -e \
267 + 's/#!include auth-sql.conf.ext/!include auth-sql.conf.ext/' \
268 + "${confd}/10-auth.conf" || die "failed to update SQL settings in \
269 + 10-auth.conf"
270 + fi
271 +
272 + # Install LDAP configuration
273 + if use ldap; then
274 + sed -i -e \
275 + 's/#!include auth-ldap.conf.ext/!include auth-ldap.conf.ext/' \
276 + "${confd}/10-auth.conf" \
277 + || die "failed to update ldap settings in 10-auth.conf"
278 + fi
279 +
280 + if use vpopmail; then
281 + sed -i -e \
282 + 's/#!include auth-vpopmail.conf.ext/!include auth-vpopmail.conf.ext/' \
283 + "${confd}/10-auth.conf" \
284 + || die "failed to update vpopmail settings in 10-auth.conf"
285 + fi
286 +
287 + if use sieve || use managesieve ; then
288 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
289 + emake DESTDIR="${ED}" install
290 + sed -i -e \
291 + 's/^[[:space:]]*#mail_plugins = $mail_plugins/mail_plugins = sieve/' "${confd}/15-lda.conf" \
292 + || die "failed to update sieve settings in 15-lda.conf"
293 + rm -rf "${ED}"/usr/share/doc/dovecot
294 + docinto example-config/conf.d
295 + dodoc doc/example-config/conf.d/*.conf
296 + insinto /etc/dovecot/conf.d
297 + doins doc/example-config/conf.d/90-sieve{,-extprograms}.conf
298 + use managesieve && doins doc/example-config/conf.d/20-managesieve.conf
299 + docinto sieve/rfc
300 + dodoc doc/rfc/*.txt
301 + docinto sieve/devel
302 + dodoc doc/devel/DESIGN
303 + docinto plugins
304 + dodoc doc/plugins/*.txt
305 + docinto extensions
306 + dodoc doc/extensions/*.txt
307 + docinto locations
308 + dodoc doc/locations/*.txt
309 + doman doc/man/*.{1,7}
310 + fi
311 +
312 + use static-libs || find "${ED}"/usr/lib* -name '*.la' -delete
313 +}
314 +
315 +pkg_postinst() {
316 + if use ssl; then
317 + # Let's not make a new certificate if we already have one
318 + if ! [[ -e "${ROOT}"/etc/ssl/dovecot/server.pem && \
319 + -e "${ROOT}"/etc/ssl/dovecot/server.key ]]; then
320 + einfo "Creating SSL certificate"
321 + SSL_ORGANIZATION="${SSL_ORGANIZATION:-Dovecot IMAP Server}"
322 + install_cert /etc/ssl/dovecot/server
323 + fi
324 + fi
325 +
326 + elog "Please read http://wiki2.dovecot.org/Upgrading/ for upgrade notes."
327 +}
328
329 diff --git a/net-mail/dovecot/dovecot-2.3.0.1.ebuild b/net-mail/dovecot/dovecot-2.3.0.1.ebuild
330 new file mode 100644
331 index 00000000000..b60730a12fc
332 --- /dev/null
333 +++ b/net-mail/dovecot/dovecot-2.3.0.1.ebuild
334 @@ -0,0 +1,284 @@
335 +# Copyright 1999-2018 Gentoo Foundation
336 +# Distributed under the terms of the GNU General Public License v2
337 +
338 +EAPI=6
339 +# do not add a ssl USE flag. ssl is mandatory
340 +SSL_DEPS_SKIP=1
341 +inherit ssl-cert systemd user versionator
342 +
343 +MY_P="${P/_/.}"
344 +MY_S="${PN}-ce-${PV}"
345 +major_minor="$(get_version_component_range 1-2)"
346 +sieve_version="0.5.0.1"
347 +if [[ ${PV} == *_rc* ]] ; then
348 + rc_dir="rc/"
349 +else
350 + rc_dir=""
351 +fi
352 +SRC_URI="https://dovecot.org/releases/${major_minor}/${rc_dir}${MY_P}.tar.gz
353 + sieve? (
354 + https://pigeonhole.dovecot.org/releases/${major_minor}/${rc_dir}${PN}-${major_minor}-pigeonhole-${sieve_version}.tar.gz
355 + )
356 + managesieve? (
357 + https://pigeonhole.dovecot.org/releases/${major_minor}/${rc_dir}${PN}-${major_minor}-pigeonhole-${sieve_version}.tar.gz
358 + ) "
359 +DESCRIPTION="An IMAP and POP3 server written with security primarily in mind"
360 +HOMEPAGE="http://www.dovecot.org/"
361 +
362 +SLOT="0"
363 +LICENSE="LGPL-2.1 MIT"
364 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86"
365 +
366 +IUSE_DOVECOT_AUTH="kerberos ldap lua mysql pam postgres sqlite vpopmail"
367 +IUSE_DOVECOT_COMPRESS="bzip2 lzma lz4 zlib"
368 +IUSE_DOVECOT_OTHER="argon2 caps doc ipv6 libressl lucene managesieve selinux sieve solr static-libs suid tcpd textcat"
369 +
370 +IUSE="${IUSE_DOVECOT_AUTH} ${IUSE_DOVECOT_STORAGE} ${IUSE_DOVECOT_COMPRESS} ${IUSE_DOVECOT_OTHER}"
371 +
372 +DEPEND="argon2? ( dev-libs/libsodium )
373 + bzip2? ( app-arch/bzip2 )
374 + caps? ( sys-libs/libcap )
375 + kerberos? ( virtual/krb5 )
376 + ldap? ( net-nds/openldap )
377 + lua? ( dev-lang/lua:* )
378 + lucene? ( >=dev-cpp/clucene-2.3 )
379 + lzma? ( app-arch/xz-utils )
380 + lz4? ( app-arch/lz4 )
381 + mysql? ( virtual/mysql )
382 + pam? ( virtual/pam )
383 + postgres? ( dev-db/postgresql:* !dev-db/postgresql[ldap,threads] )
384 + selinux? ( sec-policy/selinux-dovecot )
385 + solr? ( net-misc/curl dev-libs/expat )
386 + sqlite? ( dev-db/sqlite:* )
387 + !libressl? ( dev-libs/openssl:0 )
388 + libressl? ( dev-libs/libressl )
389 + tcpd? ( sys-apps/tcp-wrappers )
390 + textcat? ( app-text/libexttextcat )
391 + vpopmail? ( net-mail/vpopmail )
392 + zlib? ( sys-libs/zlib )
393 + virtual/libiconv
394 + dev-libs/icu:="
395 +
396 +RDEPEND="${DEPEND}
397 + net-mail/mailbase"
398 +
399 +PATCHES=()
400 +
401 +pkg_setup() {
402 + if use managesieve && ! use sieve; then
403 + ewarn "managesieve USE flag selected but sieve USE flag unselected"
404 + ewarn "sieve USE flag will be turned on"
405 + fi
406 + # default internal user
407 + enewgroup dovecot 97
408 + enewuser dovecot 97 -1 /dev/null dovecot
409 + # default login user
410 + enewuser dovenull -1 -1 /dev/null
411 + # add "mail" group for suid'ing. Better security isolation.
412 + if use suid; then
413 + enewgroup mail
414 + fi
415 +}
416 +
417 +src_configure() {
418 + local conf=""
419 +
420 + if use postgres || use mysql || use sqlite; then
421 + conf="${conf} --with-sql"
422 + fi
423 +
424 + # turn valgrind tests off. Bug #340791
425 + VALGRIND=no econf \
426 + --with-rundir="${EPREFIX}/run/dovecot" \
427 + --with-statedir="${EPREFIX}/var/lib/dovecot" \
428 + --with-moduledir="${EPREFIX}/usr/$(get_libdir)/dovecot" \
429 + --without-stemmer \
430 + --disable-rpath \
431 + --without-libbsd \
432 + --with-icu \
433 + --with-ssl \
434 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
435 + $( use_with argon2 sodium ) \
436 + $( use_with bzip2 bzlib ) \
437 + $( use_with caps libcap ) \
438 + $( use_with kerberos gssapi ) \
439 + $( use_with lua ) \
440 + $( use_with ldap ) \
441 + $( use_with lucene ) \
442 + $( use_with lz4 ) \
443 + $( use_with lzma ) \
444 + $( use_with mysql ) \
445 + $( use_with pam ) \
446 + $( use_with postgres pgsql ) \
447 + $( use_with sqlite ) \
448 + $( use_with solr ) \
449 + $( use_with tcpd libwrap ) \
450 + $( use_with textcat ) \
451 + $( use_with vpopmail ) \
452 + $( use_with zlib ) \
453 + $( use_enable static-libs static ) \
454 + ${conf}
455 +
456 + if use sieve || use managesieve ; then
457 + # The sieve plugin needs this file to be build to determine the plugin
458 + # directory and the list of libraries to link to.
459 + emake dovecot-config
460 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
461 + econf \
462 + $( use_enable static-libs static ) \
463 + --localstatedir="${EPREFIX}/var" \
464 + --enable-shared \
465 + --with-dovecot="../${MY_S}" \
466 + $( use_with managesieve )
467 + fi
468 +}
469 +
470 +src_compile() {
471 + default
472 + if use sieve || use managesieve ; then
473 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
474 + emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"
475 + fi
476 +}
477 +
478 +src_test() {
479 + default
480 + if use sieve || use managesieve ; then
481 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
482 + default
483 + fi
484 +}
485 +
486 +src_install () {
487 + default
488 +
489 + # insecure:
490 + # use suid && fperms u+s /usr/libexec/dovecot/deliver
491 + # better:
492 + if use suid;then
493 + einfo "Changing perms to allow deliver to be suided"
494 + fowners root:mail "${EPREFIX}/usr/libexec/dovecot/dovecot-lda"
495 + fperms 4750 "${EPREFIX}/usr/libexec/dovecot/dovecot-lda"
496 + fi
497 +
498 + newinitd "${FILESDIR}"/dovecot.init-r4 dovecot
499 +
500 + rm -rf "${ED}"/usr/share/doc/dovecot
501 +
502 + dodoc AUTHORS NEWS README TODO
503 + dodoc doc/*.{txt,cnf,xml,sh}
504 + docinto example-config
505 + dodoc doc/example-config/*.{conf,ext}
506 + docinto example-config/conf.d
507 + dodoc doc/example-config/conf.d/*.{conf,ext}
508 + docinto wiki
509 + dodoc doc/wiki/*
510 + doman doc/man/*.{1,7}
511 +
512 + # Create the dovecot.conf file from the dovecot-example.conf file that
513 + # the dovecot folks nicely left for us....
514 + local conf="${ED}/etc/dovecot/dovecot.conf"
515 + local confd="${ED}/etc/dovecot/conf.d"
516 +
517 + insinto /etc/dovecot
518 + doins doc/example-config/*.{conf,ext}
519 + insinto /etc/dovecot/conf.d
520 + doins doc/example-config/conf.d/*.{conf,ext}
521 + fperms 0600 "${EPREFIX}"/etc/dovecot/dovecot-{ldap,sql}.conf.ext
522 + rm -f "${confd}/../README"
523 +
524 + # .maildir is the Gentoo default
525 + local mail_location="maildir:~/.maildir"
526 + sed -i -e \
527 + "s|#mail_location =|mail_location = ${mail_location}|" \
528 + "${confd}/10-mail.conf" \
529 + || die "failed to update mail location settings in 10-mail.conf"
530 +
531 + # We're using pam files (imap and pop3) provided by mailbase
532 + if use pam; then
533 + sed -i -e '/driver = pam/,/^[ \t]*}/ s|#args = dovecot|args = "\*"|' \
534 + "${confd}/auth-system.conf.ext" \
535 + || die "failed to update PAM settings in auth-system.conf.ext"
536 + # mailbase does not provide a sieve pam file
537 + use managesieve && dosym imap /etc/pam.d/sieve
538 + sed -i -e \
539 + 's/#!include auth-system.conf.ext/!include auth-system.conf.ext/' \
540 + "${confd}/10-auth.conf" \
541 + || die "failed to update PAM settings in 10-auth.conf"
542 + fi
543 +
544 + # Disable ipv6 if necessary
545 + if ! use ipv6; then
546 + sed -i -e 's/^#listen = \*, ::/listen = \*/g' "${conf}" \
547 + || die "failed to update listen settings in dovecot.conf"
548 + fi
549 +
550 + # Update ssl cert locations
551 + sed -i -e 's:^#ssl = yes:ssl = yes:' "${confd}/10-ssl.conf" \
552 + || die "ssl conf failed"
553 + sed -i -e 's:^ssl_cert =.*:ssl_cert = </etc/ssl/dovecot/server.pem:' \
554 + -e 's:^ssl_key =.*:ssl_key = </etc/ssl/dovecot/server.key:' \
555 + "${confd}/10-ssl.conf" || die "failed to update SSL settings in 10-ssl.conf"
556 +
557 + # Install SQL configuration
558 + if use mysql || use postgres; then
559 + sed -i -e \
560 + 's/#!include auth-sql.conf.ext/!include auth-sql.conf.ext/' \
561 + "${confd}/10-auth.conf" || die "failed to update SQL settings in \
562 + 10-auth.conf"
563 + fi
564 +
565 + # Install LDAP configuration
566 + if use ldap; then
567 + sed -i -e \
568 + 's/#!include auth-ldap.conf.ext/!include auth-ldap.conf.ext/' \
569 + "${confd}/10-auth.conf" \
570 + || die "failed to update ldap settings in 10-auth.conf"
571 + fi
572 +
573 + if use vpopmail; then
574 + sed -i -e \
575 + 's/#!include auth-vpopmail.conf.ext/!include auth-vpopmail.conf.ext/' \
576 + "${confd}/10-auth.conf" \
577 + || die "failed to update vpopmail settings in 10-auth.conf"
578 + fi
579 +
580 + if use sieve || use managesieve ; then
581 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
582 + emake DESTDIR="${ED}" install
583 + sed -i -e \
584 + 's/^[[:space:]]*#mail_plugins = $mail_plugins/mail_plugins = sieve/' "${confd}/15-lda.conf" \
585 + || die "failed to update sieve settings in 15-lda.conf"
586 + rm -rf "${ED}"/usr/share/doc/dovecot
587 + docinto example-config/conf.d
588 + dodoc doc/example-config/conf.d/*.conf
589 + insinto /etc/dovecot/conf.d
590 + doins doc/example-config/conf.d/90-sieve{,-extprograms}.conf
591 + use managesieve && doins doc/example-config/conf.d/20-managesieve.conf
592 + docinto sieve/rfc
593 + dodoc doc/rfc/*.txt
594 + docinto sieve/devel
595 + dodoc doc/devel/DESIGN
596 + docinto plugins
597 + dodoc doc/plugins/*.txt
598 + docinto extensions
599 + dodoc doc/extensions/*.txt
600 + docinto locations
601 + dodoc doc/locations/*.txt
602 + doman doc/man/*.{1,7}
603 + fi
604 +
605 + use static-libs || find "${ED}"/usr/lib* -name '*.la' -delete
606 +}
607 +
608 +pkg_postinst() {
609 + # Let's not make a new certificate if we already have one
610 + if ! [[ -e "${ROOT}"/etc/ssl/dovecot/server.pem && \
611 + -e "${ROOT}"/etc/ssl/dovecot/server.key ]]; then
612 + einfo "Creating SSL certificate"
613 + SSL_ORGANIZATION="${SSL_ORGANIZATION:-Dovecot IMAP Server}"
614 + install_cert /etc/ssl/dovecot/server
615 + fi
616 +
617 + elog "Please read http://wiki2.dovecot.org/Upgrading/ for upgrade notes."
618 +}