mail-storage-service.c revision 34512eaad8b1b2f929e6d6e3a2f7252c29fba97b
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen/* Copyright (c) 2009-2017 Dovecot authors, see the included COPYING file */
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen/* If time moves backwards more than this, kill ourself instead of sleeping. */
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainen "Invalid user settings. Refer to server log for more information."
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainen struct auth_master_connection *conn, *iter_conn;
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainen const char *set_cache_module, *set_cache_service;
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainen struct master_service_settings_cache *set_cache;
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen const char *const **userdb_next_fieldsp;
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainen const char *log_prefix, *auth_token, *auth_user;
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainen const char *system_groups_user, *uid_source, *gid_source;
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainenstruct module *mail_storage_service_modules = NULL;
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainenmail_storage_service_var_expand(struct mail_storage_service_ctx *ctx,
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen const struct mail_storage_service_input *input,
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen const struct mail_storage_service_privileges *priv,
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen const char **error_r);
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainenmail_user_set_get_mail_debug(const struct setting_parser_info *user_info,
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen mail_set = mail_user_set_get_driver_settings(user_info, user_set,
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainenstatic void set_keyval(struct mail_storage_service_ctx *ctx,
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen struct setting_parser_context *set_parser = user->set_parser;
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen if (master_service_set_has_config_override(ctx->service, key)) {
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen /* this setting was already overridden with -o parameter */
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen if (mail_user_set_get_mail_debug(user->user_info,
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen i_debug("Ignoring overridden (-o) userdb setting: %s",
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen if (settings_parse_keyvalue(set_parser, key, value) < 0) {
const char *line)
bool mail_debug;
int ret;
if (mail_debug) {
key);
const void *value;
return ret;
const char *dir)
const char *const *chroot_dirs;
return FALSE;
return FALSE;
return TRUE;
chroot_dirs++;
return FALSE;
const char **error_r)
unsigned int i, count;
int ret = 0;
for (i = 0; i < count; i++) {
#ifdef HAVE_SETPRIORITY
} else T_BEGIN {
} T_END;
if (ret < 0)
if (ret < 0) {
return ret;
const char *const **fields_r,
const char **error_r)
const char *new_username;
int ret;
if (ret > 0) {
} else if (ret == 0)
return ret;
return TRUE;
return FALSE;
return FALSE;
return TRUE;
return TRUE;
return FALSE;
return FALSE;
return TRUE;
static const struct var_expand_table *
return tab;
const struct var_expand_table *
int ret;
return TRUE;
return ret > 0;
const char **error_r)
const char *error;
static void mail_storage_service_seteuid_root(void)
if (seteuid(0) < 0) {
&error)) {
if (disallow_root &&
if (keep_setuid_root) {
if (current_euid != 0) {
if (!setenv_only) {
const char **error_r)
if (p == NULL)
const char *const *fields)
const char **value_r,
const char **error_r)
const char *error;
T_BEGIN {
} T_END;
user);
if (diff > 0) {
diff++;
struct mail_storage_service_ctx *
const char *version;
unsigned int count;
getuid() != 0) {
count = 0;
return ctx;
struct auth_master_connection *
static enum mail_storage_service_flags
return flags;
const char **error_r)
i_unreached();
const char **error_r)
const char *error;
bool update_log_prefix,
const char **error_r)
void **sets;
geteuid() != 0) {
error_r) < 0) {
if (update_log_prefix)
if (ret <= 0) {
return ret;
if (ret > 0) {
error_r) < 0) {
return ret;
const char **error_r)
bool update_log_prefix;
int ret;
const char *session_id =
return ret;
const char **error_r)
const char *error;
bool disallow_root =
bool temp_priv_drop =
bool use_chroot;
if (use_chroot) {
if (!temp_priv_drop ||
const char **error_r)
int ret;
return ret;
const char *error;
const char **error_r)
int ret;
if (ret <= 0)
return ret;
if (ret < 0) {
return ret;
const char *error;
void **sets;
&error) < 0)
int ret = 0;
return ret;
const char *user_mask_hint)
flags);
const char **username_r)
const struct mail_storage_settings *
const struct mail_storage_service_input *
struct setting_parser_context *
struct mail_storage_service_ctx *
T_BEGIN {
} T_END;
return set;