]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict proxy: Iteration failure wasn't passed to dict client.
authorTimo Sirainen <tss@iki.fi>
Tue, 2 Feb 2010 13:18:25 +0000 (15:18 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 2 Feb 2010 13:18:25 +0000 (15:18 +0200)
--HG--
branch : HEAD

src/dict/dict-commands.c
src/lib-dict/dict-client.c

index 4f4dd76c38f67bb0d9fdf54f5ff37ed18dce7fec..4ac7710cdf82fdf49141124714803b154d3f3dde 100644 (file)
@@ -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;
index 396b96e3625ec5d7ea4052df5928bbd4f15a9013..a0561f444dffb3c3fdd5f3eb9ea8b160fb7fbaef 100644 (file)
@@ -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);