dovecot-2.2: lib-storage: Support %{userdb:*} variables in mail_...

dovecot at dovecot.org dovecot at dovecot.org
Mon Nov 9 11:17:16 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/2f2d78bedeed
changeset: 19346:2f2d78bedeed
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 09 13:16:50 2015 +0200
description:
lib-storage: Support %{userdb:*} variables in mail_home and mail_chroot settings.

diffstat:

 src/lib-storage/mail-storage-service.c |  16 +++++++++++-----
 src/lib-storage/mail-user.c            |   4 +++-
 2 files changed, 14 insertions(+), 6 deletions(-)

diffs (62 lines):

diff -r 5d58bdcafc7d -r 2f2d78bedeed src/lib-storage/mail-storage-service.c
--- 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;
 }
diff -r 5d58bdcafc7d -r 2f2d78bedeed src/lib-storage/mail-user.c
--- 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));
 }
 


More information about the dovecot-cvs mailing list