[dovecot-cvs]
dovecot/src/lib-storage/index/maildir maildir-list.c,1.21,1.22
maildir-storage.c,1.41,1.42
cras at procontrol.fi
cras at procontrol.fi
Tue Jul 1 22:14:21 EEST 2003
Update of /home/cvs/dovecot/src/lib-storage/index/maildir
In directory danu:/tmp/cvs-serv31757/lib-storage/index/maildir
Modified Files:
maildir-list.c maildir-storage.c
Log Message:
mail_full_filesystem_access = yes fixes
Index: maildir-list.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-list.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- maildir-list.c 20 Mar 2003 17:38:39 -0000 1.21
+++ maildir-list.c 1 Jul 2003 18:14:18 -0000 1.22
@@ -80,14 +80,6 @@
ctx->dir = storage->dir;
ctx->prefix = "";
} else {
- p = strchr(p, storage->hierarchy_sep);
- if (p == NULL) {
- /* this isn't going to work */
- mail_storage_set_error(storage, "Invalid list mask");
- pool_unref(pool);
- return FALSE;
- }
-
dir = t_strdup_until(mask, p);
ctx->prefix = t_strdup_until(mask, p+1);
@@ -97,7 +89,7 @@
}
ctx->dirp = opendir(ctx->dir);
- if (ctx->dirp == NULL) {
+ if (ctx->dirp == NULL && errno != ENOENT) {
mail_storage_set_critical(storage, "opendir(%s) failed: %m",
ctx->dir);
pool_unref(pool);
@@ -246,8 +238,9 @@
MAILBOX_PLACEHOLDER | MAILBOX_CHILDREN;
while ((p = strrchr(fname, '.')) != NULL) {
fname = t_strdup_until(fname, p);
- if (imap_match(ctx->glob, fname) > 0) {
- ctx->list.name = fname;
+ p = t_strconcat(ctx->prefix, fname, NULL);
+ if (imap_match(ctx->glob, p) > 0) {
+ ctx->list.name = p;
return &ctx->list;
}
}
Index: maildir-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- maildir-storage.c 15 Jun 2003 02:20:52 -0000 1.41
+++ maildir-storage.c 1 Jul 2003 18:14:18 -0000 1.42
@@ -132,23 +132,23 @@
strchr(name, '/') == NULL && strchr(name, '\\') == NULL;
}
-static const char *maildir_get_absolute_path(const char *name)
+static const char *maildir_get_absolute_path(const char *name, int unlink)
{
const char *p;
name = home_expand(name);
- /* insert "/" if it's missing */
- p = strchr(name, '.');
- if (p == NULL || p[-1] == '/')
+ p = strrchr(name, '/');
+ if (p == NULL)
return name;
- return t_strconcat(t_strdup_until(name, p), "/", p, NULL);
+ return t_strconcat(t_strdup_until(name, p+1),
+ unlink ? ".." : ".", p+1, NULL);
}
const char *maildir_get_path(struct mail_storage *storage, const char *name)
{
if (full_filesystem_access && (*name == '/' || *name == '~'))
- return maildir_get_absolute_path(name);
+ return maildir_get_absolute_path(name, FALSE);
if (strcasecmp(name, "INBOX") == 0)
return storage->dir;
@@ -156,6 +156,15 @@
return t_strconcat(storage->dir, "/.", name, NULL);
}
+static const char *
+maildir_get_unlink_path(struct mail_storage *storage, const char *name)
+{
+ if (full_filesystem_access && (*name == '/' || *name == '~'))
+ return maildir_get_absolute_path(name, TRUE);
+
+ return maildir_get_path(storage, t_strconcat(".", name, NULL));
+}
+
static const char *maildir_get_index_path(struct mail_storage *storage,
const char *name)
{
@@ -163,7 +172,7 @@
return NULL;
if (full_filesystem_access && (*name == '/' || *name == '~'))
- return maildir_get_absolute_path(name);
+ return maildir_get_absolute_path(name, FALSE);
return t_strconcat(storage->index_dir, "/.", name, NULL);
}
@@ -175,7 +184,7 @@
return maildir_get_path(storage, name);
if (full_filesystem_access && (*name == '/' || *name == '~'))
- return maildir_get_absolute_path(name);
+ return maildir_get_absolute_path(name, FALSE);
return t_strconcat(storage->control_dir, "/.", name, NULL);
}
@@ -421,7 +430,7 @@
deleted. delete indexes before the actual maildir. this way we
never see partially deleted mailboxes. */
src = maildir_get_path(storage, name);
- dest = maildir_get_path(storage, t_strconcat(".", name, NULL));
+ dest = maildir_get_unlink_path(storage, name);
if (stat(src, &st) != 0 && errno == ENOENT) {
mail_storage_set_error(storage, "Mailbox doesn't exist: %s",
name);
More information about the dovecot-cvs
mailing list