Mercurial > dovecot > core-2.2
changeset 19346:2f2d78bedeed
lib-storage: Support %{userdb:*} variables in mail_home and mail_chroot settings.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 09 Nov 2015 13:16:50 +0200 |
parents | 5d58bdcafc7d |
children | 61eb9ac0d29e |
files | src/lib-storage/mail-storage-service.c src/lib-storage/mail-user.c |
diffstat | 2 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-storage-service.c Mon Nov 09 13:02:56 2015 +0200 +++ b/src/lib-storage/mail-storage-service.c Mon Nov 09 13:16:50 2015 +0200 @@ -88,6 +88,13 @@ struct module *mail_storage_service_modules = NULL; +static void +mail_storage_service_var_expand(struct mail_storage_service_ctx *ctx, + string_t *str, const char *format, + struct mail_storage_service_user *user, + const struct mail_storage_service_input *input, + const struct mail_storage_service_privileges *priv); + static bool mail_user_set_get_mail_debug(const struct setting_parser_info *user_info, const struct mail_user_settings *user_set) @@ -443,7 +450,7 @@ } static const char * -user_expand_varstr(struct master_service *service, +user_expand_varstr(struct mail_storage_service_ctx *ctx, struct mail_storage_service_user *user, struct mail_storage_service_privileges *priv, const char *str) @@ -456,8 +463,7 @@ i_assert(*str == SETTING_STRVAR_UNEXPANDED[0]); ret = t_str_new(256); - var_expand(ret, str + 1, - get_var_expand_table(service, user, &user->input, priv)); + mail_storage_service_var_expand(ctx, ret, str + 1, user, &user->input, priv); return str_c(ret); } @@ -512,9 +518,9 @@ /* variable strings are expanded in mail_user_init(), but we need the home and chroot sooner so do them separately here. */ - priv_r->home = user_expand_varstr(ctx->service, user, priv_r, + priv_r->home = user_expand_varstr(ctx, user, priv_r, user->user_set->mail_home); - priv_r->chroot = user_expand_varstr(ctx->service, user, priv_r, + priv_r->chroot = user_expand_varstr(ctx, user, priv_r, user->user_set->mail_chroot); return 0; }
--- a/src/lib-storage/mail-user.c Mon Nov 09 13:02:56 2015 +0200 +++ b/src/lib-storage/mail-user.c Mon Nov 09 13:16:50 2015 +0200 @@ -377,7 +377,9 @@ return; str = t_str_new(128); - var_expand(str, home, mail_user_var_expand_table(user)); + var_expand_with_funcs(str, home, + mail_user_var_expand_table(user), + mail_user_var_expand_func_table, user); user->_home = p_strdup(user->pool, str_c(str)); }