/* Copyright (c) 2008-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "hostpid.h"
#include "ioloop.h"
#include "net.h"
#include "module-dir.h"
#include "home-expand.h"
#include "file-create-locked.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 "mailbox-list-private.h"
#include "mail-autoexpunge.h"
#include "mail-user.h"
{
}
}
{
}
{
}
static struct mail_user *
const char *username,
const struct setting_parser_info *set_info,
{
const char *error;
/* check settings so that the duplicated structure will again
contain the parsed fields */
return user;
}
struct mail_user *
const char *username,
const struct setting_parser_info *set_info,
const struct mail_user_settings *set)
{
}
const char *username,
const struct setting_parser_info *set_info,
const struct mail_user_settings *set)
{
}
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);
&error) <= 0) {
"Failed to expand plugin setting %s = '%s': %s",
return;
}
}
}
{
bool need_home_dir;
"userdb didn't return a home directory, "
}
/* expand settings after we can expand %h */
&error) <= 0) {
"Failed to expand settings: %s", error);
}
/* 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;
}
/* call deinit() and deinit_pre() with refcount=1, otherwise we may
assert-crash in mail_user_ref() that is called by some handlers. */
}
{
}
return NULL;
}
static void
{
}
}
}
const struct mail_user_connection_data *conn)
{
}
const struct var_expand_table *
{
/* use a cached table, unless home directory has been set afterwards */
return user->var_expand_table;
const char *username =
} else {
}
/* NOTE: keep this synced with imap-hibernate's
imap_client_var_expand_table() */
};
return user->var_expand_table;
}
static int
const char **value_r,
const char **error_r ATTR_UNUSED)
{
return 1;
}
{
}
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;
}
{
int ret;
if (ret > 0) {
}
return ret;
}
{
if (user->settings_expanded) {
return TRUE;
}
/* we're still initializing user. need to do the expansion ourself. */
home++;
if (home[0] == '\0')
return TRUE;
&error) <= 0) {
return FALSE;
}
return TRUE;
}
{
int ret;
if (user->home_looked_up) {
}
if (mail_user_auth_master_conn == NULL) {
/* no userdb connection. we can only use mail_home setting. */
if (!mail_user_get_mail_home(user))
return -1;
/* userdb lookup failed */
return -1;
} else if (ret == 0) {
/* user doesn't exist */
/* no home returned by userdb lookup, fallback to
mail_home setting. */
if (!mail_user_get_mail_home(user))
return -1;
}
}
{
const char *const *plugins;
bool ret;
T_BEGIN {
} T_END;
return ret;
}
{
}
const char *name)
{
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)
{
}
unsigned int lock_secs,
{
int ret;
/* home lookup failed - shouldn't really happen */
*error_r = "Failed to lookup home directory";
return -1;
}
if (ret == 0) {
*error_r = "User has no home directory";
return -1;
}
};
else {
}
}
{
return NULL;
}
static void
{
/* initialize the module (and only this module!) immediately so that
the class gets registered */
if (!module->initialized) {
}
break;
}
}
}
struct mail_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 ssl_iostream_settings *ssl_set)
{
}
struct fs_settings *fs_set,
struct ssl_iostream_settings *ssl_set)
{
}
{
}
{ "userdb", mail_user_var_expand_func_userdb },
};