summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2009-06-17 10:02:21 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2009-06-17 10:02:21 (GMT)
commitf8f65c7e1713e516083bc2ced9794d2b648ad2de (patch) (side-by-side diff)
treee3b5f5783987888287acaf9cb4b1204296a93b9b
parent7b917c501cb998d4e461a147079eb106f4ce75cf (diff)
downloadmailfromd-f8f65c7e1713e516083bc2ced9794d2b648ad2de.tar.gz
mailfromd-f8f65c7e1713e516083bc2ced9794d2b648ad2de.tar.bz2
Bugfixes.
* pies/pies.c (main): Change main loop to do..while, otherwise a signal arriving before entering the loop might cause the program to terminate. * pmult/pmult.c (internal_macro_p): New function. (collect_stage_symbols): Do not report internal macros as untranslatable. * mfd/gram.y (register_macro): Copy macro name to allocated storage.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--mfd/gram.y2
-rw-r--r--pies/pies.c4
-rw-r--r--pmult/pmult.c52
3 files changed, 52 insertions, 6 deletions
diff --git a/mfd/gram.y b/mfd/gram.y
index 812eae3..78ae5d2 100644
--- a/mfd/gram.y
+++ b/mfd/gram.y
@@ -2517,7 +2517,7 @@ register_macro(enum smtp_state state, const char *macro)
}
/* FIXME: MU: 2nd arg should be const? */
if (mu_list_locate(smtp_macro_list[ind], (void*) macro, NULL))
- mu_list_append(smtp_macro_list[ind], (void*) macro);
+ mu_list_append(smtp_macro_list[ind], (void*) strdup (macro));
}
static int
diff --git a/pies/pies.c b/pies/pies.c
index 8948bce..04a5946 100644
--- a/pies/pies.c
+++ b/pies/pies.c
@@ -1519,7 +1519,7 @@ main (int argc, char **argv)
progman_create_sockets ();
progman_start ();
- while (action == ACTION_CONT)
+ do
{
if (!children_cleanup)
pies_pause ();
@@ -1551,6 +1551,8 @@ main (int argc, char **argv)
}
}
}
+ while (action == ACTION_CONT);
+
progman_stop ();
if (action == ACTION_RESTART && argv[0][0] == '/')
diff --git a/pmult/pmult.c b/pmult/pmult.c
index 2d94a07..e9d7a72 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, &macro))
{
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**) &macronames[smst][i]))
{

Return to:

Send suggestions and report system problems to the System administrator.