mailbox-list.c revision c78e7a94528078728cc639b26a1c83e11b4d7e1b
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen/* Copyright (c) 2006-2008 Dovecot authors, see the included COPYING file */
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen/* 20 * (200+1) < 4096 which is the standard PATH_MAX. Having these settings
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen prevents malicious user from creating eg. "a/a/a/.../a" mailbox name and
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen then start renaming them to larger names from end to beginning, which
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen eventually would start causing the failures when trying to use too
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen long mailbox names. */
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen/* Message to show to users when critical error occurs */
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen "Internal error occurred. Refer to server log for more information."
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen#define CRITICAL_MSG_STAMP CRITICAL_MSG " [%Y-%m-%d %H:%M:%S]"
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstruct mailbox_list_module_register mailbox_list_module_register = { 0 };
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenvoid (*hook_mailbox_list_created)(struct mailbox_list *list);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstatic ARRAY_DEFINE(mailbox_list_drivers, const struct mailbox_list *);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstatic bool mailbox_list_driver_find(const char *name, unsigned int *idx_r)
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen unsigned int i, count;
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen drivers = array_get(&mailbox_list_drivers, &count);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen for (i = 0; i < count; i++) {
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen if (strcasecmp(drivers[i]->name, name) == 0) {
*idx_r = i;
return TRUE;
return FALSE;
unsigned int idx;
unsigned int idx;
const char **error_r)
unsigned int idx;
driver);
const char **error_r)
tmp++;
value++;
struct mail_namespace *
const char *path;
path);
const char *pattern)
const char *name)
const char *name)
return pattern;
const char *name,
struct mailbox_list_iterate_context *
struct mailbox_list_iterate_context *
const char *const *patterns,
const struct mailbox_info *
const char *name)
const char *name)
if (created) {
if (create_flags != 0)
if (p == NULL)
const char *name)
T_BEGIN {
} T_END;
return TRUE;
levels++;
level_len = 0;
level_len++;
return TRUE;
return TRUE;
return FALSE;
#ifdef HAVE_DIRENT_D_TYPE
switch (d->d_type) {
case DT_UNKNOWN:
case DT_REG:
case DT_DIR:
case DT_LNK:
return type;
const char *error_string;
return FALSE;
return TRUE;