[PATCH?] recursive RENAME not working for long UIDs

Marc Brockschmidt marc+cyrus at marcbrockschmidt.de
Fri Feb 13 10:32:48 EST 2009


Heya,

It seems that in a setup with long UIDs, the recursive rename of folders
doesn't work (cf https://bugzilla.andrew.cmu.edu/show_bug.cgi?id=3120).

I prepared a patch that seems to fix the issue, but did so by removing a
bit of code I didn't really understand. We now would like to use this
(or some other fix), but I would love to hear from someone with more
clue about the code if this could be a problem. For reference, here's
the problematic bit of code:

    /* Find fixed-string pattern prefix */
    for (p = pat; *p; p++) {
        if (*p == '*' || *p == '%' || *p == '?' || *p == '@') break;
    }
    prefixlen = p - pattern;
    *p = '\0';

    /*
     * If user.X.* or INBOX.* can match pattern,
     * search for those mailboxes next
     */
    if (userid &&
        (!strncmp(usermboxname+domainlen, pattern, usermboxnamelen-domainlen-1) ||
        !strncasecmp("inbox.", pattern, prefixlen < 6 ? prefixlen : 6))) {
[imap/mboxlist.c]

The prefix-finding cuts off long UIDs in the middle, thus letting the
usermboxname comparision eval to false. Limiting the condition in the
fixed prefix search to actually only matching on globs fixes the problem
for us. Here's the proposed patch:

--- imap/mboxlist.c     2009-01-21 22:33:18.000000000 +0100
+++ imap/mboxlist.c.new 2009-01-21 22:36:29.000000000 +0100
@@ -1996,7 +1996,7 @@

     /* Find fixed-string pattern prefix */
     for (p = pat; *p; p++) {
-       if (*p == '*' || *p == '%' || *p == '?' || *p == '@') break;
+       if (*p == '*' || *p == '%') break;
     }
     prefixlen = p - pattern;
     *p = '\0';

So, was this a correct solution or am I missing some bit of the big
picture here?

Marc
-- 
Fachbegriffe der Informatik - Einfach erklärt
163: SMD
       Schwer Montierbare Dinger (Holger Köpke)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20090213/5d2f5bc0/attachment.bin 


More information about the Cyrus-devel mailing list