<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div style="font-family:Arial;">I have created <a href="https://github.com/cyrusimap/cyrus-imapd/issues/2191">https://github.com/cyrusimap/cyrus-imapd/issues/2191</a> to track this. Thanks for the patch!<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">Cheers,<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">Bron.<br></div>
<div><br></div>
<div><br></div>
<div>On Fri, 3 Nov 2017, at 00:38, Edda wrote:<br></div>
<blockquote type="cite"><div>Hi,<br></div>
<div><br></div>
<div>that's surprising and the same here.<br></div>
<div><br></div>
<div>I think there is a bug in imap/lmtpengine.c, function process_recipient:<br></div>
<div><br></div>
<div>verify_user returns the correct error code as we can see with LOG_DEBUG<br></div>
<div>"on":<br></div>
<div><br></div>
<div>Nov 2 14:10:50 popc lmtp[2092]: verify_user(<a href="mailto:test@sendmaid.org">test@sendmaid.org</a>) failed:<br></div>
<div>Over quota<br></div>
<div><br></div>
<div>but this return code is not used in process_recipient<br></div>
<div><br></div>
<div>There we have:<br></div>
<div>[...]<br></div>
<div> if (sl) {<br></div>
<div> char *rcpt = xstrndup(addr, sl);<br></div>
<div> mbname = mbname_from_recipient(rcpt, msg->ns);<br></div>
<div> free(rcpt);<br></div>
<div><br></div>
<div> int forcedowncase = config_getswitch(IMAPOPT_LMTP_DOWNCASE_RCPT);<br></div>
<div> if (forcedowncase) mbname_downcaseuser(mbname);<br></div>
<div><br></div>
<div> /* strip username if postuser */<br></div>
<div> if (!strcmpsafe(mbname_localpart(mbname),<br></div>
<div>config_getstring(IMAPOPT_POSTUSER))) {<br></div>
<div> mbname_set_localpart(mbname, NULL);<br></div>
<div> if (!config_virtdomains ||<br></div>
<div>!strcmpsafe(mbname_domain(mbname), config_defdomain))<br></div>
<div> mbname_set_domain(mbname, NULL);<br></div>
<div> }<br></div>
<div><br></div>
<div> if (verify_user(mbname,<br></div>
<div> (quota_t) (ignorequota ? -1 : msg->size),<br></div>
<div> ignorequota ? -1 : 1, msg->authstate)) {<br></div>
<div> mbname_free(&mbname);<br></div>
<div> }<br></div>
<div> }<br></div>
<div><br></div>
<div> if (!mbname) {<br></div>
<div> const char *catchall =<br></div>
<div>config_getstring(IMAPOPT_LMTP_CATCHALL_MAILBOX);<br></div>
<div> if (catchall) {<br></div>
<div> mbname = mbname_from_userid(catchall);<br></div>
<div> if (verify_user(mbname,<br></div>
<div> ignorequota ? -1 : msg->size,<br></div>
<div> ignorequota ? -1 : 1, msg->authstate)) {<br></div>
<div> mbname_free(&mbname);<br></div>
<div> }<br></div>
<div> }<br></div>
<div> }<br></div>
<div><br></div>
<div> if (!mbname) {<br></div>
<div> /* we lost */<br></div>
<div> return IMAP_MAILBOX_NONEXISTENT;<br></div>
<div> }<br></div>
<div>[...]<br></div>
<div><br></div>
<div>means as far as I understand: if verify_user returns its error (for<br></div>
<div>example IMAP_QUOTA_EXCEEDED), mbname is freed and process_recipient<br></div>
<div>always returns IMAP_MAILBOX_NONEXISTENT.<br></div>
<div><br></div>
<div>Below is a patch that works for me. But I don't know if this is a good<br></div>
<div>way to fix it.<br></div>
<div>Hopefully one of the developers helps :)<br></div>
<div><br></div>
<div>Regards, Edda<br></div>
<div><br></div>
<div><br></div>
<div>diff -Naur cyrus-imapd-3.0.4.orig/imap/lmtpengine.c<br></div>
<div>cyrus-imapd-3.0.4/imap/lmtpengine.c<br></div>
<div>--- cyrus-imapd-3.0.4.orig/imap/lmtpengine.c 2017-09-04<br></div>
<div>02:09:46.000000000 +0200<br></div>
<div>+++ cyrus-imapd-3.0.4/imap/lmtpengine.c 2017-11-02 13:59:56.764175245<br></div>
<div>+0100<br></div>
<div>@@ -830,6 +830,7 @@<br></div>
<div> }<br></div>
<div><br></div>
<div> mbname_t *mbname = NULL;<br></div>
<div>+ int r = 0;<br></div>
<div><br></div>
<div> size_t sl = strlen(addr);<br></div>
<div> if (addr[sl-1] == '>') sl--;<br></div>
<div>@@ -849,7 +850,7 @@<br></div>
<div> mbname_set_domain(mbname, NULL);<br></div>
<div> }<br></div>
<div><br></div>
<div>- if (verify_user(mbname,<br></div>
<div>+ if (r = verify_user(mbname,<br></div>
<div> (quota_t) (ignorequota ? -1 : msg->size),<br></div>
<div> ignorequota ? -1 : 1, msg->authstate)) {<br></div>
<div> mbname_free(&mbname);<br></div>
<div>@@ -860,7 +861,7 @@<br></div>
<div> const char *catchall =<br></div>
<div>config_getstring(IMAPOPT_LMTP_CATCHALL_MAILBOX);<br></div>
<div> if (catchall) {<br></div>
<div> mbname = mbname_from_userid(catchall);<br></div>
<div>- if (verify_user(mbname,<br></div>
<div>+ if (r = verify_user(mbname,<br></div>
<div> ignorequota ? -1 : msg->size,<br></div>
<div> ignorequota ? -1 : 1, msg->authstate)) {<br></div>
<div> mbname_free(&mbname);<br></div>
<div>@@ -870,6 +871,9 @@<br></div>
<div><br></div>
<div> if (!mbname) {<br></div>
<div> /* we lost */<br></div>
<div>+ if (r) {<br></div>
<div>+ return r;<br></div>
<div>+ }<br></div>
<div> return IMAP_MAILBOX_NONEXISTENT;<br></div>
<div> }<br></div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>Am 02.11.17 um 09:27 schrieb Maros Vegh:<br></div>
<blockquote><div>Hello,<br></div>
<div><br></div>
<div>i'm using compiled cyrus version 3.0.4 on Debian 9.2.<br></div>
<div><br></div>
<div>When the Postfix server is trying to deliver a message via lmtp to<br></div>
<div>cyrus mailbox which is over quota, it receives the 550-Mailbox unknown<br></div>
<div>return code and not the 452 or 552 Over quota.<br></div>
<div><br></div>
<div>In the previous version 2.5.10 it worked fine with default values in<br></div>
<div>imapd.conf<br></div>
<div><br></div>
<div>Is it a bug or my fault?<br></div>
<div><br></div>
<div>Thanks<br></div>
<div><br></div>
<div>Maros Vegh<br></div>
<div><br></div>
<div><br></div>
</blockquote><div><br></div>
<div>----<br></div>
<div>Cyrus Home Page: <a href="http://www.cyrusimap.org/">http://www.cyrusimap.org/</a><br></div>
<div>List Archives/Info: <a href="http://lists.andrew.cmu.edu/pipermail/info-cyrus/">http://lists.andrew.cmu.edu/pipermail/info-cyrus/</a><br></div>
<div>To Unsubscribe:<br></div>
<div><a href="https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus">https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus</a><br></div>
</blockquote><div style="font-family:Arial;"><br></div>
<div id="sig56629417"><div class="signature">--<br></div>
<div class="signature"> Bron Gondwana, CEO, FastMail Pty Ltd<br></div>
<div class="signature"> brong@fastmailteam.com<br></div>
<div class="signature"><br></div>
</div>
<div style="font-family:Arial;"><br></div>
</body>
</html>