struct mailbox_header_lookup_ctx *headers_ctx;
struct mail *mail;
uid_t process_euid;
- pool_t namespace_pool;
bool stderr_rejection = FALSE;
bool keep_environment = FALSE;
bool user_auth = FALSE;
module_dir_init(modules);
- namespace_pool = pool_alloconly_create("namespaces", 1024);
mail_user = mail_user_init(user, home);
- if (mail_namespaces_init(namespace_pool, mail_user) < 0)
+ if (mail_namespaces_init(mail_user) < 0)
i_fatal("Namespace initialization failed");
/* create a separate mail user for the internal namespace */
raw_mail_user = mail_user_init(user, NULL);
- raw_ns = mail_namespaces_init_empty(namespace_pool, raw_mail_user);
+ raw_ns = mail_namespaces_init_empty(raw_mail_user);
raw_ns->flags |= NAMESPACE_FLAG_INTERNAL;
if (mail_storage_create(raw_ns, "raw", "/tmp",
static struct io *log_io = NULL;
static struct module *modules = NULL;
static char log_prefix[128]; /* syslog() needs this to be permanent */
-static pool_t namespace_pool;
void (*hook_client_created)(struct client **client) = NULL;
parse_workarounds();
- namespace_pool = pool_alloconly_create("namespaces", 1024);
user = mail_user_init(username, home);
- if (mail_namespaces_init(namespace_pool, user) < 0)
+ if (mail_namespaces_init(user) < 0)
i_fatal("Namespace initialization failed");
client = client_create(0, 1, user);
commands_deinit();
mail_storage_deinit();
dict_driver_unregister(&dict_driver_client);
- pool_unref(&namespace_pool);
str_free(&capability_string);
}
static struct mail_namespace *
-namespace_add_env(pool_t pool, const char *data, unsigned int num,
+namespace_add_env(const char *data, unsigned int num,
struct mail_user *user, enum mail_storage_flags flags,
enum file_lock_method lock_method)
{
struct mail_namespace *ns;
const char *sep, *type, *prefix, *error;
- ns = p_new(pool, struct mail_namespace, 1);
+ ns = p_new(user->pool, struct mail_namespace, 1);
sep = getenv(t_strdup_printf("NAMESPACE_%u_SEP", num));
type = getenv(t_strdup_printf("NAMESPACE_%u_TYPE", num));
if (sep != NULL)
ns->sep = *sep;
- ns->prefix = p_strdup(pool, prefix);
+ ns->prefix = p_strdup(user->pool, prefix);
ns->user = user;
if (mail_storage_create(ns, NULL, data, flags, lock_method,
return dest;
}
-int mail_namespaces_init(pool_t pool, struct mail_user *user)
+int mail_namespaces_init(struct mail_user *user)
{
struct mail_namespace *namespaces, *ns, **ns_p;
enum mail_storage_flags flags;
break;
T_BEGIN {
- *ns_p = namespace_add_env(pool, data, i, user, flags,
+ *ns_p = namespace_add_env(data, i, user, flags,
lock_method);
} T_END;
mail = t_strconcat("maildir:", mail, NULL);
}
- ns = p_new(pool, struct mail_namespace, 1);
+ ns = p_new(user->pool, struct mail_namespace, 1);
ns->type = NAMESPACE_PRIVATE;
ns->flags = NAMESPACE_FLAG_INBOX | NAMESPACE_FLAG_LIST |
NAMESPACE_FLAG_SUBSCRIPTIONS;
}
struct mail_namespace *
-mail_namespaces_init_empty(pool_t pool, struct mail_user *user)
+mail_namespaces_init_empty(struct mail_user *user)
{
struct mail_namespace *ns;
- ns = p_new(pool, struct mail_namespace, 1);
+ ns = p_new(user->pool, struct mail_namespace, 1);
ns->user = user;
ns->prefix = "";
ns->flags = NAMESPACE_FLAG_INBOX | NAMESPACE_FLAG_LIST |
/* Called after namespaces has been created */
extern void (*hook_mail_namespaces_created)(struct mail_namespace *namespaces);
-int mail_namespaces_init(pool_t pool, struct mail_user *user);
-struct mail_namespace *
-mail_namespaces_init_empty(pool_t pool, struct mail_user *user);
+int mail_namespaces_init(struct mail_user *user);
+struct mail_namespace *mail_namespaces_init_empty(struct mail_user *user);
void mail_namespaces_deinit(struct mail_namespace **namespaces);
/* Update hierarchy separators in given name to real_sep characters. */
const char *path, *error;
int ret;
- source_ns = mail_namespaces_init_empty(pool_datastack_create(), user);
+ source_ns = mail_namespaces_init_empty(user);
dest_inbox_ns = mail_namespace_find_inbox(dest_namespaces);
src_flags = dest_inbox_ns->storage->flags;
lock_method = dest_inbox_ns->storage->lock_method;
mail_storage_parse_env(&dest_flags, &lock_method);
user = mail_user_init(argv[1], argv[2]);
- dest_ns = mail_namespaces_init_empty(pool_datastack_create(), user);
+ dest_ns = mail_namespaces_init_empty(user);
if (mail_storage_create(dest_ns, NULL, argv[4],
dest_flags, lock_method, &error) < 0) {
char *user;
struct mail_user *mail_user;
- pool_t namespace_pool;
bool testrun;
};
}
ctx->mail_user = mail_user_init(user, getenv("HOME"));
- if (mail_namespaces_init(ctx->namespace_pool, ctx->mail_user) < 0)
+ if (mail_namespaces_init(ctx->mail_user) < 0)
return -1;
return 1;
}
{
mail_user_deinit(&ctx->mail_user);
i_free_and_null(ctx->user);
- p_clear(ctx->namespace_pool);
}
static int
memset(&ctx, 0, sizeof(ctx));
ctx.testrun = testrun;
ctx.auth_conn = auth_connection_init(auth_socket);
- ctx.namespace_pool = pool_alloconly_create("namespaces", 1024);
env = expire_env_init(getenv("EXPIRE"), getenv("EXPIRE_ALTMOVE"));
dict = dict_init(getenv("EXPIRE_DICT"), DICT_DATA_TYPE_UINT32, "");
if (dict == NULL)
void (*hook_client_created)(struct client **client) = NULL;
static struct module *modules = NULL;
-static pool_t namespace_pool;
static char log_prefix[128]; /* syslog() needs this to be permanent */
static struct io *log_io = NULL;
i_fatal("pop3_uidl_format setting doesn't contain any "
"%% variables.");
- namespace_pool = pool_alloconly_create("namespaces", 1024);
user = mail_user_init(getenv("USER"), getenv("HOME"));
- if (mail_namespaces_init(namespace_pool, user) < 0)
+ if (mail_namespaces_init(user) < 0)
i_fatal("Namespace initialization failed");
client = client_create(0, 1, user);