dovecot-2.0: dict proxy: Iteration failure wasn't passed to dict...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Feb 2 15:20:40 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/5e50d5597474
changeset: 10627:5e50d5597474
user: Timo Sirainen <tss at iki.fi>
date: Tue Feb 02 15:18:25 2010 +0200
description:
dict proxy: Iteration failure wasn't passed to dict client.
diffstat:
2 files changed, 15 insertions(+), 4 deletions(-)
src/dict/dict-commands.c | 7 ++++++-
src/lib-dict/dict-client.c | 12 +++++++++---
diffs (40 lines):
diff -r 9a5f3e3b0197 -r 5e50d5597474 src/dict/dict-commands.c
--- a/src/dict/dict-commands.c Tue Feb 02 15:00:15 2010 +0200
+++ b/src/dict/dict-commands.c Tue Feb 02 15:18:25 2010 +0200
@@ -70,7 +70,12 @@ static int cmd_iterate_flush(struct dict
/* 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 -r 9a5f3e3b0197 -r 5e50d5597474 src/lib-dict/dict-client.c
--- a/src/lib-dict/dict-client.c Tue Feb 02 15:00:15 2010 +0200
+++ b/src/lib-dict/dict-client.c Tue Feb 02 15:18:25 2010 +0200
@@ -517,10 +517,16 @@ static int client_dict_iterate(struct di
/* line contains key \t value */
p_clear(ctx->pool);
- if (*line != DICT_PROTOCOL_REPLY_OK)
+ switch (*line) {
+ case DICT_PROTOCOL_REPLY_OK:
+ value = strchr(++line, '\t');
+ break;
+ case DICT_PROTOCOL_REPLY_FAIL:
+ return -1;
+ default:
value = NULL;
- else
- value = strchr(++line, '\t');
+ break;
+ }
if (value == NULL) {
/* broken protocol */
i_error("dict client (%s) sent broken reply", dict->path);
More information about the dovecot-cvs
mailing list