[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-storage.c, 1.136, 1.137

cras at dovecot.org cras at dovecot.org
Sun Feb 5 15:03:44 EET 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv30709/lib-storage/index/mbox

Modified Files:
	mbox-storage.c 
Log Message:
Limit maximum mailbox name length while creating them.



Index: mbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- mbox-storage.c	18 Jan 2006 23:14:45 -0000	1.136
+++ mbox-storage.c	5 Feb 2006 13:03:42 -0000	1.137
@@ -22,6 +22,10 @@
 
 #define CREATE_MODE 0770 /* umask() should limit it more */
 
+/* Don't allow creating too long mailbox names. They could start causing
+   problems when they reach the limit. */
+#define MBOX_MAX_MAILBOX_NAME_LENGTH (PATH_MAX/2)
+
 /* NOTE: must be sorted for istream-header-filter. Note that it's not such
    a good idea to change this list, as the messages will then change from
    client's point of view. So if you do it, change all mailboxes' UIDVALIDITY
@@ -384,7 +388,8 @@
 
 	len = strlen(name);
 	if (name[0] == '\0' || name[len-1] == '/' ||
-	    strchr(name, '*') != NULL || strchr(name, '%') != NULL)
+	    strchr(name, '*') != NULL || strchr(name, '%') != NULL ||
+	    len > MBOX_MAX_MAILBOX_NAME_LENGTH)
 		return FALSE;
 
 	return mbox_is_valid_mask(storage, name);



More information about the dovecot-cvs mailing list