Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipurge events #2848

Closed
giena opened this issue Aug 13, 2019 · 8 comments
Closed

ipurge events #2848

giena opened this issue Aug 13, 2019 · 8 comments
Labels
3.0 affects 3.0 3.1 affects 3.1 dev releases

Comments

@giena
Copy link

giena commented Aug 13, 2019

On ipurge execution, there's MessageExpunge event.
The events that we get from ipurge are like this:
{"event":"MessageExpunge","timestamp":"2019-08-12T11:44:40.754+02:00","service":"ipurge","mailboxID":"xxxxxxxxxxxx","uri":"imap://host/user;UIDVALIDITY=1508183802","uidset":"550:554","pid":103826,"user":"","vnd.cmu.mbtype":"","serverFQDN":"msfrb1406","vnd.cmu.mailboxACL":"xxxxxxxxxxx\tlrswipkxtecda\tadmcyr\tlrwipkxtecda\t"}

The uri syntax is not complete, so we are unable to parse it. The folder is missing.

@giena
Copy link
Author

giena commented Aug 13, 2019

version 3.0.8

@elliefm
Copy link
Contributor

elliefm commented Aug 16, 2019

To clarify, is this only affecting MessageExpunge events that are generated by ipurge? Or is it affecting all MessageExpunge events?

@elliefm
Copy link
Contributor

elliefm commented Aug 16, 2019

ipurge.c never calls mboxevent_setnamespace(), so I think mboxevent_extract_mailbox() is unable to derive an extname, leaves the mailbox field blank in the struct imapurl, and so imapurl_toURL() generates a url without a mailbox in it

@elliefm
Copy link
Contributor

elliefm commented Aug 16, 2019

This patch seems to fix it for me. I'm not sure if it's exactly correct, but it's enough for the mailbox to be included in the URI:

diff --git a/imap/ipurge.c b/imap/ipurge.c
index 80c51716b..e58f7436e 100644
--- a/imap/ipurge.c
+++ b/imap/ipurge.c
@@ -178,6 +178,7 @@ int main (int argc, char *argv[]) {
 
   /* setup for mailbox event notifications */
   mboxevent_init();
+  mboxevent_setnamespace(mboxname_get_adminnamespace());
 
   mboxlist_init(0);
   mboxlist_open(NULL);

@elliefm
Copy link
Contributor

elliefm commented Aug 16, 2019

Ahh, I see what happened: it wasn't so much that the URI didn't include the mailbox, but rather, the mailbox it included was truncated at the first hierarchy separator, because the uninitialised namespace meant the hierarchy separator used was '\0'! Thus, "imap://host/user" instead of "imap://host/user.foo.somemailbox"

@elliefm elliefm added 3.0 affects 3.0 3.1 affects 3.1 dev releases labels Aug 16, 2019
@elliefm
Copy link
Contributor

elliefm commented Aug 16, 2019

This was broken on master too, though the fix was a little different. master is fixed by 7bdaf7c, 3.0 by efa4ca5

@elliefm
Copy link
Contributor

elliefm commented Aug 16, 2019

And a cassandane test: cyrusimap/cassandane@d54d817

@giena
Copy link
Author

giena commented Aug 17, 2019

Sorry for the late reply but yes it was only for ipurge binary. And thank you for the correction.

@elliefm elliefm closed this as completed Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0 affects 3.0 3.1 affects 3.1 dev releases
Projects
None yet
Development

No branches or pull requests

2 participants