]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-var-expand: Use value for error in var_expand_parameter_bool_or_var()
authorAki Tuomi <aki.tuomi@open-xchange.com>
Sun, 22 Mar 2026 18:52:55 +0000 (20:52 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 23 Mar 2026 13:40:28 +0000 (15:40 +0200)
src/lib-var-expand/expansion-parameter.c
src/lib-var-expand/test-var-expand.c

index ef2a637a715ad5f4663bb1aa59e596634327cedd..e77a89698a3c9fa2410d8209f0fbcfcbae5ca991 100644 (file)
@@ -60,7 +60,7 @@ int var_expand_parameter_bool_or_var(const struct var_expand_state *state,
        } else if (value == 1) {
                *value_r = TRUE;
        } else {
-               *error_r = t_strdup_printf("'%s' is not 0 or 1", param->value.str);
+               *error_r = t_strdup_printf("'%jd' is not 0 or 1", value);
                return -1;
        }
        return 0;
index 4a73804f93b93a968e3111fb08d0bec2ca839a3b..a8174b38af42a88b0a7426e8837a3dc78f043731 100644 (file)
@@ -212,6 +212,9 @@ static void test_var_expand_builtin_filters(void) {
                { .in = "%{unbase64(0)}", .out = "unbase64: Too many positional parameters", .ret = -1 },
                { .in = "%{unbase64(fail=1)}", .out = "unbase64: Unsupported key 'fail'", .ret = -1 },
                { .in = "%{first | base64(pad=0)}", .out = "aGVsbG8", .ret = 0 },
+               /* test boolean parameters */
+               { .in = "%{first | base64(pad='yes')}", .out = "base64: 'yes' is not a number", .ret = -1 },
+               { .in = "%{first | base64(pad=-5)}", .out = "base64: '-5' is not 0 or 1", .ret = -1 },
                /* weird syntax to avoid trigraph ignored */
                { .in = "%{literal('<<?""?""?>>') | base64(url=1)}", .out = "PDw_Pz8-Pg==", .ret = 0 },
                { .in = "%{literal('<<?""?""?>>') | base64(pad=0,url=1)}", .out = "PDw_Pz8-Pg", .ret = 0 },