[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-storage.c,1.36,1.37
cras at procontrol.fi
cras at procontrol.fi
Wed Feb 12 20:17:00 EET 2003
Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory danu:/tmp/cvs-serv30608/lib-storage/index/mbox
Modified Files:
mbox-storage.c
Log Message:
Several fixes to mail_full_filesystem_access = yes handling
Index: mbox-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- mbox-storage.c 11 Feb 2003 19:37:16 -0000 1.36
+++ mbox-storage.c 12 Feb 2003 18:16:58 -0000 1.37
@@ -1,6 +1,7 @@
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
+#include "home-expand.h"
#include "unlink-directory.h"
#include "subscription-file/subscription-file.h"
#include "mail-custom-flags.h"
@@ -241,10 +242,11 @@
static int mbox_is_valid_name(struct mail_storage *storage, const char *name)
{
- return name[0] != '\0' && name[0] != storage->hierarchy_sep &&
- name[strlen(name)-1] != storage->hierarchy_sep &&
- strchr(name, '*') == NULL && strchr(name, '%') == NULL &&
- mbox_is_valid_mask(name);
+ if (name[0] == '\0' || name[strlen(name)-1] == storage->hierarchy_syp ||
+ strchr(name, '*') != NULL || strchr(name, '%') != NULL)
+ return FALSE;
+
+ return full_filesystem_access || mbox_is_valid_mask(name);
}
static const char *mbox_get_index_dir(struct mail_storage *storage,
@@ -252,6 +254,13 @@
{
const char *p;
+ if (full_filesystem_access && (*name == '/' || *name == '~')) {
+ name = home_expand(name);
+ p = strrchr(name, '/');
+ return t_strconcat(t_strdup_until(name, p),
+ "/.imap/", p+1, NULL);
+ }
+
p = strrchr(name, '/');
if (p == NULL)
return t_strconcat(storage->index_dir, "/.imap/", name, NULL);
@@ -295,8 +304,9 @@
{
if (strcasecmp(name, "INBOX") == 0)
return storage->inbox_file;
- else
- return t_strconcat(storage->dir, "/", name, NULL);
+ if (full_filesystem_access && (*name == '/' || *name == '~'))
+ return home_expand(name);
+ return t_strconcat(storage->dir, "/", name, NULL);
}
static struct mailbox *mbox_open(struct mail_storage *storage, const char *name,
More information about the dovecot-cvs
mailing list