From: Timo Sirainen Date: Tue, 2 Feb 2010 13:18:25 +0000 (+0200) Subject: dict proxy: Iteration failure wasn't passed to dict client. X-Git-Tag: 2.0.beta3~171 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4383dc44cc122924e65a533b105fd64bf566ebf;p=thirdparty%2Fdovecot%2Fcore.git dict proxy: Iteration failure wasn't passed to dict client. --HG-- branch : HEAD --- diff --git a/src/dict/dict-commands.c b/src/dict/dict-commands.c index 4f4dd76c38..4ac7710cdf 100644 --- a/src/dict/dict-commands.c +++ b/src/dict/dict-commands.c @@ -70,7 +70,12 @@ static int cmd_iterate_flush(struct dict_connection *conn) /* finished iterating */ o_stream_unset_flush_callback(conn->output); dict_iterate_deinit(&conn->iter_ctx); - o_stream_send(conn->output, "\n", 1); + + str_truncate(str, 0); + if (ret < 0) + str_append_c(str, DICT_PROTOCOL_REPLY_FAIL); + str_append_c(str, '\n'); + o_stream_send(conn->output, str_data(str), str_len(str)); } o_stream_uncork(conn->output); return ret <= 0 ? 1 : 0; diff --git a/src/lib-dict/dict-client.c b/src/lib-dict/dict-client.c index 396b96e362..a0561f444d 100644 --- a/src/lib-dict/dict-client.c +++ b/src/lib-dict/dict-client.c @@ -517,10 +517,16 @@ static int client_dict_iterate(struct dict_iterate_context *_ctx, /* line contains key \t value */ p_clear(ctx->pool); - if (*line != DICT_PROTOCOL_REPLY_OK) - value = NULL; - else + switch (*line) { + case DICT_PROTOCOL_REPLY_OK: value = strchr(++line, '\t'); + break; + case DICT_PROTOCOL_REPLY_FAIL: + return -1; + default: + value = NULL; + break; + } if (value == NULL) { /* broken protocol */ i_error("dict client (%s) sent broken reply", dict->path);