From: Timo Sirainen Date: Wed, 23 Sep 2015 20:00:30 +0000 (+0300) Subject: dict-client: Improved broken iterate reply logging. X-Git-Tag: 2.2.19.rc2~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2333ef65e41644e9d4fea1f8aef2ee625caf3b00;p=thirdparty%2Fdovecot%2Fcore.git dict-client: Improved broken iterate reply logging. --- diff --git a/src/lib-dict/dict-client.c b/src/lib-dict/dict-client.c index fae8cd3d88..ec9d1fb7b0 100644 --- a/src/lib-dict/dict-client.c +++ b/src/lib-dict/dict-client.c @@ -651,7 +651,7 @@ static bool client_dict_iterate(struct dict_iterate_context *_ctx, 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 @@ static bool client_dict_iterate(struct dict_iterate_context *_ctx, 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; }