dovecot fix for ssl
Hanno Böck

Hanno Böck commited on 2014-06-16 15:14:58
Zeige 6 geänderte Dateien mit 454 Einfügungen und 0 Löschungen.

... ...
@@ -0,0 +1,7 @@
1
+AUX dovecot-10-ssl.patch 675 SHA256 973d6736a13ac8e56618e1a4d1b0e7a4e47c44e792d542803745fd5f2aec6ae1 SHA512 a201cbc275dbe4182d26971cc1c90ece22c05455535b7e55241ac0e71d61233882ad088d127cca2d1cd0d82dc86b1731ec98570254e29b056315567a1fd4d4a7 WHIRLPOOL ac9f4762684713507d3f196b97d7de16d228ac3f7ebd69e759b13efcb86caba821a439a15df300c41fd9c22738aec651e92c300350228f878a9c205d28850f6c
2
+AUX dovecot-sslfix-1.diff 1435 SHA256 17ac8312474ec779da124f1f7f9f023b7ed88f73599e06af63b966d1144c51cd SHA512 7367421c920c237df8bbb9f96b12d58785ee681e16814934425c82fdb0b49da4c9206a5e52bb458998f74092fd791898c8742906f045241ac4f5e4d76ed7825d WHIRLPOOL 0147dd5fa1654a616910e1db6c777891cf615d6bf865c4c8ddb5e7d07d4bc49c1d1ec1205ef2add6b043e2e4c620f1ad2aef21341aeeb4b5ecf6326c616b469f
3
+AUX dovecot-sslfix-2.diff 880 SHA256 650ea97731946f1c0334478552f915515e6a33ce5f02291334f1f749bfacd3e9 SHA512 738e02aad4eb59f863516410f05c3456e6d0e83a2b931d030f6c31a24d556ba15db8b0dcb4ab804af6dd6cc0fa750790246000ef5c22ac8ce700d71ffee40e6a WHIRLPOOL 85ae45d1ba6f4dadb9c3f57aa38b09335d8ed89bc2a16bba79d87b093189e2bf720aab4f85e83210236004cd420586bf653e14ee55b1a344057f2eba4f892603
4
+AUX dovecot.init-r4 1609 SHA256 510ebab9dc59832502a9a23d48d12b6e81f3c51c52f5e6652b00b240f621d02e SHA512 9aa5040cd169bfa0dea382d839ef73454105d3befd1e904cef8d0a07eb260051f72f130ba250d716b9bf9b22af542907446e02c4ec92f1c229a2c0a9f560e2cc WHIRLPOOL 51726ed76100521e54470137dab9869537dcf49a58872614312295dff3efab53ac58da30b8bfaaf86677f47ef1e84019e47529226c0a736eed68cac6ce64ae40
5
+DIST dovecot-2.2-pigeonhole-0.4.3.tar.gz 1184029 SHA256 d692f4ab077bdf2c43c98829ed24b2e6f148db488ef8ba429b430394d8b4d757 SHA512 f2bb83578bb05c7ca2213ecc110f5e7059935746f720ee43897508394f3ab8a7072d193c78caf1fa77df81a20fbbeab1ac14069989250b3032ef459e798c54ff WHIRLPOOL 854d58cdb6b0d51d6e6337a2716858020a1ec22b7da24db903965fc01a00a75af5efcde7c4ddf572c0ee2a36a51bf467da011276f8a4e092463dc76e2622bfbb
6
+DIST dovecot-2.2.13.tar.gz 4613824 SHA256 133cf3d2aa81733f6688ec986c91dbe07602fad81e856ba3d8046ffca85d9dce SHA512 1f3c0e600048ac2c1b2e497286620976c0fc821a6cac8e4e1492180af8eb9620cd143c89ee6d12872cecacbcadca573435cce1050c46325de3072c98ab5a9331 WHIRLPOOL 7bb81575faf69820b07d654c469fdd3fcf12c47517bb1dd6ea5566771bb60ce8f9c3a1a7b5c6df6d5f4b903d10472ffa1cca1a01c7fd158b6055794a44aacf39
7
+EBUILD dovecot-2.2.13-r1.ebuild 8991 SHA256 77ddaaacbf7a3d26a66021db8593b63280929595d18dd2f5e7ba468eb29dbde2 SHA512 7b8e9bb143decec9d8e2922d0b975cbb6c0dd226cf789d8523d9046560d8af595abb11015b5c19ba20b509786ce351c54063c79b12ec6b7f1604ad9ba48db175 WHIRLPOOL 2cf6b1736982f4270f9fecc086e1c778a558d3f80f249b4ae2e3dddde8dea067470973674cc8de0ef786294cd373cc49bb866dc97cdecd000f8668f7618d7e2e
... ...
@@ -0,0 +1,294 @@
1
+# Copyright 1999-2014 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/net-mail/dovecot/dovecot-2.2.13-r1.ebuild,v 1.3 2014/05/28 12:29:57 pinkbyte Exp $
4
+
5
+EAPI=5
6
+inherit eutils multilib ssl-cert systemd user versionator
7
+
8
+MY_P="${P/_/.}"
9
+major_minor="$(get_version_component_range 1-2)"
10
+sieve_version="0.4.3"
11
+if [[ ${PV} == *_rc* ]] ; then
12
+	rc_dir="rc/"
13
+else
14
+	rc_dir=""
15
+fi
16
+SRC_URI="http://dovecot.org/releases/${major_minor}/${rc_dir}${MY_P}.tar.gz
17
+	sieve? (
18
+	http://pigeonhole.dovecot.org/releases/${major_minor}/${PN}-${major_minor}-pigeonhole-${sieve_version}.tar.gz
19
+	)
20
+	managesieve? (
21
+	http://pigeonhole.dovecot.org/releases/${major_minor}/${PN}-${major_minor}-pigeonhole-${sieve_version}.tar.gz
22
+	) "
23
+DESCRIPTION="An IMAP and POP3 server written with security primarily in mind"
24
+HOMEPAGE="http://www.dovecot.org/"
25
+
26
+SLOT="0"
27
+LICENSE="LGPL-2.1 MIT"
28
+KEYWORDS="amd64 ~arm hppa ~ia64 x86"
29
+
30
+IUSE_DOVECOT_AUTH="kerberos ldap mysql pam postgres sqlite vpopmail"
31
+IUSE_DOVECOT_STORAGE="cydir imapc +maildir mbox mdbox pop3c sdbox"
32
+IUSE_DOVECOT_COMPRESS="bzip2 lzma lz4 zlib"
33
+IUSE_DOVECOT_OTHER="caps doc ipv6 lucene managesieve selinux sieve solr +ssl static-libs suid tcpd"
34
+
35
+IUSE="${IUSE_DOVECOT_AUTH} ${IUSE_DOVECOT_STORAGE} ${IUSE_DOVECOT_COMPRESS} ${IUSE_DOVECOT_OTHER}"
36
+
37
+DEPEND="bzip2? ( app-arch/bzip2 )
38
+	caps? ( sys-libs/libcap )
39
+	kerberos? ( virtual/krb5 )
40
+	ldap? ( net-nds/openldap )
41
+	lucene? ( >=dev-cpp/clucene-2.3 )
42
+	lzma? ( app-arch/xz-utils )
43
+	lz4? ( app-arch/lz4 )
44
+	mysql? ( virtual/mysql )
45
+	pam? ( virtual/pam )
46
+	postgres? ( dev-db/postgresql-base !dev-db/postgresql-base[ldap,threads] )
47
+	selinux? ( sec-policy/selinux-dovecot )
48
+	solr? ( net-misc/curl dev-libs/expat )
49
+	sqlite? ( dev-db/sqlite )
50
+	ssl? ( dev-libs/openssl )
51
+	tcpd? ( sys-apps/tcp-wrappers )
52
+	vpopmail? ( net-mail/vpopmail )
53
+	zlib? ( sys-libs/zlib )
54
+	virtual/libiconv"
55
+
56
+RDEPEND="${DEPEND}
57
+	net-mail/mailbase"
58
+
59
+S=${WORKDIR}/${MY_P}
60
+
61
+pkg_setup() {
62
+	if use managesieve && ! use sieve; then
63
+		ewarn "managesieve USE flag selected but sieve USE flag unselected"
64
+		ewarn "sieve USE flag will be turned on"
65
+	fi
66
+	# default internal user
67
+	enewgroup dovecot 97
68
+	enewuser dovecot 97 -1 /dev/null dovecot
69
+	# default login user
70
+	enewuser dovenull -1 -1 /dev/null
71
+	# add "mail" group for suid'ing. Better security isolation.
72
+	if use suid; then
73
+		enewgroup mail
74
+	fi
75
+}
76
+
77
+src_prepare() {
78
+	epatch "${FILESDIR}/${PN}-10-ssl.patch"
79
+	epatch "${FILESDIR}/dovecot-sslfix-1.diff"
80
+	epatch "${FILESDIR}/dovecot-sslfix-2.diff"
81
+}
82
+
83
+src_configure() {
84
+	local conf=""
85
+
86
+	if use postgres || use mysql || use sqlite; then
87
+		conf="${conf} --with-sql"
88
+	fi
89
+
90
+	local storages=""
91
+	for storage in ${IUSE_DOVECOT_STORAGE//+/}; do
92
+		use ${storage} && storages="${storage} ${storages}"
93
+	done
94
+	[ "${storages}" ] || storages="maildir"
95
+
96
+	# turn valgrind tests off. Bug #340791
97
+	VALGRIND=no econf \
98
+		--localstatedir="${EPREFIX}/var" \
99
+		--with-moduledir="${EPREFIX}/usr/$(get_libdir)/dovecot" \
100
+		--without-stemmer \
101
+		--with-storages="${storages}" \
102
+		--disable-rpath \
103
+		$( systemd_with_unitdir ) \
104
+		$( use_with bzip2 bzlib ) \
105
+		$( use_with caps libcap ) \
106
+		$( use_with kerberos gssapi ) \
107
+		$( use_with ldap ) \
108
+		$( use_with lucene ) \
109
+		$( use_with mysql ) \
110
+		$( use_with pam ) \
111
+		$( use_with postgres pgsql ) \
112
+		$( use_with sqlite ) \
113
+		$( use_with solr ) \
114
+		$( use_with ssl ) \
115
+		$( use_with tcpd libwrap ) \
116
+		$( use_with vpopmail ) \
117
+		$( use_with zlib ) \
118
+		$( use_enable static-libs static ) \
119
+		${conf}
120
+
121
+	if use sieve || use managesieve ; then
122
+		# The sieve plugin needs this file to be build to determine the plugin
123
+		# directory and the list of libraries to link to.
124
+		emake dovecot-config
125
+		cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
126
+		econf \
127
+			$( use_enable static-libs static ) \
128
+			--localstatedir="${EPREFIX}/var" \
129
+			--enable-shared \
130
+			--with-dovecot="../${MY_P}" \
131
+			$( use_with managesieve )
132
+	fi
133
+}
134
+
135
+src_compile() {
136
+	default
137
+	if use sieve || use managesieve ; then
138
+		cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
139
+		emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"
140
+	fi
141
+}
142
+
143
+src_test() {
144
+	default
145
+	if use sieve || use managesieve ; then
146
+		cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
147
+		default
148
+	fi
149
+}
150
+
151
+src_install () {
152
+	default
153
+
154
+	# insecure:
155
+	# use suid && fperms u+s /usr/libexec/dovecot/deliver
156
+	# better:
157
+	if use suid;then
158
+		einfo "Changing perms to allow deliver to be suided"
159
+		fowners root:mail "${EPREFIX}/usr/libexec/dovecot/dovecot-lda"
160
+		fperms 4750 "${EPREFIX}/usr/libexec/dovecot/dovecot-lda"
161
+	fi
162
+
163
+	newinitd "${FILESDIR}"/dovecot.init-r4 dovecot
164
+
165
+	rm -rf "${ED}"/usr/share/doc/dovecot
166
+
167
+	dodoc AUTHORS NEWS README TODO
168
+	dodoc doc/*.{txt,cnf,xml,sh}
169
+	docinto example-config
170
+	dodoc doc/example-config/*.{conf,ext}
171
+	docinto example-config/conf.d
172
+	dodoc doc/example-config/conf.d/*.{conf,ext}
173
+	docinto wiki
174
+	dodoc doc/wiki/*
175
+	doman doc/man/*.{1,7}
176
+
177
+	# Create the dovecot.conf file from the dovecot-example.conf file that
178
+	# the dovecot folks nicely left for us....
179
+	local conf="${ED}/etc/dovecot/dovecot.conf"
180
+	local confd="${ED}/etc/dovecot/conf.d"
181
+
182
+	insinto /etc/dovecot
183
+	doins doc/example-config/*.{conf,ext}
184
+	insinto /etc/dovecot/conf.d
185
+	doins doc/example-config/conf.d/*.{conf,ext}
186
+	fperms 0600 "${EPREFIX}"/etc/dovecot/dovecot-{ldap,sql}.conf.ext
187
+	rm -f "${confd}/../README"
188
+
189
+	# .maildir is the Gentoo default
190
+	local mail_location="maildir:~/.maildir"
191
+	if ! use maildir; then
192
+		if use mbox; then
193
+			mail_location="mbox:/var/spool/mail/%u:INDEX=/var/dovecot/%u"
194
+			keepdir /var/dovecot
195
+			sed -i -e 's|#mail_privileged_group =|mail_privileged_group = mail|' \
196
+			"${confd}/10-mail.conf" || die "sed failed"
197
+		elif use mdbox ; then
198
+			mail_location="mdbox:~/.mdbox"
199
+		elif use sdbox ; then
200
+			mail_location="sdbox:~/.sdbox"
201
+		fi
202
+	fi
203
+	sed -i -e \
204
+		"s|#mail_location =|mail_location = ${mail_location}|" \
205
+		"${confd}/10-mail.conf" \
206
+		|| die "failed to update mail location settings in 10-mail.conf"
207
+
208
+	# We're using pam files (imap and pop3) provided by mailbase
209
+	if use pam; then
210
+		sed -i -e '/driver = pam/,/^[ \t]*}/ s|#args = dovecot|args = "\*"|' \
211
+			"${confd}/auth-system.conf.ext" \
212
+			|| die "failed to update PAM settings in auth-system.conf.ext"
213
+		# mailbase does not provide a sieve pam file
214
+		use managesieve && dosym imap /etc/pam.d/sieve
215
+		sed -i -e \
216
+			's/#!include auth-system.conf.ext/!include auth-system.conf.ext/' \
217
+			"${confd}/10-auth.conf" \
218
+			|| die "failed to update PAM settings in 10-auth.conf"
219
+	fi
220
+
221
+	# Disable ipv6 if necessary
222
+	if ! use ipv6; then
223
+		sed -i -e 's/^#listen = \*, ::/listen = \*/g' "${conf}" \
224
+			|| die "failed to update listen settings in dovecot.conf"
225
+	fi
226
+
227
+	# Update ssl cert locations
228
+	if use ssl; then
229
+		sed -i -e 's:^#ssl = yes:ssl = yes:' "${confd}/10-ssl.conf" \
230
+		|| die "ssl conf failed"
231
+		sed -i -e 's:^ssl_cert =.*:ssl_cert = </etc/ssl/dovecot/server.pem:' \
232
+			-e 's:^ssl_key =.*:ssl_key = </etc/ssl/dovecot/server.key:' \
233
+			"${confd}/10-ssl.conf" || die "failed to update SSL settings in 10-ssl.conf"
234
+	fi
235
+
236
+	# Install SQL configuration
237
+	if use mysql || use postgres; then
238
+		sed -i -e \
239
+			's/#!include auth-sql.conf.ext/!include auth-sql.conf.ext/' \
240
+			"${confd}/10-auth.conf" || die "failed to update SQL settings in \
241
+			10-auth.conf"
242
+	fi
243
+
244
+	# Install LDAP configuration
245
+	if use ldap; then
246
+		sed -i -e \
247
+			's/#!include auth-ldap.conf.ext/!include auth-ldap.conf.ext/' \
248
+			"${confd}/10-auth.conf" \
249
+			|| die "failed to update ldap settings in 10-auth.conf"
250
+	fi
251
+
252
+	if use vpopmail; then
253
+		sed -i -e \
254
+			's/#!include auth-vpopmail.conf.ext/!include auth-vpopmail.conf.ext/' \
255
+			"${confd}/10-auth.conf" \
256
+			|| die "failed to update vpopmail settings in 10-auth.conf"
257
+	fi
258
+
259
+	if use sieve || use managesieve ; then
260
+		cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
261
+		emake DESTDIR="${ED}" install
262
+		sed -i -e \
263
+			's/^[[:space:]]*#mail_plugins = $mail_plugins/mail_plugins = sieve/' "${confd}/15-lda.conf" \
264
+			|| die "failed to update sieve settings in 15-lda.conf"
265
+		rm -rf "${ED}"/usr/share/doc/dovecot
266
+		dodoc doc/*.txt
267
+		docinto example-config/conf.d
268
+		dodoc doc/example-config/conf.d/*.conf
269
+		insinto /etc/dovecot/conf.d
270
+		doins doc/example-config/conf.d/90-sieve{,-extprograms}.conf
271
+		use managesieve && doins doc/example-config/conf.d/20-managesieve.conf
272
+		docinto sieve/rfc
273
+		dodoc doc/rfc/*.txt
274
+		docinto sieve/devel
275
+		dodoc doc/devel/DESIGN
276
+		doman doc/man/*.{1,7}
277
+	fi
278
+
279
+	use static-libs || find "${ED}"/usr/lib* -name '*.la' -delete
280
+}
281
+
282
+pkg_postinst() {
283
+	if use ssl; then
284
+	# Let's not make a new certificate if we already have one
285
+		if ! [[ -e "${ROOT}"/etc/ssl/dovecot/server.pem && \
286
+		-e "${ROOT}"/etc/ssl/dovecot/server.key ]];	then
287
+			einfo "Creating SSL	certificate"
288
+			SSL_ORGANIZATION="${SSL_ORGANIZATION:-Dovecot IMAP Server}"
289
+			install_cert /etc/ssl/dovecot/server
290
+		fi
291
+	fi
292
+
293
+	elog "Please read http://wiki2.dovecot.org/Upgrading/ for upgrade notes."
294
+}
... ...
@@ -0,0 +1,19 @@
1
+# bug 508552
2
+--- doc/example-config/conf.d/10-ssl.conf	2013-11-24 13:37:39.000000000 +0000
3
++++ doc/example-config/conf.d/10-ssl.conf	2014-05-12 14:42:26.000000000 +0000
4
+@@ -51,6 +51,15 @@
5
+ # SSL ciphers to use
6
+ #ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL
7
+ 
8
++# ##########################################
9
++# You are strongly encouraged to change the above two settings to
10
++#
11
++#ssl_protocols = !SSLv2 !SSLv3
12
++#ssl_cipher_list = ALL:!EXPORT:!LOW:!MEDIUM:!aNULL:+RC4:@STRENGTH
13
++#
14
++# if you are not required to support legacy mail clients.
15
++# ##########################################
16
++
17
+ # Prefer the server's order of ciphers over client's.
18
+ #ssl_prefer_server_ciphers = no
19
+ 
... ...
@@ -0,0 +1,45 @@
1
+
2
+# HG changeset patch
3
+# User Timo Sirainen <tss@iki.fi>
4
+# Date 1401957019 -10800
5
+# Node ID 09d3c9c6f0ad473e0114edac67d4ec43cf7255bd
6
+# Parent  304d545927d25ea352ac596b7d7ce2e96468fe2e
7
+*-login: Flush SSL output when logging out.
8
+The BYE and LOGOUT replies weren't being sent when they were sent from
9
+imap-login process (before logging in).
10
+
11
+diff -r 304d545927d2 -r 09d3c9c6f0ad src/login-common/client-common.c
12
+--- a/src/login-common/client-common.c	Wed Jun 04 00:35:27 2014 +0300
13
++++ b/src/login-common/client-common.c	Thu Jun 05 11:30:19 2014 +0300
14
+@@ -172,6 +172,7 @@
15
+ 		last_client = client->prev;
16
+ 	DLLIST_REMOVE(&clients, client);
17
+ 
18
++	o_stream_uncork(client->output);
19
+ 	if (!client->login_success && client->ssl_proxy != NULL)
20
+ 		ssl_proxy_destroy(client->ssl_proxy);
21
+ 	if (client->input != NULL)
22
+diff -r 304d545927d2 -r 09d3c9c6f0ad src/login-common/ssl-proxy-openssl.c
23
+--- a/src/login-common/ssl-proxy-openssl.c	Wed Jun 04 00:35:27 2014 +0300
24
++++ b/src/login-common/ssl-proxy-openssl.c	Thu Jun 05 11:30:19 2014 +0300
25
+@@ -806,10 +806,19 @@
26
+ 	i_free(proxy);
27
+ }
28
+ 
29
++static void ssl_proxy_flush(struct ssl_proxy *proxy)
30
++{
31
++	/* this is pretty kludgy. mainly this is just for flushing the final
32
++	   LOGOUT command output. */
33
++	plain_read(proxy);
34
++	ssl_step(proxy);
35
++}
36
++
37
+ void ssl_proxy_destroy(struct ssl_proxy *proxy)
38
+ {
39
+ 	if (proxy->destroyed)
40
+ 		return;
41
++	ssl_proxy_flush(proxy);
42
+ 	proxy->destroyed = TRUE;
43
+ 
44
+ 	ssl_proxy_count--;
45
+
... ...
@@ -0,0 +1,31 @@
1
+
2
+# HG changeset patch
3
+# User Teemu Huovila <teemu.huovila@dovecot.fi>
4
+# Date 1402305282 -10800
5
+# Node ID 7129fe8bc260642cb79c8bbad9d20ef47e82f3d2
6
+# Parent  6a9508d28d340091b0a2897e4e4b5ba826d39a17
7
+login-common: Fixed infinite loop in ssl proxy flushing.
8
+
9
+diff -r 6a9508d28d34 -r 7129fe8bc260 src/login-common/ssl-proxy-openssl.c
10
+--- a/src/login-common/ssl-proxy-openssl.c	Mon Jun 09 12:12:58 2014 +0300
11
++++ b/src/login-common/ssl-proxy-openssl.c	Mon Jun 09 12:14:42 2014 +0300
12
+@@ -79,6 +79,7 @@
13
+ 	unsigned int cert_received:1;
14
+ 	unsigned int cert_broken:1;
15
+ 	unsigned int client_proxy:1;
16
++	unsigned int flushing:1;
17
+ };
18
+ 
19
+ struct ssl_parameters {
20
+@@ -816,8 +817,9 @@
21
+ 
22
+ void ssl_proxy_destroy(struct ssl_proxy *proxy)
23
+ {
24
+-	if (proxy->destroyed)
25
++	if (proxy->destroyed || proxy->flushing)
26
+ 		return;
27
++	proxy->flushing = TRUE;
28
+ 	ssl_proxy_flush(proxy);
29
+ 	proxy->destroyed = TRUE;
30
+ 
31
+
... ...
@@ -0,0 +1,58 @@
1
+#!/sbin/runscript
2
+# Copyright 1999-2012 Gentoo Foundation
3
+# Distributed under the terms of the GNU General Public License, v2 or later
4
+# $Header: /var/cvsroot/gentoo-x86/net-mail/dovecot/files/dovecot.init-r4,v 1.1 2012/12/01 10:40:49 eras Exp $
5
+
6
+extra_started_commands="reload"
7
+
8
+depend() {
9
+	need localmount
10
+	before postfix
11
+	after bootmisc ldap mysql ntp-client ntpd postgresql saslauthd slapd 
12
+	use logger net
13
+}
14
+
15
+checkconfig() {
16
+	DOVECOT_INSTANCE=${SVCNAME##*.}
17
+	if [ -n "${DOVECOT_INSTANCE}" -a "${SVCNAME}" != "dovecot" ]; then
18
+		DOVECOT_CONF=/etc/dovecot/dovecot.${DOVECOT_INSTANCE}.conf
19
+	else
20
+		DOVECOT_CONF=/etc/dovecot/dovecot.conf
21
+	fi
22
+	if [ ! -e ${DOVECOT_CONF} ]; then
23
+		eerror "You will need an ${DOVECOT_CONF} first"
24
+		return 1
25
+	fi
26
+	if [ -x /usr/sbin/dovecot ]; then
27
+		DOVECOT_BASEDIR=$(/usr/sbin/dovecot -c ${DOVECOT_CONF} -a | grep '^base_dir = ' | sed 's/^base_dir = //')
28
+	else
29
+		eerror "dovecot not executable"
30
+		return 1
31
+	fi
32
+	DOVECOT_BASEDIR=${DOVECOT_BASEDIR:-/var/run/dovecot}
33
+	DOVECOT_PIDFILE=${DOVECOT_BASEDIR}/master.pid
34
+}
35
+
36
+start() {
37
+	checkconfig || return 1
38
+	ebegin "Starting ${SVCNAME}"
39
+	start-stop-daemon --start --exec /usr/sbin/dovecot \
40
+		--pidfile "${DOVECOT_PIDFILE}" -- -c "${DOVECOT_CONF}"
41
+	eend $?
42
+}
43
+
44
+stop() {
45
+	checkconfig || return 1
46
+	ebegin "Stopping ${SVCNAME}"
47
+	start-stop-daemon --stop --exec /usr/sbin/dovecot \
48
+		--pidfile "${DOVECOT_PIDFILE}"
49
+	eend $?
50
+}
51
+
52
+reload() {
53
+	checkconfig || return 1
54
+	ebegin "Reloading ${SVCNAME} configs and restarting auth/login processes"
55
+	start-stop-daemon --signal HUP --exec /usr/sbin/dovecot \
56
+		--pidfile "${DOVECOT_PIDFILE}"
57
+	eend $?
58
+}
0 59