dovecot-2.2: dict-client: Improved broken iterate reply logging.

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 23 20:01:52 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/471383fa1284
changeset: 19200:471383fa1284
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 23 23:00:30 2015 +0300
description:
dict-client: Improved broken iterate reply logging.

diffstat:

 src/lib-dict/dict-client.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r bc9b61338985 -r 471383fa1284 src/lib-dict/dict-client.c
--- a/src/lib-dict/dict-client.c	Wed Sep 23 22:59:55 2015 +0300
+++ b/src/lib-dict/dict-client.c	Wed Sep 23 23:00:30 2015 +0300
@@ -651,7 +651,7 @@
 	struct client_dict_iterate_context *ctx =
 		(struct client_dict_iterate_context *)_ctx;
 	struct client_dict *dict = (struct client_dict *)_ctx->dict;
-	char *line, *value;
+	char *line, *key, *value;
 
 	if (ctx->failed)
 		return FALSE;
@@ -674,24 +674,26 @@
 
 	switch (*line) {
 	case DICT_PROTOCOL_REPLY_OK:
-		value = strchr(++line, '\t');
+		key = line+1;
+		value = strchr(key, '\t');
 		break;
 	case DICT_PROTOCOL_REPLY_FAIL:
 		ctx->failed = TRUE;
 		return FALSE;
 	default:
+		key = NULL;
 		value = NULL;
 		break;
 	}
 	if (value == NULL) {
 		/* broken protocol */
-		i_error("dict client (%s) sent broken reply", dict->path);
+		i_error("dict client (%s) sent broken iterate reply: %s", dict->path, line);
 		ctx->failed = TRUE;
 		return FALSE;
 	}
 	*value++ = '\0';
 
-	*key_r = p_strdup(ctx->pool, dict_client_unescape(line));
+	*key_r = p_strdup(ctx->pool, dict_client_unescape(key));
 	*value_r = p_strdup(ctx->pool, dict_client_unescape(value));
 	return TRUE;
 }


More information about the dovecot-cvs mailing list