maildir-storage.c revision 721b683078dab7a46e2a42cfcb81c7d066b57dea
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz/* Copyright (C) 2002-2003 Timo Sirainen */
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz#include "subscription-file/subscription-file.h"
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz#define CREATE_MODE 0770 /* umask() should limit it more */
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz/* Don't allow creating too long mailbox names. They could start causing
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz problems when they reach the limit. */
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz#define MAILDIR_MAX_MAILBOX_NAME_LENGTH (PATH_MAX/2)
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitzstatic const char *maildirs[] = { "cur", "new", "tmp", NULL };
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitzstatic int verify_inbox(struct maildir_storage *storage);
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitzmaildir_create(const char *data, const char *user,
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz bool debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz const char *root_dir, *inbox_dir, *index_dir, *control_dir;
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz inbox_dir = root_dir = index_dir = control_dir = NULL;
0a3769a4ef3afbbbd05df38f43ec7382fd65a2b6Florian Zeitz /* we'll need to figure out the maildir location ourself.
d8361cc8576d9ede93a037f9b96f2a3f9b7e9054Timo Sirainen It's $HOME/Maildir unless we are chrooted. */
if (debug) {
if (debug)
if (debug)
if (debug)
if (p == NULL)
} while (p != NULL);
if (debug)
return NULL;
if (debug) {
const char *path;
if (debug)
return FALSE;
if (debug)
return FALSE;
return TRUE;
const char *name)
return FALSE;
return FALSE;
return TRUE;
return FALSE;
return TRUE;
const char *name)
return FALSE;
return TRUE;
return FALSE;
return TRUE;
if (p == NULL)
return name;
const char *name)
return NULL;
const char *name)
if (verify) {
const char *dir;
const char *dir;
const char *path;
static struct mailbox *
int shared;
if (shared)
FALSE) < 0) {
return NULL;
if (!shared)
static struct mailbox *
const char *path;
return NULL;
return NULL;
return NULL;
return NULL;
return NULL;
return NULL;
path);
return NULL;
int fd;
const char *name,
const char *name)
int count;
count = 0;
count++;
int ret;
ret = 0;
t_push();
t_pop();
t_pop();
return ret;
int ret;
bool found;
if (ret < 0)
const char *path;
const char *name,
const char *path;
path);
int ret = 0;
return ret;