changeset 12188:1c3d9244f248

doveconf: Expand "key=$key" variable even without -x parameter. Without this expansion it hides what the settings actually contain.
author Timo Sirainen <tss@iki.fi>
date Mon, 27 Sep 2010 16:46:26 +0100
parents 432208994270
children 81a3da7f6413
files src/config/config-parser.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/config/config-parser.c	Mon Sep 27 15:50:43 2010 +0100
+++ b/src/config/config-parser.c	Mon Sep 27 16:46:26 2010 +0100
@@ -663,18 +663,20 @@
 		}
 		break;
 	case CONFIG_LINE_TYPE_KEYVARIABLE:
-		if (!ctx->expand_values) {
+		/* expand_parent=TRUE for "key = $key stuff".
+		   we'll always expand it so that doveconf -n can give
+		   usable output */
+		p = strchr(value, ' ');
+		if (p == NULL)
+			var_name = value;
+		else
+			var_name = t_strdup_until(value, p);
+		expand_parent = strcmp(key, var_name) == 0;
+
+		if (!ctx->expand_values && !expand_parent) {
 			str_append_c(str, '$');
 			str_append(str, value);
 		} else {
-			p = strchr(value, ' ');
-			if (p == NULL)
-				var_name = value;
-			else
-				var_name = t_strdup_until(value, p);
-
-			/* expand_parent=TRUE for "key = $key stuff" */
-			expand_parent = strcmp(key, var_name) == 0;
 			var_value = config_get_value(ctx->cur_section, var_name,
 						     expand_parent, &var_type);
 			if (var_value == NULL) {