dovecot-2.0: lib-storage: Fixed +key=value support to actually w...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 22 20:26:31 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/3d07ab746a67
changeset: 12853:3d07ab746a67
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 22 20:26:24 2011 +0300
description:
lib-storage: Fixed +key=value support to actually work.

diffstat:

 src/lib-storage/mail-storage-service.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (46 lines):

diff -r fcc4ff5b83c4 -r 3d07ab746a67 src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c	Wed Jun 22 20:16:16 2011 +0300
+++ b/src/lib-storage/mail-storage-service.c	Wed Jun 22 20:26:24 2011 +0300
@@ -107,8 +107,7 @@
 {
 	struct setting_parser_context *set_parser = user->set_parser;
 	bool mail_debug;
-	const char *key, *orig_key;
-	bool append = FALSE;
+	const char *key, *orig_key, *append_value = NULL;
 	int ret;
 
 	mail_debug = mail_user_set_get_mail_debug(user->user_info,
@@ -118,8 +117,9 @@
 	orig_key = key = t_strcut(line, '=');
 
 	if (*key == '+') {
+		append_value = line + strlen(key) + 1;
 		key++;
-		append = TRUE;
+		line++;
 	}
 
 	if (!settings_parse_is_valid_key(set_parser, key)) {
@@ -137,14 +137,17 @@
 		return 1;
 	}
 
-	if (append) {
+	if (append_value != NULL) {
 		const void *value;
 		enum setting_type type;
 
 		value = settings_parse_get_value(set_parser, key, &type);
-		if (type == SET_STR)
-			line = t_strconcat(line, value, NULL);
-		else {
+		if (type == SET_STR) {
+			const char *const *strp = value;
+
+			line = t_strdup_printf("%s=%s%s",
+					       key, *strp, append_value);
+		} else {
 			i_error("Ignoring %s userdb setting. "
 				"'+' can only be used for strings.", orig_key);
 		}


More information about the dovecot-cvs mailing list