[dovecot-cvs] dovecot/src/imap commands-util.c,1.9,1.10

cras at procontrol.fi cras at procontrol.fi
Thu Dec 19 03:53:21 EET 2002


Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv17272/imap

Modified Files:
	commands-util.c 
Log Message:
Limit the mailbox path. A few cleanups.



Index: commands-util.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/commands-util.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- commands-util.c	28 Oct 2002 09:46:02 -0000	1.9
+++ commands-util.c	19 Dec 2002 01:53:19 -0000	1.10
@@ -5,6 +5,12 @@
 #include "commands-util.h"
 #include "imap-util.h"
 
+/* Maximum length for mailbox name, including it's path. This isn't fully
+   exact since the user can create folder hierarchy with small names, then
+   rename them to larger names. Mail storages should set more strict limits
+   to them, mbox/maildir currently allow paths only up to PATH_MAX. */
+#define MAILBOX_MAX_NAME_LEN 512
+
 int client_verify_mailbox_name(Client *client, const char *mailbox,
 			       int should_exist, int should_not_exist)
 {
@@ -26,6 +32,11 @@
 			client_send_tagline(client, "NO Invalid mailbox name.");
 			return FALSE;
 		}
+	}
+
+	if (strlen(mailbox) > MAILBOX_MAX_NAME_LEN) {
+		client_send_tagline(client, "NO Mailbox name too long.");
+		return FALSE;
 	}
 
 	/* check what our storage thinks of it */




More information about the dovecot-cvs mailing list