David B?rgin:
> On 14/01/2020 18:22, Wietse Venema wrote:
> >> In section ?What macros will Postfix send to Milters??, MILTER_README
> >> says:
> >>
> >>> As of Sendmail 8.14.0, Milter applications can specify what macros
> >>> they want to receive at different Milter protocol stages. An
> >>> application-specified list takes precedence over a Postfix-specified
> >>> list.
> >>
> >> This refers to the API function smfi_setsymlist, right? When I hook a
> > 
> > The Milter docs say: "This function must only be called during
> > xxfi_negotiate()". Thus, you cannot call it at any other time.
> > (found with a Google query, because milter.org is gone).
> 
> Yes, I?m using the API correctly, and get the MI_SUCCESS return code.
> 
> > Postfix test code calls smfi_setsymlist during initial Milter
> > connection negotiation, through the xxfi_negotiate callback in the
> > smfiDesc structure. It's been ~10 years, but that code presumably
> > worked. The program is included with Postfix source as
> > src/milter/test_milter.c. Maybe you can play with that.
> 
> I suspect this code doesn?t work and perhaps never did work ? in Postfix
> source there is only one occurrence of smfi_setsymlist, in a code path
> that is never executed.

smfi_setsymlist() is called by test_negotiate():

static sfsistat test_negotiate(SMFICTX *ctx,
                                       unsigned long f0,
                                       unsigned long f1,
                                       unsigned long f2,
                                       unsigned long f3,
                                       unsigned long *pf0,
                                       unsigned long *pf1,
                                       unsigned long *pf2,
                                       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);
    ...
}

test_negotiate() is referenced in:

static struct smfiDesc smfilter =
{
    "test-milter",
    SMFI_VERSION,
    SMFIF_ADDRCPT | SMFIF_DELRCPT | SMFIF_ADDHDRS | SMFIF_CHGHDRS | SMFIF_CHGBOD
Y | SMFIF_CHGFROM,
    test_connect,
    ...
#if SMFI_VERSION > 5
    test_negotiate,
#endif
};

Which is in turn referenced at the end of the test-milter main program.

    if (smfi_register(smfilter) == MI_FAILURE) {
        fprintf(stderr, "smfi_register failed\n");
        exit(1);
    }
    return (smfi_main());
}

I can lead the horse to the water,. but I cannot force it to drink.

        Wietse

Reply via email to