From: Timo Sirainen Date: Tue, 30 Jul 2019 11:15:11 +0000 (+0300) Subject: lib-smtp: Fix encoding quoted localparts that end with "." X-Git-Tag: 2.3.8~159 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=373d46a55a56f07af94a5fc50fe74f41a38d14c9;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: Fix encoding quoted localparts that end with "." For example "user..@example.com" or "user..test.@example.com" resulted in an extra '"' prefix. --- diff --git a/src/lib-smtp/smtp-address.c b/src/lib-smtp/smtp-address.c index bb31d34a67..1bae3301b3 100644 --- a/src/lib-smtp/smtp-address.c +++ b/src/lib-smtp/smtp-address.c @@ -540,7 +540,7 @@ void smtp_address_write(string_t *out, pblock = p; } - if (p == pblock) { + if (p == pblock && !quoted) { quoted = TRUE; str_insert(out, begin, "\""); } diff --git a/src/lib-smtp/test-smtp-address.c b/src/lib-smtp/test-smtp-address.c index 30e6499139..ad25f08410 100644 --- a/src/lib-smtp/test-smtp-address.c +++ b/src/lib-smtp/test-smtp-address.c @@ -94,6 +94,10 @@ valid_mailbox_parse_tests[] = { .input = "Abc..123@example.com", .output = "\"Abc..123\"@example.com", .address = { .localpart = "Abc..123", .domain = "example.com" }, + }, { + .input = "Abc..@example.com", + .output = "\"Abc..\"@example.com", + .address = { .localpart = "Abc..", .domain = "example.com" }, } };