Hello, here's a small fix for _ic_rename(). The check that a folder is not renamed so that it becomes a sub-folder of its own (e.g. renaming "A" to "A/B") is too restrictive: It verifies that the old name is not a prefix of the new name, but this also prohibits to rename "A" to "AB". The renaming is only illegal, if the old name is a prefix of the new name _and_ a hierarchy separator "/" immediately follows in the new name (otherwise the new name is not a sub-folder of the old).
Regards, Armin
Index: imapcommands.c =================================================================== RCS file: /cvsroot-dbmail/dbmail/imapcommands.c,v retrieving revision 1.109 diff -u -r1.109 imapcommands.c --- imapcommands.c 2003/05/13 15:34:39 1.109 +++ imapcommands.c 2003/06/10 15:31:05 @@ -864,12 +864,16 @@ return 1; } + oldnamelen = strlen(args[0]); + /* check if new name would invade structure as in * test (exists) * rename test test/testing * would create test/testing but delete test */ - if (strncasecmp(args[0], args[1], strlen(args[0])) == 0) + + if (strncasecmp(args[0], args[1], oldnamelen) == 0 && + strlen(args[1]) > oldnamelen && args[1][oldnamelen] == '/') { fprintf(ci->tx,"%s NO new mailbox would invade mailbox structure\r\n",tag); return 1; @@ -943,7 +947,6 @@ } /* replace name for each child */ - oldnamelen = strlen(args[0]); for (i=0; i<nchildren; i++) { result = db_getmailboxname(children[i], name);