summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f4900da)
SCCS-vsn: usr.sbin/sendmail/src/main.c 6.54
SCCS-vsn: usr.sbin/sendmail/src/envelope.c 6.30
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 6.37
-static char sccsid[] = "@(#)envelope.c 6.29 (Berkeley) %G%";
+static char sccsid[] = "@(#)envelope.c 6.30 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
#endif /* not lint */
#include "sendmail.h"
-/*
- SuprErrs = TRUE;
-*/
+ if (ConfigLevel < 2)
+ SuprErrs = TRUE;
+
delimchar = internal ? '\0' : ' ';
if (from == NULL ||
parseaddr(from, &e->e_from, 1, delimchar, delimptr, e) == NULL)
delimchar = internal ? '\0' : ' ';
if (from == NULL ||
parseaddr(from, &e->e_from, 1, delimchar, delimptr, e) == NULL)
- rewrite(pvp, 3);
- rewrite(pvp, 1);
- rewrite(pvp, 4);
+ rewrite(pvp, 3, e);
+ rewrite(pvp, 1, e);
+ rewrite(pvp, 4, e);
cataddr(pvp, NULL, buf, sizeof buf, '\0');
e->e_sender = newstr(buf);
define('f', e->e_sender, e);
cataddr(pvp, NULL, buf, sizeof buf, '\0');
e->e_sender = newstr(buf);
define('f', e->e_sender, e);
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 6.53 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 6.54 (Berkeley) %G%";
#endif /* not lint */
#define _DEFINE
#endif /* not lint */
#define _DEFINE
p = q;
while (*p != '\0')
{
p = q;
while (*p != '\0')
{
+ rewrite(pvp, atoi(p), CurEnv);
while (*p != '\0' && *p++ != ',')
continue;
}
while (*p != '\0' && *p++ != ',')
continue;
}
** Do basic system initialization and set the sender
*/
** Do basic system initialization and set the sender
*/
/* make sendmail immune from process group signals */
/* make sendmail immune from process group signals */
+# ifdef _POSIX_JOB_CONTROL
+ (void) setpgid(0, getpid());
+# else
+# ifndef SYSTEM5
(void) setpgrp(0, getpid());
(void) setpgrp(0, getpid());
/* the conditional operations */
'?', CONDIF, '|', CONDELSE, '.', CONDFI,
/* the conditional operations */
'?', CONDIF, '|', CONDELSE, '.', CONDFI,
- /* and finally the hostname lookup characters */
+ /* the hostname lookup characters */
'[', HOSTBEGIN, ']', HOSTEND,
'(', LOOKUPBEGIN, ')', LOOKUPEND,
'[', HOSTBEGIN, ']', HOSTEND,
'(', LOOKUPBEGIN, ')', LOOKUPEND,
+ /* miscellaneous control characters */
+ '&', MACRODEXPAND,
+
-static char sccsid[] = "@(#)parseaddr.c 6.36 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c 6.37 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
#endif /* not lint */
#include "sendmail.h"
** Ruleset 0 does basic parsing. It must resolve.
*/
** Ruleset 0 does basic parsing. It must resolve.
*/
- rewrite(pvp, 3);
- rewrite(pvp, 0);
+ rewrite(pvp, 3, e);
+ rewrite(pvp, 0, e);
/*
** See if we resolved to a real mailer.
/*
** See if we resolved to a real mailer.
c &= 0377;
if (c == MATCHCLASS || c == MATCHREPL || c == MATCHNCLASS)
return (ONE);
c &= 0377;
if (c == MATCHCLASS || c == MATCHREPL || c == MATCHNCLASS)
return (ONE);
+ if (c == MACRODEXPAND)
+ return (ONE);
#ifdef MACVALUE
if (c == MACVALUE)
return (ONE);
#ifdef MACVALUE
if (c == MACVALUE)
return (ONE);
**
** Parameters:
** pvp -- pointer to token vector.
**
** Parameters:
** pvp -- pointer to token vector.
+** ruleset -- the ruleset to use for rewriting.
+** e -- the current envelope.
+rewrite(pvp, ruleset, e)
{
nrw = 0;
_rewrite(pvp, ruleset);
{
nrw = 0;
_rewrite(pvp, ruleset);
int subr; /* subroutine number if >= 0 */
bool dolookup; /* do host aliasing */
char *npvp[MAXATOM+1]; /* temporary space for rebuild */
int subr; /* subroutine number if >= 0 */
bool dolookup; /* do host aliasing */
char *npvp[MAXATOM+1]; /* temporary space for rebuild */
+ extern char *macvalue();
char tokbuf[MAXNAME+1]; /* for concatenated class tokens */
int nloops, nmatches = 0; /* for looping rule checks */
struct rewrite *prev_rwr; /* pointer to previous rewrite rule */
char tokbuf[MAXNAME+1]; /* for concatenated class tokens */
int nloops, nmatches = 0; /* for looping rule checks */
struct rewrite *prev_rwr; /* pointer to previous rewrite rule */
+ case MACRODEXPAND:
+ /*
+ ** Match against run-time macro.
+ ** This algorithm is broken for the
+ ** general case (no recursive macros,
+ ** improper tokenization) but should
+ ** work for the usual cases.
+ */
+
+ ap = macvalue(rp[1], e);
+ mlp->first = avp;
+ if (tTd(21, 2))
+ printf("rewrite: LHS $&%c => \"%s\"\n",
+ rp[1],
+ ap == NULL ? "(NULL)" : ap);
+
+ if (ap == NULL)
+ break;
+ while (*ap != NULL)
+ {
+ if (*avp == NULL ||
+ strncasecmp(ap, *avp, strlen(*avp)) != 0)
+ {
+ /* no match */
+ avp = mlp->first;
+ goto backup;
+ }
+ ap += strlen(*avp++);
+ }
+
+ /* match */
+ break;
+
/*
** We now have a variable length item. It could
** be $+ or $* in which case no special checking
/*
** We now have a variable length item. It could
** be $+ or $* in which case no special checking
if (m->m_r_rwset > 0)
rewrite(tv, m->m_r_rwset);
if (m->m_r_rwset > 0)
rewrite(tv, m->m_r_rwset);
/* save the result for the command line/RCPT argument */
cataddr(tv, NULL, buf, sizeof buf, '\0');
/* save the result for the command line/RCPT argument */
cataddr(tv, NULL, buf, sizeof buf, '\0');
pvp = prescan(name, '\0', pvpbuf, NULL);
if (pvp == NULL)
return (name);
pvp = prescan(name, '\0', pvpbuf, NULL);
if (pvp == NULL)
return (name);
if (adddomain && e->e_fromdomain != NULL)
{
/* append from domain to this address */
if (adddomain && e->e_fromdomain != NULL)
{
/* append from domain to this address */
while ((*pxp++ = *qxq++) != NULL)
continue;
while ((*pxp++ = *qxq++) != NULL)
continue;
if (senderaddress)
else
if (rwset > 0)
if (senderaddress)
else
if (rwset > 0)
+ rewrite(pvp, rwset, e);
/*
** Do any final sanitation the address may require.
/*
** Do any final sanitation the address may require.
** may be used as a default to the above rules.
*/
** may be used as a default to the above rules.
*/
/*
** Now restore the comment information we had at the beginning.
/*
** Now restore the comment information we had at the beginning.
if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET)
return;
if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET)
return;