Re: [PATCH] lib-imap: imap-bodystructure: add test with empty header field

2020-03-03 Thread Simon Ser


On Tuesday, March 3, 2020 9:00 PM, Timo Sirainen  wrote:

> On 3. Mar 2020, at 20.38, Simon Ser cont...@emersion.fr wrote:
>
> > This causes the body structure to be incorrect. The RFC says it's fine o
> > have empty header field values.
>
> The problem isn't empty header field. It's that the mail is missing 
> Mime-Version header. If that doesn't exist, then the Content-* headers can be 
> ignored. But because there are so many broken mails, Dovecot also allows it 
> to be missing as long as there is Content-Type header. Your test mail has 
> neither of these headers. It's arguable that Dovecot should parse Content-* 
> headers regardless of other headers, but I don't think the current code is 
> violating any RFCs.

Oh, sorry, I thought this caused by the empty header field.

The e-mail found in the wild doesn't have Mime-Version, so it would
probably be a good idea not to ignore Content-Transfer-Encoding indeed.


Re: [PATCH] lib-imap: imap-bodystructure: add test with empty header field

2020-03-03 Thread Timo Sirainen
On 3. Mar 2020, at 20.38, Simon Ser  wrote:
> 
> This causes the body structure to be incorrect. The RFC says it's fine o
> have empty header field values.

The problem isn't empty header field. It's that the mail is missing 
Mime-Version header. If that doesn't exist, then the Content-* headers can be 
ignored. But because there are so many broken mails, Dovecot also allows it to 
be missing as long as there is Content-Type header. Your test mail has neither 
of these headers. It's arguable that Dovecot should parse Content-* headers 
regardless of other headers, but I don't think the current code is violating 
any RFCs.



Re: [PATCH] lib-imap: imap-bodystructure: add test with empty header field

2020-03-03 Thread Aki Tuomi
Hi!

Thanks for the patch, we'll look into it.

Aki

> On 03/03/2020 20:38 Simon Ser  wrote:
> 
>  
> This causes the body structure to be incorrect. The RFC says it's fine o
> have empty header field values.
> ---
> 
> This just adds a failing test, inspired from an e-mail spotted in the
> wild. Ideas welcome to fix it.
> 
>  src/lib-imap/test-imap-bodystructure.c | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/lib-imap/test-imap-bodystructure.c 
> b/src/lib-imap/test-imap-bodystructure.c
> index 6f456a44530b..b8f215d689c4 100644
> --- a/src/lib-imap/test-imap-bodystructure.c
> +++ b/src/lib-imap/test-imap-bodystructure.c
> @@ -41,6 +41,19 @@ struct parse_test parse_tests[] = {
>   "\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL 
> \"8bit\" 8 2 NIL NIL NIL NIL",
>   .body =
>   "\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL 
> \"8bit\" 8 2"
> + },{
> + .message =
> + "From: u...@domain.org\n"
> + "Date: Sat, 24 Mar 2017 23:00:00 +0200\n"
> + "X-Spam-Level:\n"
> + "Content-Transfer-Encoding: quoted-printable\n"
> + "\n"
> + "body\n"
> + "\n",
> + .bodystructure =
> + "\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL 
> \"quoted-printable\" 8 2 NIL NIL NIL NIL",
> + .body =
> + "\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL 
> \"quoted-printable\" 8 2"
>   },{
>   .message =
>   "From: u...@domain.org\n"
> --
> 2.25.1


[PATCH] lib-imap: imap-bodystructure: add test with empty header field

2020-03-03 Thread Simon Ser
This causes the body structure to be incorrect. The RFC says it's fine o
have empty header field values.
---

This just adds a failing test, inspired from an e-mail spotted in the
wild. Ideas welcome to fix it.

 src/lib-imap/test-imap-bodystructure.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/lib-imap/test-imap-bodystructure.c 
b/src/lib-imap/test-imap-bodystructure.c
index 6f456a44530b..b8f215d689c4 100644
--- a/src/lib-imap/test-imap-bodystructure.c
+++ b/src/lib-imap/test-imap-bodystructure.c
@@ -41,6 +41,19 @@ struct parse_test parse_tests[] = {
"\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL 
\"8bit\" 8 2 NIL NIL NIL NIL",
.body =
"\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL 
\"8bit\" 8 2"
+   },{
+   .message =
+   "From: u...@domain.org\n"
+   "Date: Sat, 24 Mar 2017 23:00:00 +0200\n"
+   "X-Spam-Level:\n"
+   "Content-Transfer-Encoding: quoted-printable\n"
+   "\n"
+   "body\n"
+   "\n",
+   .bodystructure =
+   "\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL 
\"quoted-printable\" 8 2 NIL NIL NIL NIL",
+   .body =
+   "\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL 
\"quoted-printable\" 8 2"
},{
.message =
"From: u...@domain.org\n"
--
2.25.1




Dovecot autoexpunge

2020-03-03 Thread Philip Colmer
Following a previous suggestion I'd received to turn on autoexpunge
(https://dovecot.org/pipermail/dovecot/2020-February/118281.html), I'm
now trying to confirm whether or not it is doing what I expect it to
do.

I've set the expiration to be 12 weeks (as shown below in the config)
but a lot of the mailboxes have email in them that is much older.

Reading 
http://dovecot.2317879.n4.nabble.com/Dovecot-2-2-20-autoexpunge-td54644.html,
I've tried using "doveadm search -u user mailbox INBOX savedbefore 2w"
to see if it finds any email that is older than 2 weeks (just as a
test) and it doesn't.

If I change "savedbefore" to be "sentbefore" then it works.

If "autoexpunge" is dependent on "savedbefore" working then what do I
need to do to fix this?

Thanks.

Regards

Philip

Below is the output of doveconf -n:

# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.21 (92477967)
# OS: Linux 4.15.0-1041-aws x86_64 Ubuntu 18.04.3 LTS
auth_username_format = %Ln
auth_verbose = yes
disable_plaintext_auth = no
listen = 127.0.0.1
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_privileged_group = mail
mailbox_list_index = yes
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox INBOX {
autoexpunge = 12 weeks
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
driver = pam
}
protocols = " imap lmtp"
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
ssl = no
ssl_cert =