diff options
Diffstat (limited to 'pmult/pmult.c')
-rw-r--r-- | pmult/pmult.c | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/pmult/pmult.c b/pmult/pmult.c index 2d94a072..e9d7a720 100644 --- a/pmult/pmult.c +++ b/pmult/pmult.c @@ -1303,6 +1303,47 @@ static int gacopyz_to_smst[] = { /* gacopyz_stage_eoh -> */ PM_SMST_DATA }; + +/* Tables of macros defined internally by pmult */ +/* NOTE: Update them wherever you add or remove macros in the handlers + below. + FIXME: Find a way to automate this. */ +static const char *conn_imt[] = { "r", "i", "client_addr", "client_name", + "client_port", NULL }; +static const char *helo_imt[] = { "s", NULL }; +static const char *mail_imt[] = { "f", "ntries", "nrcpts", "nbadrcpts", NULL }; +static const char *rcpt_imt[] = { "nrcpts", "nbadrcpts", "rcpt_host", + "rcpt_addr", NULL }; +#define data_imt NULL +#define eom_imt NULL +#define eoh_imt NULL + +static const char **internal_macro_tab[gacopyz_stage_max] = { + conn_imt, + helo_imt, + mail_imt, + rcpt_imt, + data_imt, + eom_imt, + eoh_imt, +}; + +static int +internal_macro_p (enum gacopyz_stage gstage, const char *macro) +{ + int i; + + for (i = 0; i <= gstage; i++) + if (internal_macro_tab[i]) + { + const char **p; + for (p = internal_macro_tab[i]; *p; p++) + if (strcmp (macro, *p) == 0) + return 1; + } + return 0; +} + /* For each Sendmail macro name from SYMV, find the corresponding MeTA1 macro and register it for use at a given GSTAGE. @@ -1319,7 +1360,10 @@ collect_stage_symbols (enum gacopyz_stage gstage, const char **symv) for (; *symv; ++symv) { int macro; - + + if (internal_macro_p (gstage, *symv)) + continue; + if (i == PM_MAX_MACROS) { PMU_DEBUG2 (pmult_debug, MU_DEBUG_TRACE1, @@ -1328,9 +1372,6 @@ collect_stage_symbols (enum gacopyz_stage gstage, const char **symv) continue; } - if (macro_defined (macrotab[smst], i, macro)) - continue; - if (mu_kwd_xlat_name (macro_trans, *symv, ¯o)) { PMU_DEBUG1 (pmult_debug, MU_DEBUG_TRACE1, @@ -1339,6 +1380,9 @@ collect_stage_symbols (enum gacopyz_stage gstage, const char **symv) continue; } + if (macro_defined (macrotab[smst], i, macro)) + continue; + if (mu_kwd_xlat_tok (macro_trans, macro, (const char**) ¯onames[smst][i])) { |