From 9410a74ca3b83b456e53bdc8a3df295e1cc8ad77 Mon Sep 17 00:00:00 2001 From: Jesse Norell Date: Tue, 5 Nov 2019 17:54:57 -0700 Subject: [PATCH] policy server allows empty recipient= in END-OF-MESSAGE state --- debian/changelog | 7 +++ .../quota-status-mulitple-recipients.patch | 44 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 52 insertions(+) create mode 100644 debian/patches/quota-status-mulitple-recipients.patch diff --git a/debian/changelog b/debian/changelog index 8c5345206..4ecd25d10 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +dovecot (1:2.3.7.2-1.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix bug in quota-status which fails on messages with multiple recipients. + + -- Jesse Norell Tue, 05 Nov 2019 18:20:32 -0700 + dovecot (1:2.3.7.2-1) unstable; urgency=medium * [dcaf24e] New upstream version 2.3.7.2 diff --git a/debian/patches/quota-status-mulitple-recipients.patch b/debian/patches/quota-status-mulitple-recipients.patch new file mode 100644 index 000000000..b823eb32f --- /dev/null +++ b/debian/patches/quota-status-mulitple-recipients.patch @@ -0,0 +1,44 @@ +Description: quota-status works with multiple recipients +This fixes a bug in quota-status which fails to return any response +when a message has multiple recipients. A postfix policy server is sent +an empty "recipient=" line in the END-OF-MESSAGE state when a message has +multiple recipients, and should respond with DUNNO. +Author: Jesse Norell +Last-Update: 2019-11-05 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/plugins/quota/quota-status.c ++++ b/src/plugins/quota/quota-status.c +@@ -154,6 +154,7 @@ + { + struct quota_client *client = (struct quota_client *)conn; + const char *error; ++ static char *value = ""; + + if (*line == '\0') { + o_stream_cork(conn->output); +@@ -162,12 +163,24 @@ + client_reset(client); + return 1; + } ++ if (str_begins(line, "protocol_state=")) { ++ value = t_strdup(line + 15); ++ if (strcmp(value, "RCPT") != 0 && strcmp(value, "END-OF-MESSAGE") != 0) { ++ return 1; ++ } ++ } + if (client->recipient == NULL && + str_begins(line, "recipient=")) { + if (smtp_address_parse_path(default_pool, line + 10, + SMTP_ADDRESS_PARSE_FLAG_ALLOW_LOCALPART | + SMTP_ADDRESS_PARSE_FLAG_BRACKETS_OPTIONAL, + &client->recipient, &error) < 0) { ++ if (strcmp(value, "END-OF-MESSAGE") == 0) { ++ if (strlen(line) == 10) { // multiple recipients has empty "recipient=" ++ client->recipient = NULL; ++ return 1; ++ } ++ } + i_error("quota-status: " + "Client sent invalid recipient address: %s", + error); diff --git a/debian/patches/series b/debian/patches/series index d39072d47..210d36ce1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,3 +7,4 @@ exampledir.patch mboxlocking.patch dovecot_name.patch ssl-dh-params-location.patch +quota-status-mulitple-recipients.patch -- GitLab