From: Timo Sirainen Date: Fri, 7 Apr 2017 09:42:12 +0000 (+0300) Subject: dict-sql: Fix setting $variables to iteration key when map had multiple values X-Git-Tag: 2.2.29~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=573db93069ec9fb37f95c7afee5f1a177b889830;p=thirdparty%2Fdovecot%2Fcore.git dict-sql: Fix setting $variables to iteration key when map had multiple values --- diff --git a/src/lib-dict/dict-sql.c b/src/lib-dict/dict-sql.c index 459b98002d..696f3aed6c 100644 --- a/src/lib-dict/dict-sql.c +++ b/src/lib-dict/dict-sql.c @@ -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 != '$')