]> 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 09:42:12 +0000 (12:42 +0300)
src/lib-dict/dict-sql.c

index f1ac6385d8b44425275d3180e2e04d5a5944e8c2..8a09becfa9ffc3b35227e1a45f3e8ca2fb5fd499 100644 (file)
@@ -729,7 +729,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 != '$')