diff -Naudr dovecot-0.99.14/src/lib-storage/index/maildir/maildir-storage.c dovecot-0.99.14-colons/src/lib-storage/index/maildir/maildir-storage.c --- dovecot-0.99.14/src/lib-storage/index/maildir/maildir-storage.c Thu Jun 17 20:50:09 2004 +++ dovecot-0.99.14-colons/src/lib-storage/index/maildir/maildir-storage.c Thu Sep 15 19:08:26 2005 @@ -32,8 +32,9 @@ { struct mail_storage *storage; const char *home, *path, *root_dir, *index_dir, *control_dir, *p; + const char *q1, *q2; - root_dir = index_dir = control_dir = NULL; + root_dir = index_dir = control_dir = p = NULL; if (data == NULL || *data == '\0') { /* we'll need to figure out the maildir location ourself. @@ -51,10 +52,17 @@ } } else { /* [:INDEX=] [:CONTROL=] */ - p = strchr(data, ':'); - if (p == NULL) + q1 = strchr(data, ':'); + q2 = strchr(data, '='); + if (q1 == NULL || q2 == NULL) root_dir = data; else { + do { + p = q1; + q1 = strchr(p, ':'); + q2 = strchr(p, '='); + } while (q1 && (!q2 || q1 < q2)); + root_dir = t_strdup_until(data, p); do { @@ -106,8 +114,21 @@ static int maildir_autodetect(const char *data) { struct stat st; + const char *p, *q1, *q2; - data = t_strcut(data, ':'); + p = NULL; + + q1 = strchr(data, ':'); + q2 = strchr(data, '='); + if (q1 && q2) { + do { + p = q1; + q1 = strchr(p, ':'); + q2 = strchr(p, '='); + } while (q1 && (!q2 || q1 < q2)); + } + if (p != NULL) + data = t_strdup_until(data, p); return stat(t_strconcat(data, "/cur", NULL), &st) == 0 && S_ISDIR(st.st_mode);