From 010f6e3663b67d88429446e50b9162e906251885 Mon Sep 17 00:00:00 2001
From: Marcin Krol <hawk@tld-linux.org>
Date: Wed, 13 Apr 2016 07:54:13 +0000
Subject: [PATCH] - updated to 2.2.23, updated files, PLD merge

---
 dovecot-disableSSLv3.patch | 16 ++++++++++++++
 dovecot-rpath.patch        | 11 ++++++++++
 dovecot.spec               | 44 +++++++++++++++++++++++++++-----------
 3 files changed, 59 insertions(+), 12 deletions(-)
 create mode 100644 dovecot-disableSSLv3.patch
 create mode 100644 dovecot-rpath.patch

diff --git a/dovecot-disableSSLv3.patch b/dovecot-disableSSLv3.patch
new file mode 100644
index 0000000..f1884b8
--- /dev/null
+++ b/dovecot-disableSSLv3.patch
@@ -0,0 +1,16 @@
+diff -urN dovecot/dovecot-2.2.15/doc/example-config/conf.d/10-ssl.conf dovecotorg/dovecot-2.2.15/doc/example-config/conf.d/10-ssl.conf
+--- dovecot/dovecot-2.2.15/doc/example-config/conf.d/10-ssl.conf	2014-10-03 16:36:00.000000000 +0200
++++ dovecotorg/dovecot-2.2.15/doc/example-config/conf.d/10-ssl.conf	2015-01-16 15:52:55.917727519 +0100
+@@ -46,10 +46,10 @@
+ #ssl_dh_parameters_length = 1024
+ 
+ # SSL protocols to use
+-#ssl_protocols = !SSLv2
++ssl_protocols = !SSLv2 !SSLv3
+ 
+ # SSL ciphers to use
+-#ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL
++ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL:!SSLv3
+ 
+ # Prefer the server's order of ciphers over client's.
+ #ssl_prefer_server_ciphers = no
diff --git a/dovecot-rpath.patch b/dovecot-rpath.patch
new file mode 100644
index 0000000..89f885f
--- /dev/null
+++ b/dovecot-rpath.patch
@@ -0,0 +1,11 @@
+--- dovecot-2.2.18/Makefile.am~	2015-02-19 12:44:40.000000000 +0100
++++ dovecot-2.2.18/Makefile.am	2015-05-17 08:43:25.681245560 +0200
+@@ -64,7 +64,7 @@ install-exec-hook:
+ 	grep -v '^LIBDOVECOT_.*_INCLUDE' dovecot-config | \
+ 	grep -v '^LIBDOVECOT.*_DEPS' | sed \
+ 	-e "s|^\(DOVECOT_INSTALLED\)=.*$$|\1=yes|" \
+-	-e "s|^\(LIBDOVECOT\)=.*$$|\1='-L$(pkglibdir) -ldovecot'|" \
++	-e "s|^\(LIBDOVECOT\)=.*$$|\1='-rpath $(pkglibdir) -L$(pkglibdir) -ldovecot'|" \
+ 	-e "s|^\(LIBDOVECOT_LOGIN\)=.*$$|\1='-ldovecot-login $(SSL_LIBS)'|" \
+ 	-e "s|^\(LIBDOVECOT_SQL\)=.*$$|\1=-ldovecot-sql|" \
+ 	-e "s|^\(LIBDOVECOT_COMPRESS\)=.*$$|\1=-ldovecot-compression|" \
diff --git a/dovecot.spec b/dovecot.spec
index 6429e72..6eb03fe 100644
--- a/dovecot.spec
+++ b/dovecot.spec
@@ -1,42 +1,54 @@
-# Conditional build: 
+# Conditional build:
 %bcond_without	gssapi	# without GSSAPI support
 %bcond_without	ldap	# without LDAP auth
 %bcond_without	mysql	# without MySQL auth
 %bcond_without	pgsql	# without PostgreSQL auth
 %bcond_without	sqlite	# without SQLite3 auth
 %bcond_without	sasl	# without SASL auth
+%bcond_without	tests	# tests
 
 Summary:	IMAP and POP3 server written with security primarily in mind
 Summary(pl.UTF-8):	Serwer IMAP i POP3 pisany głównie z myślą o bezpieczeństwie
 Name:		dovecot
-Version:	2.2.22
+Version:	2.2.23
 Release:	1
 Epoch:		1
 License:	MIT (libraries), LGPL v2.1 (the rest)
 Group:		Networking/Daemons
 Source0:	http://dovecot.org/releases/2.2/%{name}-%{version}.tar.gz
-# Source0-md5:	bc8057bd5bdfa0f8e80e2fef1082a241
+# Source0-md5:	0d2855c19b0603b417cd70613b4a9f36
 Source1:	%{name}.pamd
 Source2:	%{name}.init
 Source3:	%{name}.sysconfig
 Patch0:		%{name}-config.patch
+Patch1:		%{name}-rpath.patch
+Patch2:		%{name}-disableSSLv3.patch
 URL:		http://dovecot.org/
 BuildRequires:	autoconf
 BuildRequires:	automake
 BuildRequires:	bzip2-devel
+BuildRequires:	clucene-core-devel >= 2.3.3.4
+BuildRequires:	curl-devel
 %{?with_sasl:BuildRequires:	cyrus-sasl-devel >= 2.0}
