David B?rgin:
> On 14/01/2020 19:39, Wietse Venema wrote:
> >>>                                        unsigned long *pf3)
> >>> {
> >>>     if (set_macro_list) {
> >>>         if (verbose)
> >>>             printf("set symbol list %s to \"%s\"\n",
> >>>                    macro_states[set_macro_state], set_macro_list);
> >>>         smfi_setsymlist(ctx, set_macro_state, set_macro_list);
> >>>     ...
> >>> }
> >>
> >> the call to smfi_setsymlist is guarded by the flag set_macro_list. This
> >> flag is enabled with the -M command-line option. However, that option is
> >> never used, as far as I can see. Therefore, the code path is not taken.
> > 
> > To 'use' the -M command-line option:
> > 
> >     $ make test-milter
> >     $ ./test-milter -m state -M macros ...
> > 
> > Where state is one of connect, helo, mail. etc.
> > Where macros is a list of macros. Example: "{rcpt_mailer} {rcpt_host}".
> 
> Thank you, Wietse.
> 
> test-milter confirms that smfi_setsymlist does not work:
> 
>     $ test-milter -v -p inet:3000@localhost -m connect -M 
> '{client_connections}'
>     set symbol list connect to "{client_connections}"
>     negotiate f0=1ff *pf0 = 1ff f1=1fffff *pf1=400 nosend=0 noreply=0 misc=0
>     test_connect localhost AF_INET (127.0.0.1:0)
>     macro: j="mail.my.org"
>     macro: v="Postfix 3.3.0"
>     macro: {daemon_addr}="127.0.0.1"
>     macro: {daemon_name}="mail.my.org"
>     test_reply 0

Couple observations.

1) Note that all this requires SMFI_VERSION > 5. Did you verify that?

2) Note that it is up to libmilter to send that macro list to
Postfix.  Did you verify that? This requires a single -v option to
the smtpd configuration in master.cf and doing "postfix reload".

If libmilter sends macros, they are logged like this:

        while (data_len > 0
               && milter8_read_data(milter, &data_len,
                                    MILTER8_DATA_HLONG, &mac_type,
                                    MILTER8_DATA_STRING, buf,
                                    MILTER8_DATA_MORE) == 0) {
            smfim_name = str_name_code(smfim_table, mac_type);
            if (smfim_name == 0) {
                msg_warn("milter %s: ignoring unknown macro type %u",
                         milter->m.name, (unsigned) mac_type);
            } else {
                if (msg_verbose)
                    msg_info("override %s macro list with \"%s\"",
                             smfim_name, STR(buf));
                mac_value_ptr = MILTER8_MACRO_PTR(milter->m.macros, mac_type);
                myfree(*mac_value_ptr);
                *mac_value_ptr = mystrdup(STR(buf));
            }
        }

If libmilter does not send them, then that is the problem.

        Wietse

Reply via email to