Sean Gallagher via Postfix-users:
> I have been trying to understand why check_ccert_access does not work 
> with an inline:{} table and I believe I have uncovered a subtle bug.
> 
> My investigation has focused on 
> https://github.com/vdukhovni/postfix/blob/master/postfix/src/global/map_search.c
>  
> 
> 
> To cut to the chase, I believe line 161 should call mystrtokq() instead 
> of mystrtok().

Thanks for a correct diagnosis. In the patch below, I added a unit
test. There actually was a test for inline{} maps, but that test
covered only a trivial case.

        Wietse

--- /var/tmp/postfix-3.8-20230312/src/global/map_search.c       2022-07-19 
16:49:47.000000000 -0400
+++ src/global/map_search.c     2023-03-14 08:53:58.435550969 -0400
@@ -158,7 +158,8 @@
        if ((heap_err = extpar(&bp, CHARS_BRACE, EXTPAR_FLAG_STRIP)) != 0) {
            msg_warn("malformed map specification: '%s'", heap_err);
            MAP_SEARCH_CREATE_RETURN(0);
-       } else if ((map_type_name = mystrtok(&bp, CHARS_COMMA_SP)) == 0) {
+       } else if ((map_type_name = mystrtokq(&bp, CHARS_COMMA_SP,
+                                             CHARS_BRACE)) == 0) {
            msg_warn("empty map specification: '%s'", map_spec);
            MAP_SEARCH_CREATE_RETURN(0);
        }
@@ -308,6 +309,7 @@
        {"{type:name {search_order=one, two}}", 1, "type:name", "\01\02"},
        {"{type:name {search_order=one, two, bad}}", 0, 0, 0},
        {"{inline:{a=b} {search_order=one, two}}", 1, "inline:{a=b}", "\01\02"},
+       {"{inline:{a=b, c=d} {search_order=one, two}}", 1, "inline:{a=b, c=d}", 
"\01\02"},
        {0},
     };
     TEST_CASE *test_case;
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to