Hi there,
Current Kolab packages ship a patch to allow more character names in IMAP
mailbox/folder names then is currently permitted with the characters listed in
imap/mboxname.c:724 GOODCHARS definition. Bug #2633[1] also concerns this
topic.
In an attempt to do a little research on the set of characters allowed in a
mailbox, I stumbled upon section 5.1 in RFC 3501[2]. Sub-section 5.1.3
confuses me a little, so I hope some of you can shed some light on that if
necessary.
It seems that mailbox/folder names may contain any of the characters in 7-bit
ASCII, but GOODCHARS does not have all of those characters listed. Attached is
a patch that shows how I would like this a configurable setting. Unless I'm
mistaken, this should preserve the behavior presented today, but allows a
'goodchars' setting to be supplied in imapd.conf.
Please let me know what you think.
[1] https://bugzilla.andrew.cmu.edu/show_bug.cgi?id=2633
[2] http://www.faqs.org/rfcs/rfc3501.html
Kind regards,
--
Jeroen van Meeuwen
Senior Engineer, Kolab Systems AG
e: [email protected]
t: +316 42 801 403
w: http://www.kolabsys.com
pgp: 9342 BF08
diff --git a/imap/mboxname.c b/imap/mboxname.c
index 1e0a5e2..a0ec2c7 100644
--- a/imap/mboxname.c
+++ b/imap/mboxname.c
@@ -730,8 +730,11 @@ int mboxname_policycheck(char *name)
unsigned c1, c2, c3, c4, c5, c6, c7, c8;
int ucs4;
int unixsep;
+ const char *goodchars;
unixsep = config_getswitch(IMAPOPT_UNIXHIERARCHYSEP);
+ goodchars = config_getstring(IMAPOPT_GOODCHARS);
+ if (!goodchars) goodchars = GOODCHARS;
if (strlen(name) > MAX_MAILBOX_NAME) return IMAP_MAILBOX_BADNAME;
for (i = 0; i < NUM_BADMBOXPATTERNS; i++) {
@@ -810,7 +813,7 @@ int mboxname_policycheck(char *name)
name++; /* Skip over terminating '-' */
}
else {
- if (!strchr(GOODCHARS, *name) &&
+ if (!strchr(goodchars, *name) &&
/* If we're using unixhierarchysep, DOTCHAR is allowed */
!(unixsep && *name == DOTCHAR))
return IMAP_MAILBOX_BADNAME;
diff --git a/lib/imapoptions b/lib/imapoptions
index 421b0dd..88715d5 100644
--- a/lib/imapoptions
+++ b/lib/imapoptions
@@ -1270,6 +1270,10 @@ product version in the capabilities */
mailbox hierarchy. The default is to use the netnews separator
character '.'. */
+{ "goodchars", NULL, STRING }
+/* Characters to allow in mailbox names. If not configured a default
+ from imap/mboxname.c is being used */
+
{ "virtdomains", "off", ENUM("off", "userid", "on") }
/* Enable virtual domain support. If enabled, the user's domain will
be determined by splitting a fully qualified userid at the last '@'