-BuildRequires:	gettext-devel
+BuildRequires:	expat-devel
+BuildRequires:	gettext-tools
 %{?with_gssapi:BuildRequires:	heimdal-devel}
 BuildRequires:	libcap-devel
+BuildRequires:	libicu-devel
+BuildRequires:	libstemmer-devel
+BuildRequires:	libexttextcat-devel
 BuildRequires:	libtool
+BuildRequires:	lz4-devel
 %{?with_mysql:BuildRequires:	mysql-devel}
 %{?with_ldap:BuildRequires:	openldap-devel >= 2.3.3}
 BuildRequires:	openssl-devel >= 0.9.7d
 BuildRequires:	pam-devel
 BuildRequires:	pkgconfig
 %{?with_pgsql:BuildRequires:	postgresql-devel}
+BuildRequires:	rpmbuild(macros) >= 1.647
 BuildRequires:	sed >= 4.0
 %{?with_sqlite:BuildRequires:	sqlite3-devel}
+BuildRequires:	xz-devel
 BuildRequires:	zlib-devel
 Requires(post,preun):	/sbin/chkconfig
 Requires(postun):	/usr/sbin/groupdel
@@ -142,6 +154,8 @@ Współdzielone biblioteki Dovecota.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
+%patch2 -p2
 
 %{__sed} -i 's,/usr/lib/dovecot,%{_libdir}/dovecot,g' doc/example-config/*.conf doc/example-config/conf.d/*.conf
 
@@ -153,6 +167,8 @@ touch config.rpath
 %{__autoheader}
 %{__automake}
 %configure \
+	ac_cv_prog_VALGRIND=no \
+	CPPFLAGS="%{rpmcppflags} -I/usr/include/libstemmer" \
 	--disable-static \
 	%{?debug:--enable-debug} \
 	%{?with_ldap:--with-ldap=yes} \
@@ -160,6 +176,9 @@ touch config.rpath
 	%{?with_pgsql:--with-pgsql} \
 	%{?with_sqlite:--with-sqlite} \
 	%{?with_gssapi:--with-gssapi=plugin} \
+	--with-lucene \
+	--with-stemmer \
+	--with-solr \
 	--with-sql=plugin \
 	--with-pam \
 	--with-zlib \
@@ -168,11 +187,12 @@ touch config.rpath
 	--with-ssl=openssl \
 	--with-moduledir=%{_libdir}/%{name}/plugins \
 	--with-ssldir=/var/lib/openssl \
-	--sysconfdir=%{_sysconfdir} \
-	--with-systemdsystemunitdir=/lib/systemd/system
+	--sysconfdir=%{_sysconfdir}
 
 %{__make}
 
+%{?with_tests:%{__make} check}
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT/etc/{pam.d,rc.d/init.d,sysconfig,security} \
@@ -191,8 +211,6 @@ touch $RPM_BUILD_ROOT/etc/security/blacklist.imap
 
 find $RPM_BUILD_ROOT%{_libdir}/%{name} -name '*.la' | xargs rm
 
-mv $RPM_BUILD_ROOT%{_libdir}/%{name}/dovecot-config $RPM_BUILD_ROOT%{_libdir}/%{name}-devel
-
 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}
 %{__rm} -r $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/README
 
@@ -322,6 +340,7 @@ fi
 %attr(755,root,root) %{_libdir}/%{name}/plugins/doveadm/*.so
 %dir %{_libdir}/%{name}/plugins/stats
 %attr(755,root,root) %{_libdir}/%{name}/plugins/stats/*.so
+%{_datadir}/dovecot
 %dir /var/lib/dovecot
 %dir /var/run/dovecot
 %attr(750,root,dovenull) %dir /var/run/dovecot/login
@@ -336,33 +355,34 @@ fi
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot.so
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-compression.so
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-dsync.so
+%attr(755,root,root) %{_libdir}/%{name}/libdovecot-fts.so
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-lda.so
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-login.so
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-sql.so
-#%attr(755,root,root) %{_libdir}/%{name}/libdovecot-ssl.so
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-storage.so
-%{_libdir}/%{name}-devel
+%{_libdir}/%{name}/%{name}-config
 %{_includedir}/%{name}
 %{_aclocaldir}/dovecot.m4
 
 %files libs
 %defattr(644,root,root,755)
 %dir %{_libdir}/%{name}
+
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot.so.0.0.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-compression.so.0.0.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-dsync.so.0.0.0
+%attr(755,root,root) %{_libdir}/%{name}/libdovecot-fts.so.0.0.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-lda.so.0.0.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-login.so.0.0.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-sql.so.0.0.0
-#%attr(755,root,root) %{_libdir}/%{name}/libdovecot-ssl.so.0.0.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-storage.so.0.0.0
 # Note: we are in %{_libdir}/dovecot, ldconfig does not look into this
 # directory. This is why the following files are not %ghost
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot.so.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-compression.so.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-dsync.so.0
+%attr(755,root,root) %{_libdir}/%{name}/libdovecot-fts.so.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-lda.so.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-login.so.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-sql.so.0
-#%attr(755,root,root) %{_libdir}/%{name}/libdovecot-ssl.so.0
 %attr(755,root,root) %{_libdir}/%{name}/libdovecot-storage.so.0
-- 
2.49.0