mail-user.c revision 527c2b071dca35b91648344e867ab1af9c988281
/* Copyright (c) 2008-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "hostpid.h"
#include "net.h"
#include "module-dir.h"
#include "home-expand.h"
#include "safe-mkstemp.h"
#include "str.h"
#include "strescape.h"
#include "var-expand.h"
#include "settings-parser.h"
#include "iostream-ssl.h"
#include "fs-api.h"
#include "auth-master.h"
#include "master-service.h"
#include "dict.h"
#include "mail-storage-settings.h"
#include "mail-storage-private.h"
#include "mail-storage-service.h"
#include "mail-namespace.h"
#include "mail-storage.h"
#include "mail-autoexpunge.h"
#include "mail-user.h"
struct mail_user_module_register mail_user_module_register = { 0 };
{
}
}
{
}
const struct setting_parser_info *set_info,
const struct mail_user_settings *set)
{
const char *error;
/* check settings so that the duplicated structure will again
contain the parsed fields */
return user;
}
static void
{
unsigned int i, count;
return;
for (i = 0; i < count; i += 2) {
"userdb didn't return a home directory, "
"but plugin setting %s used it (%%h): %s",
return;
}
str_truncate(str, 0);
}
}
{
const struct mail_storage_settings *mail_set;
bool need_home_dir;
"userdb didn't return a home directory, "
}
/* expand settings after we can expand %h */
/* autocreated users for shared mailboxes need to be fully initialized
if they don't exist, since they're going to be used anyway */
}
return -1;
}
return 0;
}
{
}
{
return;
}
if (user->autoexpunge_enabled)
/* call deinit() with refcount=1, otherwise we may assert-crash in
mail_user_ref() that is called by some deinit() handler. */
}
{
struct mail_namespace *ns;
}
return NULL;
}
{
}
}
}
const struct var_expand_table *
{
static struct var_expand_table static_tab[] = {
/* NOTE: keep this synced with imap-hibernate's
imap_client_var_expand_table() */
};
struct var_expand_table *tab;
/* use a cached table, unless home directory has been set afterwards */
return user->var_expand_table;
} else {
}
return user->var_expand_table;
}
static const char *
{
}
{
}
struct mail_namespace **namespaces)
{
break;
}
}
T_BEGIN {
} T_END;
}
{
/* drop all autocreated unusable (typically shared) namespaces.
don't drop the autocreated prefix="" namespace that we explicitly
created for being the fallback namespace. */
ns->prefix_len > 0)
}
}
{
return path;
}
{
struct auth_user_info info;
struct auth_user_reply reply;
int ret;
if (ret > 0) {
}
return ret;
}
{
if (user->settings_expanded) {
return;
}
/* we're still initializing user. need to do the expansion ourself. */
home++;
if (home[0] == '\0')
return;
}
{
int ret;
if (user->home_looked_up) {
}
if (mail_user_auth_master_conn == NULL) {
/* no userdb connection. we can only use mail_home setting. */
/* userdb lookup failed */
return -1;
} else if (ret == 0) {
/* user doesn't exist */
/* no home returned by userdb lookup, fallback to
mail_home setting. */
}
}
{
const char *const *plugins;
bool ret;
T_BEGIN {
} T_END;
return ret;
}
{
return FALSE;
switch (env[0]) {
case 'n':
case 'N':
case '0':
case 'f':
case 'F':
return FALSE;
}
//any other value including empty string will be treated as TRUE.
return TRUE;
}
{
}
const char *name)
{
const char *const *envs;
unsigned int i, count;
return NULL;
for (i = 0; i < count; i += 2) {
return envs[i+1];
}
return NULL;
}
{
if (*path != '~') {
/* no need to expand home */
return 0;
}
return -1;
return -1;
return 0;
}
const struct mail_user_settings *set)
{
}
{
return NULL;
}
static void
{
struct module_dir_load_settings mod_set;
/* initialize the module (and only this module!) immediately so that
the class gets registered */
if (!module->initialized) {
}
break;
}
}
}
struct mail_storage *
{
struct mail_storage *storage;
return storage;
/* it's implemented by a plugin. load it and check again. */
i_error("Storage driver '%s' exists as a stub, "
"but its plugin couldn't be loaded", name);
return NULL;
}
return storage;
}
{
return user2;
}
struct fs_settings *fs_set,
struct ssl_iostream_settings *ssl_set)
{
const struct mail_storage_settings *mail_set =
}
{
}
static const struct var_expand_func_table mail_user_var_expand_func_table_arr[] = {
{ "userdb", mail_user_var_expand_func_userdb },
};
const struct var_expand_func_table *mail_user_var_expand_func_table =