SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 8.9
-static char sccsid[] = "@(#)parseaddr.c 8.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c 8.9 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
#endif /* not lint */
#include "sendmail.h"
+ /*
+ ** Save addr if we are going to have to.
+ **
+ ** We have to do this early because there is a chance that
+ ** the map lookups in the rewriting rules could clobber
+ ** static memory somewhere.
+ */
+
+ if (bitset(RF_COPYPADDR, flags) && addr != NULL)
+ {
+ char savec = **delimptr;
+
+ if (savec != '\0')
+ **delimptr = '\0';
+ addr = newstr(addr);
+ if (savec != '\0')
+ **delimptr = savec;
+ }
+
/*
** Apply rewriting rules.
** Ruleset 0 does basic parsing. It must resolve.
/*
** Apply rewriting rules.
** Ruleset 0 does basic parsing. It must resolve.
** transport them out.
*/
** transport them out.
*/
- allocaddr(a, flags, addr, *delimptr);
+ allocaddr(a, flags, addr);
if (bitset(QBADADDR, a->q_flags))
return a;
if (bitset(QBADADDR, a->q_flags))
return a;
** flags -- the copy flag (see RF_ definitions in sendmail.h
** for a description).
** paddr -- the printname of the address.
** flags -- the copy flag (see RF_ definitions in sendmail.h
** for a description).
** paddr -- the printname of the address.
-** delimptr -- a pointer to the address delimiter. Must be set.
** Copies portions of a into local buffers as requested.
*/
** Copies portions of a into local buffers as requested.
*/
-allocaddr(a, flags, paddr, delimptr)
+allocaddr(a, flags, paddr)
register ADDRESS *a;
int flags;
char *paddr;
register ADDRESS *a;
int flags;
char *paddr;
{
if (tTd(24, 4))
printf("allocaddr(flags=%o, paddr=%s)\n", flags, paddr);
{
if (tTd(24, 4))
printf("allocaddr(flags=%o, paddr=%s)\n", flags, paddr);
- if (bitset(RF_COPYPADDR, flags) && paddr != NULL)
- {
- char savec = *delimptr;
-
- if (savec != '\0')
- *delimptr = '\0';
- a->q_paddr = newstr(paddr);
- if (savec != '\0')
- *delimptr = savec;
- }
- else
- a->q_paddr = paddr;
if (a->q_user == NULL)
a->q_user = "";
if (a->q_user == NULL)
a->q_user = "";
printaddr(a, FALSE);
}
a1->q_alias = a;
printaddr(a, FALSE);
}
a1->q_alias = a;
- allocaddr(a1, RF_COPYALL, NULL, delimptr);
+ allocaddr(a1, RF_COPYALL, NULL);
(void) recipient(a1, sendq, e);
}
\f/*
(void) recipient(a1, sendq, e);
}
\f/*