Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4276:7e8bd7301461 HEAD
Renamed Mails -> dbox-Mails to make it less likely to conflict with
user-created mailbox.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 30 May 2006 11:24:44 +0300 |
parents | 6fd56bf3f3be |
children | c8af5a2492c5 |
files | src/lib-storage/index/dbox/dbox-format.h src/lib-storage/index/dbox/dbox-list.c src/lib-storage/index/dbox/dbox-storage.c |
diffstat | 3 files changed, 20 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox/dbox-format.h Tue May 30 11:22:29 2006 +0300 +++ b/src/lib-storage/index/dbox/dbox-format.h Tue May 30 11:24:44 2006 +0300 @@ -3,7 +3,7 @@ #define DBOX_SUBSCRIPTION_FILE_NAME "dovecot.subscriptions" #define DBOX_INDEX_PREFIX "dovecot.index" -#define DBOX_MAILDIR_NAME "Mails" +#define DBOX_MAILDIR_NAME "dbox-Mails" #define DBOX_MAIL_FILE_PREFIX "msg." #define DBOX_MAIL_FILE_FORMAT DBOX_MAIL_FILE_PREFIX"%u"
--- a/src/lib-storage/index/dbox/dbox-list.c Tue May 30 11:22:29 2006 +0300 +++ b/src/lib-storage/index/dbox/dbox-list.c Tue May 30 11:24:44 2006 +0300 @@ -226,7 +226,7 @@ if (len > 5 && strcmp(fname+len-5, ".lock") == 0) return 0; - /* skip Mails/ dir */ + /* skip dbox-Mails/ dir */ if (strcmp(fname, DBOX_MAILDIR_NAME) == 0) return 0; @@ -241,7 +241,7 @@ if ((match = imap_match(ctx->glob, list_path)) < 0) return 0; - /* first as an optimization check if it contains Mails/ directory. + /* first as an optimization check if it contains dbox-Mails/ directory. that means it's a directory and it contains mails. */ real_path = t_strconcat(ctx->dir->real_path, "/", fname, NULL); mail_path = t_strconcat(real_path, "/"DBOX_MAILDIR_NAME, NULL);
--- a/src/lib-storage/index/dbox/dbox-storage.c Tue May 30 11:22:29 2006 +0300 +++ b/src/lib-storage/index/dbox/dbox-storage.c Tue May 30 11:24:44 2006 +0300 @@ -132,7 +132,7 @@ data = t_strcut(data, ':'); - path = t_strconcat(data, "/inbox/Mails", NULL); + path = t_strconcat(data, "/inbox/"DBOX_MAILDIR_NAME, NULL); if (stat(path, &st) < 0) { if (debug) i_info("dbox autodetect: stat(%s) failed: %m", path); @@ -173,10 +173,24 @@ if (p[1] == '.' && p[2] == '/') return FALSE; /* ../ */ } - } + if (strncmp(p, DBOX_MAILDIR_NAME, + sizeof(DBOX_MAILDIR_NAME)-1) == 0 && + (p[sizeof(DBOX_MAILDIR_NAME)-1] == '\0' || + p[sizeof(DBOX_MAILDIR_NAME)-1] == '/')) { + /* don't allow the dbox-Mails directory to be + used as part of the mask */ + return FALSE; + } + } newdir = p[0] == '/'; } + if (mask[0] == '.' && (mask[1] == '\0' || + (mask[1] == '.' && mask[2] == '\0'))) { + /* "." and ".." aren't allowed. */ + return FALSE; + } + return TRUE; } @@ -641,7 +655,7 @@ } index_mailbox_check_add(&mbox->ibox, - t_strconcat(mbox->path, "/Mails", NULL)); + t_strconcat(mbox->path, "/"DBOX_MAILDIR_NAME, NULL)); } struct mail_storage dbox_storage = {