From c8ae08e7fc4d4e10c9683e0ff4d9970ec004b53db90cc5ca22bf346778e66a44 Mon Sep 17 00:00:00 2001 From: Marcus Rueckert Date: Mon, 25 Dec 2017 18:51:39 +0000 Subject: [PATCH] - backport 321a39be974deb2e7eff7b2a509a3ee6ff2e5ae1.patch fixes crash with imap sieve OBS-URL: https://build.opensuse.org/package/show/server:mail/dovecot23?expand=0&rev=2 --- ...39be974deb2e7eff7b2a509a3ee6ff2e5ae1.patch | 61 +++++++++++++++++++ dovecot23.changes | 6 ++ dovecot23.spec | 4 ++ 3 files changed, 71 insertions(+) create mode 100644 321a39be974deb2e7eff7b2a509a3ee6ff2e5ae1.patch diff --git a/321a39be974deb2e7eff7b2a509a3ee6ff2e5ae1.patch b/321a39be974deb2e7eff7b2a509a3ee6ff2e5ae1.patch new file mode 100644 index 0000000..3e01288 --- /dev/null +++ b/321a39be974deb2e7eff7b2a509a3ee6ff2e5ae1.patch @@ -0,0 +1,61 @@ +From 321a39be974deb2e7eff7b2a509a3ee6ff2e5ae1 Mon Sep 17 00:00:00 2001 +From: Stephan Bosch +Date: Mon, 25 Dec 2017 18:20:14 +0100 +Subject: [PATCH] plugins: sieve-extprograms: Fix segfault occurring when used + in IMAPSieve context. + +This was caused by recent lib-smtp changes. +There is no envelope in IMAPSieve context, so the rcpt parameters are NULL, causing the segfault. +--- + .../sieve-extprograms/sieve-extprograms-common.c | 29 +++++++++++++--------- + 1 file changed, 17 insertions(+), 12 deletions(-) + +diff --git a/src/plugins/sieve-extprograms/sieve-extprograms-common.c b/src/plugins/sieve-extprograms/sieve-extprograms-common.c +index 8fef2f53..5f0ed728 100644 +--- a/src/plugins/sieve-extprograms/sieve-extprograms-common.c ++++ b/src/plugins/sieve-extprograms/sieve-extprograms-common.c +@@ -415,6 +415,7 @@ struct sieve_extprogram *sieve_extprogram_create + struct sieve_instance *svinst = ext->svinst; + struct sieve_extprograms_config *ext_config = + (struct sieve_extprograms_config *) ext->context; ++ const struct smtp_address *sender, *recipient, *orig_recipient; + struct sieve_extprogram *sprog; + const char *path = NULL; + struct stat st; +@@ -549,20 +550,24 @@ struct sieve_extprogram *sieve_extprogram_create + program_client_set_env(sprog->program_client, "HOME", svinst->home_dir); + if ( svinst->hostname != NULL ) + program_client_set_env(sprog->program_client, "HOST", svinst->hostname); +- if ( !smtp_address_isnull(msgdata->envelope.mail_from) ) { +- program_client_set_env +- (sprog->program_client, "SENDER", +- smtp_address_encode(msgdata->envelope.mail_from)); ++ ++ sender = msgdata->envelope.mail_from; ++ recipient = msgdata->envelope.rcpt_to; ++ orig_recipient = NULL; ++ if ( msgdata->envelope.rcpt_params != NULL ) ++ orig_recipient = msgdata->envelope.rcpt_params->orcpt.addr; ++ ++ if ( !smtp_address_isnull(sender) ) { ++ program_client_set_env(sprog->program_client, "SENDER", ++ smtp_address_encode(sender)); + } +- if ( !smtp_address_isnull(msgdata->envelope.rcpt_to) ) { +- program_client_set_env +- (sprog->program_client, "RECIPIENT", +- smtp_address_encode(msgdata->envelope.rcpt_to)); ++ if ( !smtp_address_isnull(recipient) ) { ++ program_client_set_env(sprog->program_client, "RECIPIENT", ++ smtp_address_encode(recipient)); + } +- if ( !smtp_address_isnull(msgdata->envelope.rcpt_params->orcpt.addr) ) { +- program_client_set_env +- (sprog->program_client, "ORIG_RECIPIENT", +- smtp_address_encode(msgdata->envelope.rcpt_params->orcpt.addr)); ++ if ( !smtp_address_isnull(orig_recipient) ) { ++ program_client_set_env(sprog->program_client, "ORIG_RECIPIENT", ++ smtp_address_encode(orig_recipient)); + } + + return sprog; diff --git a/dovecot23.changes b/dovecot23.changes index 3e22d34..5c02f4b 100644 --- a/dovecot23.changes +++ b/dovecot23.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Dec 25 18:47:35 UTC 2017 - mrueckert@suse.de + +- backport 321a39be974deb2e7eff7b2a509a3ee6ff2e5ae1.patch + fixes crash with imap sieve + ------------------------------------------------------------------- Sun Dec 24 02:04:25 UTC 2017 - mrueckert@suse.de diff --git a/dovecot23.spec b/dovecot23.spec index ce8740e..32c1ac5 100644 --- a/dovecot23.spec +++ b/dovecot23.spec @@ -133,6 +133,7 @@ Source8: dovecot-2.2-pigeonhole.configfiles Source9: dovecot-2.3-pigeonhole.configfiles Patch: dovecot-2.3.0-dont_use_etc_ssl_certs.patch Patch1: dovecot-2.3.0-better_ssl_defaults.patch +Patch2: https://github.com/stephanbosch/pigeonhole-core/commit/321a39be974deb2e7eff7b2a509a3ee6ff2e5ae1.patch Summary: IMAP and POP3 Server Written Primarily with Security in Mind License: BSD-3-Clause and LGPL-2.1+ and MIT Group: Productivity/Networking/Email/Servers @@ -312,6 +313,9 @@ dovecot tree. %setup -q -n %{pkg_name}-ce-%{dovecot_version} -a 1 %patch -p1 %patch1 -p1 +pushd %{dovecot_pigeonhole_source_dir} +%patch2 -p1 +popd %{__gzip} -9v ChangeLog # Fix plugins dir. %{__sed} -i 's|#mail_plugin_dir = /usr/lib/dovecot|mail_plugin_dir = %{_libdir}/dovecot/modules|' doc/example-config/conf.d/10-mail.conf