mail-storage-service.c revision 2f90189c6ee66a17f7bf838a8eb8a69868630fb8
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2009-2013 Dovecot authors, see the included COPYING file */
39dea5f2e78f6bfc3adc0655176f596ee211938fTimo Sirainen/* If time moves backwards more than this, kill ourself instead of sleeping. */
39dea5f2e78f6bfc3adc0655176f596ee211938fTimo Sirainen "Invalid user settings. Refer to server log for more information."
2e07e3182f355cf04a1461dd7f893d0ebc818764Timo Sirainen struct auth_master_connection *conn, *iter_conn;
2e07e3182f355cf04a1461dd7f893d0ebc818764Timo Sirainen const char *set_cache_module, *set_cache_service;
2e07e3182f355cf04a1461dd7f893d0ebc818764Timo Sirainen struct master_service_settings_cache *set_cache;
38ce5769db11e7f52562610ee6e6fc4f0ea7888fMartti Rannanjärvi const char *const **userdb_next_fieldsp;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *log_prefix, *auth_token, *auth_user;
c3785e2a5618182c3d7fb59f4888134e7ac834ccTimo Sirainen const char *system_groups_user, *uid_source, *gid_source;
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenstruct module *mail_storage_service_modules = NULL;
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenmail_user_set_get_mail_debug(const struct setting_parser_info *user_info,
3f7583189249a28892cd5bd69e15681c7a8a619bTimo Sirainen mail_set = mail_user_set_get_driver_settings(user_info, user_set,
c3785e2a5618182c3d7fb59f4888134e7ac834ccTimo Sirainenstatic void set_keyval(struct mail_storage_service_ctx *ctx,
cf41318871bd42358df3420e50614f5310b08c77Martti Rannanjärvi struct setting_parser_context *set_parser = user->set_parser;
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen const char *str;
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen if (master_service_set_has_config_override(ctx->service, key)) {
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen /* this setting was already overridden with -o parameter */
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen if (mail_user_set_get_mail_debug(user->user_info,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen i_debug("Ignoring overridden (-o) userdb setting: %s",
b62139aae0a0099d0ede35b164b2870479f9b027Martti Rannanjärvi str = t_strconcat(key, "=", value, NULL);
38ce5769db11e7f52562610ee6e6fc4f0ea7888fMartti Rannanjärvi if (settings_parse_line(set_parser, str) < 0) {
b62139aae0a0099d0ede35b164b2870479f9b027Martti Rannanjärvi i_fatal("Invalid userdb input '%s': %s", str,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenstatic int set_line(struct mail_storage_service_ctx *ctx,
39dea5f2e78f6bfc3adc0655176f596ee211938fTimo Sirainen struct setting_parser_context *set_parser = user->set_parser;
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen const char *key, *orig_key, *append_value = NULL;
666286d8ecc6c450b2232dcc628f79454215acfcTimo Sirainen unsigned int len;
afbdaecd328f6c912293d713975856cbb2d75452Sergey Kitov mail_debug = mail_user_set_get_mail_debug(user->user_info,
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 *
const char *str)
const char **error_r)
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)
T_BEGIN {
} T_END;
user);
if (diff > 0) {
diff++;
struct mail_storage_service_ctx *
const char *version;
unsigned int count;
geteuid() != 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)
void **sets;
geteuid() != 0) {
&error) < 0) {
error_r);
if (ret <= 0) {
return ret;
if (ret > 0) {
return ret;
const char *error;
unsigned int len;
bool disallow_root =
bool temp_priv_drop =
bool use_chroot;
if (use_chroot) {
if (!temp_priv_drop ||
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;
flags);
const char **username_r)
const struct mail_storage_settings *
const struct mail_storage_service_input *
struct setting_parser_context *
T_BEGIN {
} T_END;
return set;