]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dict-extra: dict-fs - Fix endless loop while iterating
authorManuel Mausz <manuel@mausz.at>
Tue, 26 Jul 2022 08:07:31 +0000 (10:07 +0200)
committerDovecot Automation <automation@dovecot.org>
Mon, 25 Sep 2023 05:05:13 +0000 (05:05 +0000)
Broken by 32e8bd5b5a9d5bc04e5ac6c65ac132ba5c386d64

src/lib-dict-extra/dict-fs.c

index 4c173e3f749c874b4784877f02c732995544e991..b83f65704594c50099b7a65fdcfb48c98e301ffe 100644 (file)
@@ -175,7 +175,6 @@ static bool fs_dict_iterate(struct dict_iterate_context *ctx,
 {
        struct fs_dict_iterate_context *iter =
                (struct fs_dict_iterate_context *)ctx;
-       struct fs_dict *dict = (struct fs_dict *)ctx->dict;
        const char *path, *error;
        int ret;
 
@@ -183,17 +182,9 @@ static bool fs_dict_iterate(struct dict_iterate_context *ctx,
                return FALSE;
 
        *key_r = fs_iter_next(iter->fs_iter);
-       if (*key_r == NULL) {
-               if (fs_iter_deinit(&iter->fs_iter, &error) < 0) {
-                       iter->error = i_strdup(error);
-                       return FALSE;
-               }
-               if (iter->path == NULL)
-                       return FALSE;
-               path = fs_dict_get_full_key(ctx->set.username, iter->path);
-               iter->fs_iter = fs_iter_init(dict->fs, path, 0);
-               return fs_dict_iterate(ctx, key_r, values_r);
-       }
+       if (*key_r == NULL)
+               return FALSE;
+
        path = t_strconcat(iter->path, *key_r, NULL);
        if ((iter->flags & DICT_ITERATE_FLAG_NO_VALUE) != 0) {
                iter->values[0] = NULL;