]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-sql: Fix setting $variables to iteration key when map had multiple values
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 7 Apr 2017 09:42:12 +0000 (12:42 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 7 Apr 2017 11:26:10 +0000 (14:26 +0300)
src/lib-dict/dict-sql.c

index 459b98002d9df13e994941e46e2b5e849fb20f4d..696f3aed6ca21162a8972f95a11bcd106e8530c6 100644 (file)
@@ -757,7 +757,8 @@ static bool sql_dict_iterate(struct dict_iterate_context *_ctx,
                str_append_c(ctx->key, '/');
 
        count = sql_result_get_fields_count(ctx->result);
-       i = (ctx->flags & DICT_ITERATE_FLAG_NO_VALUE) != 0 ? 0 : 1;
+       i = (ctx->flags & DICT_ITERATE_FLAG_NO_VALUE) != 0 ? 0 :
+               ctx->map->values_count;
        sql_field_i = ctx->sql_fields_start_idx;
        for (p = ctx->map->pattern + ctx->pattern_prefix_len; *p != '\0'; p++) {
                if (*p != '$')