[dovecot-cvs]
dovecot/src/lib-storage/index/dbox dbox-format.h, 1.1,
1.2 dbox-list.c, 1.6, 1.7 dbox-storage.c, 1.15, 1.16
cras at dovecot.org
cras at dovecot.org
Tue May 30 11:24:48 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv16361
Modified Files:
dbox-format.h dbox-list.c dbox-storage.c
Log Message:
Renamed Mails -> dbox-Mails to make it less likely to conflict with
user-created mailbox.
Index: dbox-format.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-format.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dbox-format.h 12 Apr 2006 16:52:02 -0000 1.1
+++ dbox-format.h 30 May 2006 08:24:44 -0000 1.2
@@ -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"
Index: dbox-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-list.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- dbox-list.c 12 Apr 2006 16:52:02 -0000 1.6
+++ dbox-list.c 30 May 2006 08:24:44 -0000 1.7
@@ -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);
Index: dbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- dbox-storage.c 20 Apr 2006 14:08:28 -0000 1.15
+++ dbox-storage.c 30 May 2006 08:24:44 -0000 1.16
@@ -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 = {
More information about the dovecot-cvs
mailing list