- pull backport patch dovecot-2.3.0.1-over-quota-lmtp-crash.patch
OBS-URL: https://build.opensuse.org/package/show/server:mail/dovecot23?expand=0&rev=7
This commit is contained in:
parent
355adda1ff
commit
572e38fe4f
162
dovecot-2.3.0.1-over-quota-lmtp-crash.patch
Normal file
162
dovecot-2.3.0.1-over-quota-lmtp-crash.patch
Normal file
@ -0,0 +1,162 @@
|
||||
From 2bf919786518d138cc07d9cc21e14ad5e07e5e56 Mon Sep 17 00:00:00 2001
|
||||
From: Stephan Bosch <stephan.bosch@dovecot.fi>
|
||||
Date: Wed, 17 Jan 2018 21:26:44 +0100
|
||||
Subject: [PATCH] lmtp: local: Fix segfault occurring when quota is exceeded.
|
||||
|
||||
---
|
||||
src/lmtp/lmtp-local.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c
|
||||
index fa1ce5d869..5b5fe51a95 100644
|
||||
--- a/src/lmtp/lmtp-local.c
|
||||
+++ b/src/lmtp/lmtp-local.c
|
||||
@@ -133,7 +133,7 @@ static void
|
||||
lmtp_local_rcpt_reply_overquota(struct lmtp_local_recipient *rcpt,
|
||||
const char *error)
|
||||
{
|
||||
- struct smtp_address *address = rcpt->rcpt.rcpt->path;
|
||||
+ struct smtp_address *address = rcpt->rcpt.path;
|
||||
struct lda_settings *lda_set =
|
||||
mail_storage_service_user_get_set(rcpt->service_user)[2];
|
||||
|
||||
From cdbcc8db8e0a04b2cbf6ca9f20b3ee7f7173552d Mon Sep 17 00:00:00 2001
|
||||
From: Stephan Bosch <stephan.bosch@dovecot.fi>
|
||||
Date: Wed, 31 Jan 2018 10:30:23 +0100
|
||||
Subject: [PATCH 1/3] lmtp: local: Make local variable for rcpt->rcpt.rcpt_cmd
|
||||
in lmtp_local_rcpt_check_quota().
|
||||
|
||||
---
|
||||
src/lmtp/lmtp-local.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c
|
||||
index c770e35e5b..d0ee4b312e 100644
|
||||
--- a/src/lmtp/lmtp-local.c
|
||||
+++ b/src/lmtp/lmtp-local.c
|
||||
@@ -195,6 +195,7 @@ static int
|
||||
lmtp_local_rcpt_check_quota(struct lmtp_local_recipient *rcpt)
|
||||
{
|
||||
struct client *client = rcpt->rcpt.client;
|
||||
+ struct smtp_server_cmd_ctx *cmd = rcpt->rcpt.rcpt_cmd;
|
||||
struct smtp_address *address = rcpt->rcpt.path;
|
||||
struct mail_user *user;
|
||||
struct mail_namespace *ns;
|
||||
@@ -245,10 +246,10 @@ lmtp_local_rcpt_check_quota(struct lmtp_local_recipient *rcpt)
|
||||
}
|
||||
|
||||
if (ret < 0 &&
|
||||
- !smtp_server_command_is_replied(rcpt->rcpt.rcpt_cmd->cmd)) {
|
||||
- smtp_server_reply(rcpt->rcpt.rcpt_cmd,
|
||||
- 451, "4.3.0", "<%s> Temporary internal error",
|
||||
- smtp_address_encode(address));
|
||||
+ !smtp_server_command_is_replied(cmd->cmd)) {
|
||||
+ smtp_server_reply(cmd, 451, "4.3.0",
|
||||
+ "<%s> Temporary internal error",
|
||||
+ smtp_address_encode(address));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
From c23717da4af9d3275cb45cbc67faaa8daa353ec1 Mon Sep 17 00:00:00 2001
|
||||
From: Stephan Bosch <stephan.bosch@dovecot.fi>
|
||||
Date: Wed, 31 Jan 2018 10:34:11 +0100
|
||||
Subject: [PATCH 2/3] lmtp: local: Add explicit cmd parameter to
|
||||
lmtp_local_rcpt_reply_overquota().
|
||||
|
||||
Using the RCPT cmd is only valid for the RCPT command and not when quota excess
|
||||
is detected during DATA. That would cause a segmentation fault, since
|
||||
rcpt->rcpt.rcpt_cmd == NULL.
|
||||
---
|
||||
src/lmtp/lmtp-local.c | 15 +++++++--------
|
||||
1 file changed, 7 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c
|
||||
index d0ee4b312e..c19c449e61 100644
|
||||
--- a/src/lmtp/lmtp-local.c
|
||||
+++ b/src/lmtp/lmtp-local.c
|
||||
@@ -134,6 +134,7 @@ lmtp_local_rcpt_deinit(struct lmtp_local_recipient *rcpt)
|
||||
|
||||
static void
|
||||
lmtp_local_rcpt_reply_overquota(struct lmtp_local_recipient *rcpt,
|
||||
+ struct smtp_server_cmd_ctx *cmd,
|
||||
const char *error)
|
||||
{
|
||||
struct smtp_address *address = rcpt->rcpt.path;
|
||||
@@ -141,13 +142,11 @@ lmtp_local_rcpt_reply_overquota(struct lmtp_local_recipient *rcpt,
|
||||
mail_storage_service_user_get_set(rcpt->service_user)[2];
|
||||
|
||||
if (lda_set->quota_full_tempfail) {
|
||||
- smtp_server_reply(rcpt->rcpt.rcpt_cmd,
|
||||
- 452, "4.2.2", "<%s> %s",
|
||||
- smtp_address_encode(address), error);
|
||||
+ smtp_server_reply(cmd, 452, "4.2.2", "<%s> %s",
|
||||
+ smtp_address_encode(address), error);
|
||||
} else {
|
||||
- smtp_server_reply(rcpt->rcpt.rcpt_cmd,
|
||||
- 552, "5.2.2", "<%s> %s",
|
||||
- smtp_address_encode(address), error);
|
||||
+ smtp_server_reply(cmd, 552, "5.2.2", "<%s> %s",
|
||||
+ smtp_address_encode(address), error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +231,7 @@ lmtp_local_rcpt_check_quota(struct lmtp_local_recipient *rcpt)
|
||||
if (ret < 0) {
|
||||
error = mailbox_get_last_error(box, &mail_error);
|
||||
if (mail_error == MAIL_ERROR_NOQUOTA) {
|
||||
- lmtp_local_rcpt_reply_overquota(rcpt, error);
|
||||
+ lmtp_local_rcpt_reply_overquota(rcpt, cmd, error);
|
||||
} else {
|
||||
i_error("mailbox_get_status(%s, STATUS_CHECK_OVER_QUOTA) "
|
||||
"failed: %s",
|
||||
@@ -623,7 +622,7 @@ lmtp_local_deliver(struct lmtp_local *local,
|
||||
} else if (storage != NULL) {
|
||||
error = mail_storage_get_last_error(storage, &mail_error);
|
||||
if (mail_error == MAIL_ERROR_NOQUOTA) {
|
||||
- lmtp_local_rcpt_reply_overquota(rcpt, error);
|
||||
+ lmtp_local_rcpt_reply_overquota(rcpt, cmd, error);
|
||||
} else {
|
||||
smtp_server_reply_index(cmd, rcpt_idx,
|
||||
451, "4.2.0", "<%s> %s",
|
||||
|
||||
From f8d9e6c977847a411af9986c9be62f74e4b06143 Mon Sep 17 00:00:00 2001
|
||||
From: Stephan Bosch <stephan.bosch@dovecot.fi>
|
||||
Date: Wed, 31 Jan 2018 10:27:54 +0100
|
||||
Subject: [PATCH 3/3] lmtp: local: Use recipient index in
|
||||
lmtp_local_rcpt_reply_overquota().
|
||||
|
||||
When used during the DATA command, it should send a reply for the correct
|
||||
recipient. During the RCPT command there is only one reply due. Added assert
|
||||
that checks this.
|
||||
---
|
||||
src/lmtp/lmtp-local.c | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c
|
||||
index c19c449e61..0b5e7e06ec 100644
|
||||
--- a/src/lmtp/lmtp-local.c
|
||||
+++ b/src/lmtp/lmtp-local.c
|
||||
@@ -138,15 +138,18 @@ lmtp_local_rcpt_reply_overquota(struct lmtp_local_recipient *rcpt,
|
||||
const char *error)
|
||||
{
|
||||
struct smtp_address *address = rcpt->rcpt.path;
|
||||
+ unsigned int rcpt_idx = rcpt->rcpt.index;
|
||||
struct lda_settings *lda_set =
|
||||
mail_storage_service_user_get_set(rcpt->service_user)[2];
|
||||
|
||||
+ i_assert(rcpt_idx == 0 || rcpt->rcpt.rcpt_cmd == NULL);
|
||||
+
|
||||
if (lda_set->quota_full_tempfail) {
|
||||
- smtp_server_reply(cmd, 452, "4.2.2", "<%s> %s",
|
||||
- smtp_address_encode(address), error);
|
||||
+ smtp_server_reply_index(cmd, rcpt_idx, 452, "4.2.2", "<%s> %s",
|
||||
+ smtp_address_encode(address), error);
|
||||
} else {
|
||||
- smtp_server_reply(cmd, 552, "5.2.2", "<%s> %s",
|
||||
- smtp_address_encode(address), error);
|
||||
+ smtp_server_reply_index(cmd, rcpt_idx, 552, "5.2.2", "<%s> %s",
|
||||
+ smtp_address_encode(address), error);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 6 17:54:58 UTC 2018 - mrueckert@suse.de
|
||||
|
||||
- pull backport patch dovecot-2.3.0.1-over-quota-lmtp-crash.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 6 13:48:50 UTC 2018 - mrueckert@suse.de
|
||||
|
||||
|
@ -134,6 +134,7 @@ 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
|
||||
Patch3: dovecot-2.3.0.1-over-quota-lmtp-crash.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
|
||||
@ -313,6 +314,7 @@ dovecot tree.
|
||||
%setup -q -n %{pkg_name}-%{dovecot_version} -a 1
|
||||
%patch -p1
|
||||
%patch1 -p1
|
||||
%patch3 -p1
|
||||
pushd %{dovecot_pigeonhole_source_dir}
|
||||
%patch2 -p1
|
||||
popd
|
||||
|
Loading…
Reference in New Issue
Block a user