mailbox-list-maildir.c revision bbd0a870f8639767e4e4011d2aedadac08d5c66f
/* Copyright (c) 2006-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "hostpid.h"
#include "subscription-file.h"
#include "mailbox-list-maildir.h"
#include <stdio.h>
#define MAILDIR_GLOBAL_TEMP_PREFIX "temp."
#define IMAPDIR_GLOBAL_TEMP_PREFIX ".temp."
extern struct mailbox_list maildir_mailbox_list;
extern struct mailbox_list imapdir_mailbox_list;
static struct mailbox_list *maildir_list_alloc(void)
{
struct maildir_mailbox_list *list;
}
static struct mailbox_list *imapdir_list_alloc(void)
{
struct maildir_mailbox_list *list;
}
{
struct maildir_mailbox_list *list =
(struct maildir_mailbox_list *)_list;
}
static const char *
const char *name)
{
}
static const char *
{
const char *p;
/* fallback to using as ~name */
return name;
}
if (p == NULL)
return name;
p+1);
}
static bool
{
/* check that there are no adjacent hierarchy separators */
return FALSE;
}
return FALSE;
return FALSE;
return TRUE;
}
static bool maildir_list_is_valid_common_nonfs(const char *name)
{
return FALSE;
/* "." and ".." aren't allowed. */
return FALSE;
}
return TRUE;
}
static bool ATTR_NORETURN
const char *pattern ATTR_UNUSED)
{
i_unreached();
#ifndef ATTRS_DEFINED
return FALSE;
#endif
}
static bool
{
return FALSE;
return TRUE;
return maildir_list_is_valid_common_nonfs(name);
}
static bool
{
return FALSE;
return FALSE;
return TRUE;
return FALSE;
return FALSE;
return TRUE;
}
static const char *
enum mailbox_list_path_type type)
{
struct maildir_mailbox_list *list =
(struct maildir_mailbox_list *)_list;
/* return root directories */
switch (type) {
}
i_unreached();
}
switch (type) {
break;
return maildir_list_get_dirname_path(_list,
}
break;
return "";
return maildir_list_get_dirname_path(_list,
}
break;
}
}
static int
const char *name,
enum mailbox_name_status *status)
{
const char *path;
return 0;
}
return 0;
}
return 0;
} else {
return -1;
}
}
static const char *
{
struct maildir_mailbox_list *list =
(struct maildir_mailbox_list *)_list;
}
{
struct maildir_mailbox_list *list =
(struct maildir_mailbox_list *)_list;
const char *path;
}
enum mailbox_list_path_type type,
{
return 0;
return -1;
}
return 0;
}
{
struct mailbox_list_iterate_context *iter;
const struct mailbox_info *info;
ARRAY_DEFINE(names_arr, const char *);
const char *const *names;
unsigned int i, count;
int ret;
ret = 0;
/* first get the list of the children and save them to memory, because
we can't rely on readdir() not skipping files while the directory
is being modified. this doesn't protect against modifications by
other processes though. */
const char *name;
/* verify that the prefix matches, otherwise we could have
problems with mailbox names containing '%' and '*' chars */
}
}
if (mailbox_list_iter_deinit(&iter) < 0) {
ret = -1;
} else {
}
for (i = 0; i < count; i++) {
/* When doing RENAME "a" "a.b" we see "a.b" here.
We don't want to rename it anymore to "a.b.b". */
continue;
}
/* FIXME: it's possible to merge two mailboxes if either one of
them doesn't have existing root mailbox. We could check this
but I'm not sure if it's worth it. It could be even
considered as a feature.
Anyway, the bug with merging is that if both mailboxes have
identically named child mailbox they conflict. Just ignore
those and leave them under the old mailbox. */
ret = 1;
else {
ret = -1;
break;
}
}
pool_unref(&pool);
return ret;
}
static int
{
/* let the backend handle the rest */
}
{
int ret;
bool found;
/* NOTE: it's possible to rename a nonexisting mailbox which has
children. In that case we should ignore the rename() error. */
T_BEGIN {
} T_END;
if (ret < 0)
return -1;
return -1;
}
return 0;
}
if (EDESTDIREXISTS(errno)) {
"Target mailbox already exists");
} else {
}
return -1;
}
struct mailbox_list maildir_mailbox_list = {
{
NULL,
NULL,
}
};
struct mailbox_list imapdir_mailbox_list = {
{
NULL,
NULL,
}
};