[dovecot-cvs] dovecot/src/imap cmd-subscribe.c,1.12,1.13

cras at dovecot.org cras at dovecot.org
Fri Jul 22 20:50:17 EEST 2005


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv14664/src/imap

Modified Files:
	cmd-subscribe.c 
Log Message:
Updated behavior of tb-extra-mailbox-sep



Index: cmd-subscribe.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-subscribe.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmd-subscribe.c	22 Jul 2005 14:20:44 -0000	1.12
+++ cmd-subscribe.c	22 Jul 2005 17:50:15 -0000	1.13
@@ -6,25 +6,26 @@
 int _cmd_subscribe_full(struct client_command_context *cmd, int subscribe)
 {
         struct mail_storage *storage;
-	const char *mailbox;
+	const char *mailbox, *verify_name;
 
 	/* <mailbox> */
 	if (!client_read_string_args(cmd, 1, &mailbox))
 		return FALSE;
 
-	if ((client_workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0) {
+	verify_name = mailbox;
+	if ((client_workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 &&
+	    *mailbox != '\0') {
+		/* verify the validity without the trailing '/' */
 		storage = client_find_storage(cmd, &mailbox);
 		if (storage == NULL)
 			return TRUE;
 
-		if (*mailbox != '\0' && mailbox[strlen(mailbox)-1] ==
-		    mail_storage_get_hierarchy_sep(storage)) {
-			/* drop the extra trailing hierarchy separator */
-			mailbox = t_strndup(mailbox, strlen(mailbox)-1);
-		}
+		if (mailbox[strlen(mailbox)-1] ==
+		    mail_storage_get_hierarchy_sep(storage))
+			verify_name = t_strndup(mailbox, strlen(mailbox)-1);
 	}
 
-	if (!client_verify_mailbox_name(cmd, mailbox, subscribe, FALSE))
+	if (!client_verify_mailbox_name(cmd, verify_name, subscribe, FALSE))
 		return TRUE;
 
 	storage = client_find_storage(cmd, &mailbox);



More information about the dovecot-cvs mailing list