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