mailbox-list.c revision e4cb3bfcd42f1f2c9e676ece6f7f53803f5c6a16
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen/* Copyright (c) 2006-2012 Dovecot authors, see the included COPYING file */
b42f37ae6f65ed986315b6885568d32115e589b1Timo Sirainen/* 20 * (200+1) < 4096 which is the standard PATH_MAX. Having these settings
b42f37ae6f65ed986315b6885568d32115e589b1Timo Sirainen prevents malicious user from creating eg. "a/a/a/.../a" mailbox name and
b42f37ae6f65ed986315b6885568d32115e589b1Timo Sirainen then start renaming them to larger names from end to beginning, which
b42f37ae6f65ed986315b6885568d32115e589b1Timo Sirainen eventually would start causing the failures when trying to use too
b42f37ae6f65ed986315b6885568d32115e589b1Timo Sirainen long mailbox names. */
3b94ff5951db4d4eddb7a80ed4e3f61207202635Timo Sirainenstruct mailbox_list_module_register mailbox_list_module_register = { 0 };
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstatic ARRAY_DEFINE(mailbox_list_drivers, const struct mailbox_list *);
unsigned int i, count;
for (i = 0; i < count; i++) {
*idx_r = i;
return TRUE;
return FALSE;
unsigned int idx;
unsigned int idx;
const struct mailbox_list *
unsigned int idx;
return NULL;
return *class_p;
unsigned int idx;
args++;
args++;
args++;
return str;
const char **error_r)
value++;
const char *p, *error;
location++;
location++;
if (p == NULL)
vname++;
const char *vname)
return storage_name;
return storage_name;
if (*p == ns_sep)
*p = list_sep;
return ret;
const char *vname)
unsigned int num;
const char *storage_name)
return vname;
for (i = 0; i < name_len; i++) {
return vname;
struct mail_namespace *
return mode;
struct mail_user *
path);
if (p == NULL) {
if (p == NULL)
const char *expanded_full)
const char *ret;
slash_count++;
slash2_count++;
if (slash_count == 0)
slash_count--;
if (slash_count != 0)
if (slash2_count == 0)
slash2_count--;
if (slash2_count != 0)
return ret;
const char **error_r)
if (p == NULL)
if (p == unexpanded)
error_r) < 0)
const char *pattern)
bool ret;
T_BEGIN {
} T_END;
return ret;
const char *name)
bool ret;
return TRUE;
T_BEGIN {
} T_END;
return ret;
const char *name)
int ret;
return FALSE;
else T_BEGIN {
} T_END;
const char *path;
switch (type) {
i_unreached();
return pattern;
const char *pattern;
int ret;
return ret;
unsigned int len;
*flags_r = 0;
int ret;
if (ret < 0) {
switch (existence) {
case MAILBOX_EXISTENCE_NONE:
case MAILBOX_EXISTENCE_SELECT:
const char *vname;
fname++;
flags_r);
const char *path;
const char *gid_origin;
return TRUE;
return FALSE;
return TRUE;
int ret;
return ret;
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;
return FALSE;
return FALSE;
return TRUE;
const char **name)
unsigned int len;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return TRUE;
path);
if (p == NULL)
const char *name)
&error) < 0) {
&error) < 0) {
const char *str;
const char *error_string;
return FALSE;
return TRUE;