]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: var-expand - Fix error handling for %{hash;salt;...} variable expansion
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 21 Nov 2023 09:28:56 +0000 (11:28 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:10 +0000 (12:34 +0200)
Unknown variables were ignored instead of the error being propagated.

src/lib/var-expand.c

index aa72cb097039568bf2f1b3e88821b187bb661009..5904964bdbf6490b0fe1dc78a28918b33b192187 100644 (file)
@@ -297,11 +297,11 @@ var_expand_hash(struct var_expand_context *ctx,
                        truncbits = I_MIN(truncbits, method->digest_size*8);
                } else if (strcmp(k, "salt") == 0) {
                        str_truncate(salt, 0);
-                       if (var_expand_with_funcs(salt, value, ctx->table,
-                                                 ctx->func_table, ctx->context,
-                                                 error_r) < 0) {
-                               return -1;
-                       }
+                       ret = var_expand_with_funcs(salt, value, ctx->table,
+                                                   ctx->func_table,
+                                                   ctx->context, error_r);
+                       if (ret <= 0)
+                               return ret;
                        break;
                } else if (strcmp(k, "format") == 0) {
                        if (strcmp(value, "hex") == 0) {