Resolve conflicts from sendmail 8.14.1 import
This commit is contained in:
parent
bfe691b2f7
commit
951742c4c0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168520
@ -20,7 +20,7 @@ SM_IDSTR(copyright,
|
|||||||
Copyright (c) 1990, 1993, 1994\n\
|
Copyright (c) 1990, 1993, 1994\n\
|
||||||
The Regents of the University of California. All rights reserved.\n")
|
The Regents of the University of California. All rights reserved.\n")
|
||||||
|
|
||||||
SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.253 2004/11/01 20:42:42 ca Exp $")
|
SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.254 2006/10/12 22:23:45 ca Exp $")
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sm/errstring.h>
|
#include <sm/errstring.h>
|
||||||
@ -177,6 +177,8 @@ const char *hashname __P((char *));
|
|||||||
#endif /* HASHSPOOL */
|
#endif /* HASHSPOOL */
|
||||||
|
|
||||||
|
|
||||||
|
static void sm_exit __P((int));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sm_exit(status)
|
sm_exit(status)
|
||||||
int status;
|
int status;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@
|
|||||||
* the sendmail distribution.
|
* the sendmail distribution.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id: conf.h,v 8.570 2005/12/09 18:37:27 ca Exp $
|
* $Id: conf.h,v 8.574 2006/11/29 00:36:06 ca Exp $
|
||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*
|
*
|
||||||
@ -63,6 +63,11 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#define MAXLINE 2048 /* max line length */
|
#define MAXLINE 2048 /* max line length */
|
||||||
|
#if SASL
|
||||||
|
# define MAXINPLINE 12288 /* max input line length (for AUTH) */
|
||||||
|
#else /* SASL */
|
||||||
|
# define MAXINPLINE MAXLINE /* max input line length */
|
||||||
|
#endif /* SASL */
|
||||||
#define MAXNAME 256 /* max length of a name */
|
#define MAXNAME 256 /* max length of a name */
|
||||||
#ifndef MAXAUTHINFO
|
#ifndef MAXAUTHINFO
|
||||||
# define MAXAUTHINFO 100 /* max length of authinfo token */
|
# define MAXAUTHINFO 100 /* max length of authinfo token */
|
||||||
@ -74,11 +79,7 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */
|
|||||||
#define MAXMXHOSTS 100 /* max # of MX records for one host */
|
#define MAXMXHOSTS 100 /* max # of MX records for one host */
|
||||||
#define SMTPLINELIM 990 /* max SMTP line length */
|
#define SMTPLINELIM 990 /* max SMTP line length */
|
||||||
#define MAXUDBKEY 128 /* max size of a database key (udb only) */
|
#define MAXUDBKEY 128 /* max size of a database key (udb only) */
|
||||||
#if _FFR_MAXKEY
|
#define MAXKEY 1024 /* max size of a database key */
|
||||||
# define MAXKEY 1024 /* max size of a database key */
|
|
||||||
#else /* _FFR_MAXKEY */
|
|
||||||
# define MAXKEY (MAXNAME + 1) /* max size of a database key */
|
|
||||||
#endif /* _FFR_MAXKEY */
|
|
||||||
#define MEMCHUNKSIZE 1024 /* chunk size for memory allocation */
|
#define MEMCHUNKSIZE 1024 /* chunk size for memory allocation */
|
||||||
#define MAXUSERENVIRON 100 /* max envars saved, must be >= 3 */
|
#define MAXUSERENVIRON 100 /* max envars saved, must be >= 3 */
|
||||||
#define MAXMAPSTACK 12 /* max # of stacked or sequenced maps */
|
#define MAXMAPSTACK 12 /* max # of stacked or sequenced maps */
|
||||||
|
@ -9,11 +9,12 @@
|
|||||||
* forth in the LICENSE file which can be found at the top level of
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
* the sendmail distribution.
|
* the sendmail distribution.
|
||||||
*
|
*
|
||||||
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: err.c,v 8.191 2003/01/10 02:16:46 ca Exp $")
|
SM_RCSID("@(#)$Id: err.c,v 8.196 2006/11/10 23:14:08 ca Exp $")
|
||||||
|
|
||||||
#if LDAPMAP
|
#if LDAPMAP
|
||||||
# include <lber.h>
|
# include <lber.h>
|
||||||
@ -109,7 +110,7 @@ fatal_error(exc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
char MsgBuf[BUFSIZ*2]; /* text of most recent message */
|
char MsgBuf[BUFSIZ*2]; /* text of most recent message */
|
||||||
static char HeldMessageBuf[sizeof MsgBuf]; /* for held messages */
|
static char HeldMessageBuf[sizeof(MsgBuf)]; /* for held messages */
|
||||||
|
|
||||||
#if NAMED_BIND && !defined(NO_DATA)
|
#if NAMED_BIND && !defined(NO_DATA)
|
||||||
# define NO_DATA NO_ADDRESS
|
# define NO_DATA NO_ADDRESS
|
||||||
@ -208,7 +209,7 @@ syserr(fmt, va_alist)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
user = ubuf;
|
user = ubuf;
|
||||||
(void) sm_snprintf(ubuf, sizeof ubuf, "UID%d", (int) RealUid);
|
(void) sm_snprintf(ubuf, sizeof(ubuf), "UID%d", (int) RealUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogLevel > 0)
|
if (LogLevel > 0)
|
||||||
@ -320,9 +321,9 @@ usrerr(fmt, va_alist)
|
|||||||
{
|
{
|
||||||
char buf[MAXLINE];
|
char buf[MAXLINE];
|
||||||
|
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Postmaster warning: %.*s",
|
"Postmaster warning: %.*s",
|
||||||
(int) sizeof buf - 22, errtxt);
|
(int) sizeof(buf) - 22, errtxt);
|
||||||
CurEnv->e_message =
|
CurEnv->e_message =
|
||||||
sm_rpool_strdup_x(CurEnv->e_rpool, buf);
|
sm_rpool_strdup_x(CurEnv->e_rpool, buf);
|
||||||
}
|
}
|
||||||
@ -407,9 +408,9 @@ usrerrenh(enhsc, fmt, va_alist)
|
|||||||
{
|
{
|
||||||
char buf[MAXLINE];
|
char buf[MAXLINE];
|
||||||
|
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Postmaster warning: %.*s",
|
"Postmaster warning: %.*s",
|
||||||
(int) sizeof buf - 22, errtxt);
|
(int) sizeof(buf) - 22, errtxt);
|
||||||
CurEnv->e_message =
|
CurEnv->e_message =
|
||||||
sm_rpool_strdup_x(CurEnv->e_rpool, buf);
|
sm_rpool_strdup_x(CurEnv->e_rpool, buf);
|
||||||
}
|
}
|
||||||
@ -528,8 +529,7 @@ nmessage(msg, va_alist)
|
|||||||
case '5':
|
case '5':
|
||||||
if (CurEnv->e_rpool == NULL && CurEnv->e_message != NULL)
|
if (CurEnv->e_rpool == NULL && CurEnv->e_message != NULL)
|
||||||
sm_free(CurEnv->e_message);
|
sm_free(CurEnv->e_message);
|
||||||
CurEnv->e_message =
|
CurEnv->e_message = sm_rpool_strdup_x(CurEnv->e_rpool, errtxt);
|
||||||
sm_rpool_strdup_x(CurEnv->e_rpool, errtxt);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -558,8 +558,9 @@ putoutmsg(msg, holdmsg, heldmsg)
|
|||||||
bool holdmsg;
|
bool holdmsg;
|
||||||
bool heldmsg;
|
bool heldmsg;
|
||||||
{
|
{
|
||||||
char *errtxt = msg;
|
|
||||||
char msgcode = msg[0];
|
char msgcode = msg[0];
|
||||||
|
char *errtxt = msg;
|
||||||
|
char *id;
|
||||||
|
|
||||||
/* display for debugging */
|
/* display for debugging */
|
||||||
if (tTd(54, 8))
|
if (tTd(54, 8))
|
||||||
@ -571,6 +572,7 @@ putoutmsg(msg, holdmsg, heldmsg)
|
|||||||
msg[0] = '5';
|
msg[0] = '5';
|
||||||
else if (msgcode == '8')
|
else if (msgcode == '8')
|
||||||
msg[0] = '4';
|
msg[0] = '4';
|
||||||
|
id = (CurEnv != NULL) ? CurEnv->e_id : NULL;
|
||||||
|
|
||||||
/* output to transcript if serious */
|
/* output to transcript if serious */
|
||||||
if (!heldmsg && CurEnv != NULL && CurEnv->e_xfp != NULL &&
|
if (!heldmsg && CurEnv != NULL && CurEnv->e_xfp != NULL &&
|
||||||
@ -579,7 +581,7 @@ putoutmsg(msg, holdmsg, heldmsg)
|
|||||||
msg);
|
msg);
|
||||||
|
|
||||||
if (LogLevel > 14 && (OpMode == MD_SMTP || OpMode == MD_DAEMON))
|
if (LogLevel > 14 && (OpMode == MD_SMTP || OpMode == MD_DAEMON))
|
||||||
sm_syslog(LOG_INFO, CurEnv->e_id,
|
sm_syslog(LOG_INFO, id,
|
||||||
"--- %s%s%s", msg, holdmsg ? " (hold)" : "",
|
"--- %s%s%s", msg, holdmsg ? " (hold)" : "",
|
||||||
heldmsg ? " (held)" : "");
|
heldmsg ? " (held)" : "");
|
||||||
|
|
||||||
@ -595,7 +597,7 @@ putoutmsg(msg, holdmsg, heldmsg)
|
|||||||
msg[0] = msgcode;
|
msg[0] = msgcode;
|
||||||
if (HeldMessageBuf[0] == '5' && msgcode == '4')
|
if (HeldMessageBuf[0] == '5' && msgcode == '4')
|
||||||
return;
|
return;
|
||||||
(void) sm_strlcpy(HeldMessageBuf, msg, sizeof HeldMessageBuf);
|
(void) sm_strlcpy(HeldMessageBuf, msg, sizeof(HeldMessageBuf));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,7 +652,7 @@ putoutmsg(msg, holdmsg, heldmsg)
|
|||||||
/* can't call syserr, 'cause we are using MsgBuf */
|
/* can't call syserr, 'cause we are using MsgBuf */
|
||||||
HoldErrs = true;
|
HoldErrs = true;
|
||||||
if (LogLevel > 0)
|
if (LogLevel > 0)
|
||||||
sm_syslog(LOG_CRIT, CurEnv->e_id,
|
sm_syslog(LOG_CRIT, id,
|
||||||
"SYSERR: putoutmsg (%s): error on output channel sending \"%s\": %s",
|
"SYSERR: putoutmsg (%s): error on output channel sending \"%s\": %s",
|
||||||
CURHOSTNAME,
|
CURHOSTNAME,
|
||||||
shortenstring(msg, MAXSHORTSTR), sm_errstring(errno));
|
shortenstring(msg, MAXSHORTSTR), sm_errstring(errno));
|
||||||
@ -823,7 +825,7 @@ fmtmsg(eb, to, num, enhsc, eno, fmt, ap)
|
|||||||
{
|
{
|
||||||
char del;
|
char del;
|
||||||
int l;
|
int l;
|
||||||
int spaceleft = sizeof MsgBuf;
|
int spaceleft = sizeof(MsgBuf);
|
||||||
char *errtxt;
|
char *errtxt;
|
||||||
|
|
||||||
/* output the reply code */
|
/* output the reply code */
|
||||||
@ -836,15 +838,13 @@ fmtmsg(eb, to, num, enhsc, eno, fmt, ap)
|
|||||||
del = '-';
|
del = '-';
|
||||||
else
|
else
|
||||||
del = ' ';
|
del = ' ';
|
||||||
#if _FFR_SOFT_BOUNCE
|
|
||||||
if (SoftBounce && num[0] == '5')
|
if (SoftBounce && num[0] == '5')
|
||||||
{
|
{
|
||||||
/* replace 5 by 4 */
|
/* replace 5 by 4 */
|
||||||
(void) sm_snprintf(eb, spaceleft, "4%2.2s%c", num + 1, del);
|
(void) sm_snprintf(eb, spaceleft, "4%2.2s%c", num + 1, del);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* _FFR_SOFT_BOUNCE */
|
(void) sm_snprintf(eb, spaceleft, "%3.3s%c", num, del);
|
||||||
(void) sm_snprintf(eb, spaceleft, "%3.3s%c", num, del);
|
|
||||||
eb += 4;
|
eb += 4;
|
||||||
spaceleft -= 4;
|
spaceleft -= 4;
|
||||||
|
|
||||||
@ -866,13 +866,11 @@ fmtmsg(eb, to, num, enhsc, eno, fmt, ap)
|
|||||||
eb += l;
|
eb += l;
|
||||||
spaceleft -= l;
|
spaceleft -= l;
|
||||||
}
|
}
|
||||||
#if _FFR_SOFT_BOUNCE
|
|
||||||
if (SoftBounce && eb[-l] == '5')
|
if (SoftBounce && eb[-l] == '5')
|
||||||
{
|
{
|
||||||
/* replace 5 by 4 */
|
/* replace 5 by 4 */
|
||||||
eb[-l] = '4';
|
eb[-l] = '4';
|
||||||
}
|
}
|
||||||
#endif /* _FFR_SOFT_BOUNCE */
|
|
||||||
errtxt = eb;
|
errtxt = eb;
|
||||||
|
|
||||||
/* output the file name and line number */
|
/* output the file name and line number */
|
||||||
@ -1006,7 +1004,7 @@ sm_errstring(errnum)
|
|||||||
err = strerror(errnum);
|
err = strerror(errnum);
|
||||||
if (err == NULL)
|
if (err == NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(errbuf, sizeof errbuf,
|
(void) sm_snprintf(errbuf, sizeof(errbuf),
|
||||||
"Error %d", errnum);
|
"Error %d", errnum);
|
||||||
err = errbuf;
|
err = errbuf;
|
||||||
}
|
}
|
||||||
@ -1050,14 +1048,14 @@ sm_errstring(errnum)
|
|||||||
case EHOSTDOWN:
|
case EHOSTDOWN:
|
||||||
if (CurHostName == NULL)
|
if (CurHostName == NULL)
|
||||||
break;
|
break;
|
||||||
(void) sm_snprintf(buf, sizeof buf, "Host %s is down",
|
(void) sm_snprintf(buf, sizeof(buf), "Host %s is down",
|
||||||
shortenstring(CurHostName, MAXSHORTSTR));
|
shortenstring(CurHostName, MAXSHORTSTR));
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
case ECONNREFUSED:
|
case ECONNREFUSED:
|
||||||
if (CurHostName == NULL)
|
if (CurHostName == NULL)
|
||||||
break;
|
break;
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2, "Connection refused by ",
|
(void) sm_strlcpyn(buf, sizeof(buf), 2, "Connection refused by ",
|
||||||
shortenstring(CurHostName, MAXSHORTSTR));
|
shortenstring(CurHostName, MAXSHORTSTR));
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
@ -1127,7 +1125,7 @@ sm_errstring(errnum)
|
|||||||
if (dnsmsg != NULL)
|
if (dnsmsg != NULL)
|
||||||
{
|
{
|
||||||
bp = buf;
|
bp = buf;
|
||||||
bp += sm_strlcpy(bp, "Name server: ", sizeof buf);
|
bp += sm_strlcpy(bp, "Name server: ", sizeof(buf));
|
||||||
if (CurHostName != NULL)
|
if (CurHostName != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_strlcpyn(bp, SPACELEFT(buf, bp), 2,
|
(void) sm_strlcpyn(bp, SPACELEFT(buf, bp), 2,
|
||||||
@ -1147,7 +1145,7 @@ sm_errstring(errnum)
|
|||||||
err = strerror(errnum);
|
err = strerror(errnum);
|
||||||
if (err == NULL)
|
if (err == NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf, "Error %d", errnum);
|
(void) sm_snprintf(buf, sizeof(buf), "Error %d", errnum);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
@ -1155,7 +1153,7 @@ sm_errstring(errnum)
|
|||||||
if (errnum > 0 && errnum < sys_nerr)
|
if (errnum > 0 && errnum < sys_nerr)
|
||||||
return sys_errlist[errnum];
|
return sys_errlist[errnum];
|
||||||
|
|
||||||
(void) sm_snprintf(buf, sizeof buf, "Error %d", errnum);
|
(void) sm_snprintf(buf, sizeof(buf), "Error %d", errnum);
|
||||||
return buf;
|
return buf;
|
||||||
#endif /* HASSTRERROR */
|
#endif /* HASSTRERROR */
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2004, 2006 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2004, 2006, 2007 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
@ -13,10 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
#include <sm/sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: headers.c,v 8.291 2006/03/24 01:01:56 ca Exp $")
|
SM_RCSID("@(#)$Id: headers.c,v 8.310 2007/02/07 22:44:35 ca Exp $")
|
||||||
|
|
||||||
static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *));
|
static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *, bool));
|
||||||
static size_t fix_mime_header __P((HDR *, ENVELOPE *));
|
static size_t fix_mime_header __P((HDR *, ENVELOPE *));
|
||||||
static int priencode __P((char *));
|
static int priencode __P((char *));
|
||||||
static bool put_vanilla_header __P((HDR *, char *, MCI *));
|
static bool put_vanilla_header __P((HDR *, char *, MCI *));
|
||||||
@ -44,10 +45,11 @@ setupheaders()
|
|||||||
s->s_header.hi_ruleset = NULL;
|
s->s_header.hi_ruleset = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CHOMPHEADER -- process and save a header line.
|
** DOCHOMPHEADER -- process and save a header line.
|
||||||
**
|
**
|
||||||
** Called by collect, readcf, and readqf to deal with header lines.
|
** Called by chompheader.
|
||||||
**
|
**
|
||||||
** Parameters:
|
** Parameters:
|
||||||
** line -- header as a text line.
|
** line -- header as a text line.
|
||||||
@ -64,13 +66,14 @@ setupheaders()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static struct hdrinfo NormalHeader = { NULL, 0, NULL };
|
static struct hdrinfo NormalHeader = { NULL, 0, NULL };
|
||||||
|
static unsigned long dochompheader __P((char *, int, HDR **, ENVELOPE *));
|
||||||
|
|
||||||
unsigned long
|
static unsigned long
|
||||||
chompheader(line, pflag, hdrp, e)
|
dochompheader(line, pflag, hdrp, e)
|
||||||
char *line;
|
char *line;
|
||||||
int pflag;
|
int pflag;
|
||||||
HDR **hdrp;
|
HDR **hdrp;
|
||||||
register ENVELOPE *e;
|
ENVELOPE *e;
|
||||||
{
|
{
|
||||||
unsigned char mid = '\0';
|
unsigned char mid = '\0';
|
||||||
register char *p;
|
register char *p;
|
||||||
@ -86,13 +89,6 @@ chompheader(line, pflag, hdrp, e)
|
|||||||
bool nullheader = false;
|
bool nullheader = false;
|
||||||
BITMAP256 mopts;
|
BITMAP256 mopts;
|
||||||
|
|
||||||
if (tTd(31, 6))
|
|
||||||
{
|
|
||||||
sm_dprintf("chompheader: ");
|
|
||||||
xputs(sm_debug_file(), line);
|
|
||||||
sm_dprintf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
headeronly = hdrp != NULL;
|
headeronly = hdrp != NULL;
|
||||||
if (!headeronly)
|
if (!headeronly)
|
||||||
hdrp = &e->e_header;
|
hdrp = &e->e_header;
|
||||||
@ -188,10 +184,6 @@ chompheader(line, pflag, hdrp, e)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*fvalue = '\0';
|
*fvalue = '\0';
|
||||||
|
|
||||||
/* strip field value on front */
|
|
||||||
if (*p == ' ')
|
|
||||||
p++;
|
|
||||||
fvalue = p;
|
fvalue = p;
|
||||||
|
|
||||||
/* if the field is null, go ahead and use the default */
|
/* if the field is null, go ahead and use the default */
|
||||||
@ -209,7 +201,7 @@ chompheader(line, pflag, hdrp, e)
|
|||||||
{
|
{
|
||||||
char hbuf[50];
|
char hbuf[50];
|
||||||
|
|
||||||
(void) expand(fvalue, hbuf, sizeof hbuf, e);
|
(void) expand(fvalue, hbuf, sizeof(hbuf), e);
|
||||||
for (p = hbuf; isascii(*p) && isspace(*p); )
|
for (p = hbuf; isascii(*p) && isspace(*p); )
|
||||||
p++;
|
p++;
|
||||||
if ((*p++ & 0377) == CALLSUBR)
|
if ((*p++ & 0377) == CALLSUBR)
|
||||||
@ -357,9 +349,8 @@ chompheader(line, pflag, hdrp, e)
|
|||||||
macdefine(&e->e_macro, A_TEMP,
|
macdefine(&e->e_macro, A_TEMP,
|
||||||
macid("{hdr_name}"), fname);
|
macid("{hdr_name}"), fname);
|
||||||
|
|
||||||
(void) sm_snprintf(qval, sizeof qval, "%d", k);
|
(void) sm_snprintf(qval, sizeof(qval), "%d", k);
|
||||||
macdefine(&e->e_macro, A_TEMP, macid("{hdrlen}"), qval);
|
macdefine(&e->e_macro, A_TEMP, macid("{hdrlen}"), qval);
|
||||||
#if _FFR_HDR_TYPE
|
|
||||||
if (bitset(H_FROM, hi->hi_flags))
|
if (bitset(H_FROM, hi->hi_flags))
|
||||||
macdefine(&e->e_macro, A_PERM,
|
macdefine(&e->e_macro, A_PERM,
|
||||||
macid("{addr_type}"), "h s");
|
macid("{addr_type}"), "h s");
|
||||||
@ -367,11 +358,10 @@ chompheader(line, pflag, hdrp, e)
|
|||||||
macdefine(&e->e_macro, A_PERM,
|
macdefine(&e->e_macro, A_PERM,
|
||||||
macid("{addr_type}"), "h r");
|
macid("{addr_type}"), "h r");
|
||||||
else
|
else
|
||||||
#endif /* _FFR_HDR_TYPE */
|
|
||||||
macdefine(&e->e_macro, A_PERM,
|
macdefine(&e->e_macro, A_PERM,
|
||||||
macid("{addr_type}"), "h");
|
macid("{addr_type}"), "h");
|
||||||
(void) rscheck(rs, fvalue, NULL, e, rscheckflags, 3,
|
(void) rscheck(rs, fvalue, NULL, e, rscheckflags, 3,
|
||||||
NULL, e->e_id);
|
NULL, e->e_id, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,18 +414,18 @@ chompheader(line, pflag, hdrp, e)
|
|||||||
{
|
{
|
||||||
/* copy conditions from default case */
|
/* copy conditions from default case */
|
||||||
memmove((char *) mopts, (char *) h->h_mflags,
|
memmove((char *) mopts, (char *) h->h_mflags,
|
||||||
sizeof mopts);
|
sizeof(mopts));
|
||||||
}
|
}
|
||||||
h->h_macro = mid;
|
h->h_macro = mid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new node */
|
/* create a new node */
|
||||||
h = (HDR *) sm_rpool_malloc_x(e->e_rpool, sizeof *h);
|
h = (HDR *) sm_rpool_malloc_x(e->e_rpool, sizeof(*h));
|
||||||
h->h_field = sm_rpool_strdup_x(e->e_rpool, fname);
|
h->h_field = sm_rpool_strdup_x(e->e_rpool, fname);
|
||||||
h->h_value = sm_rpool_strdup_x(e->e_rpool, fvalue);
|
h->h_value = sm_rpool_strdup_x(e->e_rpool, fvalue);
|
||||||
h->h_link = NULL;
|
h->h_link = NULL;
|
||||||
memmove((char *) h->h_mflags, (char *) mopts, sizeof mopts);
|
memmove((char *) h->h_mflags, (char *) mopts, sizeof(mopts));
|
||||||
h->h_macro = mid;
|
h->h_macro = mid;
|
||||||
*hp = h;
|
*hp = h;
|
||||||
h->h_flags = hi->hi_flags;
|
h->h_flags = hi->hi_flags;
|
||||||
@ -461,25 +451,97 @@ chompheader(line, pflag, hdrp, e)
|
|||||||
|
|
||||||
return h->h_flags;
|
return h->h_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CHOMPHEADER -- process and save a header line.
|
||||||
|
**
|
||||||
|
** Called by collect, readcf, and readqf to deal with header lines.
|
||||||
|
** This is just a wrapper for dochompheader().
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** line -- header as a text line.
|
||||||
|
** pflag -- flags for chompheader() (from sendmail.h)
|
||||||
|
** hdrp -- a pointer to the place to save the header.
|
||||||
|
** e -- the envelope including this header.
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** flags for this header.
|
||||||
|
**
|
||||||
|
** Side Effects:
|
||||||
|
** The header is saved on the header list.
|
||||||
|
** Contents of 'line' are destroyed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
unsigned long
|
||||||
|
chompheader(line, pflag, hdrp, e)
|
||||||
|
char *line;
|
||||||
|
int pflag;
|
||||||
|
HDR **hdrp;
|
||||||
|
register ENVELOPE *e;
|
||||||
|
{
|
||||||
|
unsigned long rval;
|
||||||
|
|
||||||
|
if (tTd(31, 6))
|
||||||
|
{
|
||||||
|
sm_dprintf("chompheader: ");
|
||||||
|
xputs(sm_debug_file(), line);
|
||||||
|
sm_dprintf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* quote this if user (not config file) input */
|
||||||
|
if (bitset(pflag, CHHDR_USER))
|
||||||
|
{
|
||||||
|
char xbuf[MAXLINE];
|
||||||
|
char *xbp = NULL;
|
||||||
|
int xbufs;
|
||||||
|
|
||||||
|
xbufs = sizeof(xbuf);
|
||||||
|
xbp = quote_internal_chars(line, xbuf, &xbufs);
|
||||||
|
if (tTd(31, 7))
|
||||||
|
{
|
||||||
|
sm_dprintf("chompheader: quoted: ");
|
||||||
|
xputs(sm_debug_file(), xbp);
|
||||||
|
sm_dprintf("\n");
|
||||||
|
}
|
||||||
|
rval = dochompheader(xbp, pflag, hdrp, e);
|
||||||
|
if (xbp != xbuf)
|
||||||
|
sm_free(xbp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rval = dochompheader(line, pflag, hdrp, e);
|
||||||
|
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** ALLOCHEADER -- allocate a header entry
|
** ALLOCHEADER -- allocate a header entry
|
||||||
**
|
**
|
||||||
** Parameters:
|
** Parameters:
|
||||||
** field -- the name of the header field.
|
** field -- the name of the header field (will not be copied).
|
||||||
** value -- the value of the field.
|
** value -- the value of the field (will be copied).
|
||||||
** flags -- flags to add to h_flags.
|
** flags -- flags to add to h_flags.
|
||||||
** rp -- resource pool for allocations
|
** rp -- resource pool for allocations
|
||||||
|
** space -- add leading space?
|
||||||
**
|
**
|
||||||
** Returns:
|
** Returns:
|
||||||
** Pointer to a newly allocated and populated HDR.
|
** Pointer to a newly allocated and populated HDR.
|
||||||
|
**
|
||||||
|
** Notes:
|
||||||
|
** o field and value must be in internal format, i.e.,
|
||||||
|
** metacharacters must be "quoted", see quote_internal_chars().
|
||||||
|
** o maybe add more flags to decide:
|
||||||
|
** - what to copy (field/value)
|
||||||
|
** - whether to convert value to an internal format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static HDR *
|
static HDR *
|
||||||
allocheader(field, value, flags, rp)
|
allocheader(field, value, flags, rp, space)
|
||||||
char *field;
|
char *field;
|
||||||
char *value;
|
char *value;
|
||||||
int flags;
|
int flags;
|
||||||
SM_RPOOL_T *rp;
|
SM_RPOOL_T *rp;
|
||||||
|
bool space;
|
||||||
{
|
{
|
||||||
HDR *h;
|
HDR *h;
|
||||||
STAB *s;
|
STAB *s;
|
||||||
@ -488,9 +550,23 @@ allocheader(field, value, flags, rp)
|
|||||||
s = stab(field, ST_HEADER, ST_FIND);
|
s = stab(field, ST_HEADER, ST_FIND);
|
||||||
|
|
||||||
/* allocate space for new header */
|
/* allocate space for new header */
|
||||||
h = (HDR *) sm_rpool_malloc_x(rp, sizeof *h);
|
h = (HDR *) sm_rpool_malloc_x(rp, sizeof(*h));
|
||||||
h->h_field = field;
|
h->h_field = field;
|
||||||
h->h_value = sm_rpool_strdup_x(rp, value);
|
if (space)
|
||||||
|
{
|
||||||
|
size_t l;
|
||||||
|
char *n;
|
||||||
|
|
||||||
|
l = strlen(value);
|
||||||
|
SM_ASSERT(l + 2 > l);
|
||||||
|
n = sm_rpool_malloc_x(rp, l + 2);
|
||||||
|
n[0] = ' ';
|
||||||
|
n[1] = '\0';
|
||||||
|
sm_strlcpy(n + 1, value, l + 1);
|
||||||
|
h->h_value = n;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
h->h_value = sm_rpool_strdup_x(rp, value);
|
||||||
h->h_flags = flags;
|
h->h_flags = flags;
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
h->h_flags |= s->s_header.hi_flags;
|
h->h_flags |= s->s_header.hi_flags;
|
||||||
@ -499,30 +575,36 @@ allocheader(field, value, flags, rp)
|
|||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** ADDHEADER -- add a header entry to the end of the queue.
|
** ADDHEADER -- add a header entry to the end of the queue.
|
||||||
**
|
**
|
||||||
** This bypasses the special checking of chompheader.
|
** This bypasses the special checking of chompheader.
|
||||||
**
|
**
|
||||||
** Parameters:
|
** Parameters:
|
||||||
** field -- the name of the header field.
|
** field -- the name of the header field (will not be copied).
|
||||||
** value -- the value of the field.
|
** value -- the value of the field (will be copied).
|
||||||
** flags -- flags to add to h_flags.
|
** flags -- flags to add to h_flags.
|
||||||
** e -- envelope.
|
** e -- envelope.
|
||||||
|
** space -- add leading space?
|
||||||
**
|
**
|
||||||
** Returns:
|
** Returns:
|
||||||
** none.
|
** none.
|
||||||
**
|
**
|
||||||
** Side Effects:
|
** Side Effects:
|
||||||
** adds the field on the list of headers for this envelope.
|
** adds the field on the list of headers for this envelope.
|
||||||
|
**
|
||||||
|
** Notes: field and value must be in internal format, i.e.,
|
||||||
|
** metacharacters must be "quoted", see quote_internal_chars().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
addheader(field, value, flags, e)
|
addheader(field, value, flags, e, space)
|
||||||
char *field;
|
char *field;
|
||||||
char *value;
|
char *value;
|
||||||
int flags;
|
int flags;
|
||||||
ENVELOPE *e;
|
ENVELOPE *e;
|
||||||
|
bool space;
|
||||||
{
|
{
|
||||||
register HDR *h;
|
register HDR *h;
|
||||||
HDR **hp;
|
HDR **hp;
|
||||||
@ -536,41 +618,51 @@ addheader(field, value, flags, e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate space for new header */
|
/* allocate space for new header */
|
||||||
h = allocheader(field, value, flags, e->e_rpool);
|
h = allocheader(field, value, flags, e->e_rpool, space);
|
||||||
h->h_link = *hp;
|
h->h_link = *hp;
|
||||||
*hp = h;
|
*hp = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** INSHEADER -- insert a header entry at the specified index
|
** INSHEADER -- insert a header entry at the specified index
|
||||||
**
|
|
||||||
** This bypasses the special checking of chompheader.
|
** This bypasses the special checking of chompheader.
|
||||||
**
|
**
|
||||||
** Parameters:
|
** Parameters:
|
||||||
** idx -- index into the header list at which to insert
|
** idx -- index into the header list at which to insert
|
||||||
** field -- the name of the header field.
|
** field -- the name of the header field (will be copied).
|
||||||
** value -- the value of the field.
|
** value -- the value of the field (will be copied).
|
||||||
** flags -- flags to add to h_flags.
|
** flags -- flags to add to h_flags.
|
||||||
** e -- envelope.
|
** e -- envelope.
|
||||||
|
** space -- add leading space?
|
||||||
**
|
**
|
||||||
** Returns:
|
** Returns:
|
||||||
** none.
|
** none.
|
||||||
**
|
**
|
||||||
** Side Effects:
|
** Side Effects:
|
||||||
** inserts the field on the list of headers for this envelope.
|
** inserts the field on the list of headers for this envelope.
|
||||||
|
**
|
||||||
|
** Notes:
|
||||||
|
** - field and value must be in internal format, i.e.,
|
||||||
|
** metacharacters must be "quoted", see quote_internal_chars().
|
||||||
|
** - the header list contains headers that might not be
|
||||||
|
** sent "out" (see putheader(): "skip"), hence there is no
|
||||||
|
** reliable way to insert a header at an exact position
|
||||||
|
** (except at the front or end).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
insheader(idx, field, value, flags, e)
|
insheader(idx, field, value, flags, e, space)
|
||||||
int idx;
|
int idx;
|
||||||
char *field;
|
char *field;
|
||||||
char *value;
|
char *value;
|
||||||
int flags;
|
int flags;
|
||||||
ENVELOPE *e;
|
ENVELOPE *e;
|
||||||
|
bool space;
|
||||||
{
|
{
|
||||||
HDR *h, *srch, *last = NULL;
|
HDR *h, *srch, *last = NULL;
|
||||||
|
|
||||||
/* allocate space for new header */
|
/* allocate space for new header */
|
||||||
h = allocheader(field, value, flags, e->e_rpool);
|
h = allocheader(field, value, flags, e->e_rpool, space);
|
||||||
|
|
||||||
/* find insertion position */
|
/* find insertion position */
|
||||||
for (srch = e->e_header; srch != NULL && idx > 0;
|
for (srch = e->e_header; srch != NULL && idx > 0;
|
||||||
@ -594,6 +686,7 @@ insheader(idx, field, value, flags, e)
|
|||||||
srch->h_link = h;
|
srch->h_link = h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** HVALUE -- return value of a header.
|
** HVALUE -- return value of a header.
|
||||||
**
|
**
|
||||||
@ -605,7 +698,7 @@ insheader(idx, field, value, flags, e)
|
|||||||
** header -- the header list.
|
** header -- the header list.
|
||||||
**
|
**
|
||||||
** Returns:
|
** Returns:
|
||||||
** pointer to the value part.
|
** pointer to the value part (internal format).
|
||||||
** NULL if not found.
|
** NULL if not found.
|
||||||
**
|
**
|
||||||
** Side Effects:
|
** Side Effects:
|
||||||
@ -627,6 +720,7 @@ hvalue(field, header)
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** ISHEADER -- predicate telling if argument is a header.
|
** ISHEADER -- predicate telling if argument is a header.
|
||||||
**
|
**
|
||||||
@ -654,8 +748,9 @@ bool
|
|||||||
isheader(h)
|
isheader(h)
|
||||||
char *h;
|
char *h;
|
||||||
{
|
{
|
||||||
register char *s = h;
|
char *s;
|
||||||
|
|
||||||
|
s = h;
|
||||||
if (s[0] == '-' && s[1] == '-')
|
if (s[0] == '-' && s[1] == '-')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -671,6 +766,7 @@ isheader(h)
|
|||||||
|
|
||||||
return (*s == ':');
|
return (*s == ':');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** EATHEADER -- run through the stored header and extract info.
|
** EATHEADER -- run through the stored header and extract info.
|
||||||
**
|
**
|
||||||
@ -735,7 +831,7 @@ eatheader(e, full, log)
|
|||||||
for (h = e->e_header; h != NULL; h = h->h_link)
|
for (h = e->e_header; h != NULL; h = h->h_link)
|
||||||
{
|
{
|
||||||
if (tTd(32, 1))
|
if (tTd(32, 1))
|
||||||
sm_dprintf("%s: ", h->h_field);
|
sm_dprintf("%s:", h->h_field);
|
||||||
if (h->h_value == NULL)
|
if (h->h_value == NULL)
|
||||||
{
|
{
|
||||||
if (tTd(32, 1))
|
if (tTd(32, 1))
|
||||||
@ -753,12 +849,13 @@ eatheader(e, full, log)
|
|||||||
xputs(sm_debug_file(), h->h_value);
|
xputs(sm_debug_file(), h->h_value);
|
||||||
sm_dprintf(") ");
|
sm_dprintf(") ");
|
||||||
}
|
}
|
||||||
expand(h->h_value, buf, sizeof buf, e);
|
expand(h->h_value, buf, sizeof(buf), e);
|
||||||
if (buf[0] != '\0')
|
if (buf[0] != '\0' &&
|
||||||
|
(buf[0] != ' ' || buf[1] != '\0'))
|
||||||
{
|
{
|
||||||
if (bitset(H_FROM, h->h_flags))
|
if (bitset(H_FROM, h->h_flags))
|
||||||
expand(crackaddr(buf, e),
|
expand(crackaddr(buf, e),
|
||||||
buf, sizeof buf, e);
|
buf, sizeof(buf), e);
|
||||||
h->h_value = sm_rpool_strdup_x(e->e_rpool, buf);
|
h->h_value = sm_rpool_strdup_x(e->e_rpool, buf);
|
||||||
h->h_flags &= ~H_DEFAULT;
|
h->h_flags &= ~H_DEFAULT;
|
||||||
}
|
}
|
||||||
@ -822,7 +919,7 @@ eatheader(e, full, log)
|
|||||||
if (hopcnt > e->e_hopcount)
|
if (hopcnt > e->e_hopcount)
|
||||||
{
|
{
|
||||||
e->e_hopcount = hopcnt;
|
e->e_hopcount = hopcnt;
|
||||||
(void) sm_snprintf(buf, sizeof buf, "%d", e->e_hopcount);
|
(void) sm_snprintf(buf, sizeof(buf), "%d", e->e_hopcount);
|
||||||
macdefine(&e->e_macro, A_TEMP, 'c', buf);
|
macdefine(&e->e_macro, A_TEMP, 'c', buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,7 +950,7 @@ eatheader(e, full, log)
|
|||||||
/* tokenize header */
|
/* tokenize header */
|
||||||
oldsupr = SuprErrs;
|
oldsupr = SuprErrs;
|
||||||
SuprErrs = true;
|
SuprErrs = true;
|
||||||
pvp = prescan(p, '\0', pvpbuf, sizeof pvpbuf, NULL,
|
pvp = prescan(p, '\0', pvpbuf, sizeof(pvpbuf), NULL,
|
||||||
MimeTokenTab, false);
|
MimeTokenTab, false);
|
||||||
SuprErrs = oldsupr;
|
SuprErrs = oldsupr;
|
||||||
|
|
||||||
@ -975,6 +1072,7 @@ eatheader(e, full, log)
|
|||||||
e->e_flags &= ~EF_LOGSENDER;
|
e->e_flags &= ~EF_LOGSENDER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** LOGSENDER -- log sender information
|
** LOGSENDER -- log sender information
|
||||||
**
|
**
|
||||||
@ -1005,8 +1103,8 @@ logsender(e, msgid)
|
|||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
l = strlen(msgid);
|
l = strlen(msgid);
|
||||||
if (l > sizeof mbuf - 1)
|
if (l > sizeof(mbuf) - 1)
|
||||||
l = sizeof mbuf - 1;
|
l = sizeof(mbuf) - 1;
|
||||||
memmove(mbuf, msgid, l);
|
memmove(mbuf, msgid, l);
|
||||||
mbuf[l] = '\0';
|
mbuf[l] = '\0';
|
||||||
p = mbuf;
|
p = mbuf;
|
||||||
@ -1026,7 +1124,7 @@ logsender(e, msgid)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = hbuf;
|
name = hbuf;
|
||||||
(void) sm_snprintf(hbuf, sizeof hbuf, "%.80s", RealHostName);
|
(void) sm_snprintf(hbuf, sizeof(hbuf), "%.80s", RealHostName);
|
||||||
if (RealHostAddr.sa.sa_family != 0)
|
if (RealHostAddr.sa.sa_family != 0)
|
||||||
{
|
{
|
||||||
p = &hbuf[strlen(hbuf)];
|
p = &hbuf[strlen(hbuf)];
|
||||||
@ -1105,6 +1203,7 @@ logsender(e, msgid)
|
|||||||
"%.400srelay=%s", sbuf, name);
|
"%.400srelay=%s", sbuf, name);
|
||||||
#endif /* (SYSLOG_BUFSIZE) >= 256 */
|
#endif /* (SYSLOG_BUFSIZE) >= 256 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** PRIENCODE -- encode external priority names into internal values.
|
** PRIENCODE -- encode external priority names into internal values.
|
||||||
**
|
**
|
||||||
@ -1133,6 +1232,7 @@ priencode(p)
|
|||||||
/* unknown priority */
|
/* unknown priority */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CRACKADDR -- parse an address and turn it into a macro
|
** CRACKADDR -- parse an address and turn it into a macro
|
||||||
**
|
**
|
||||||
@ -1215,17 +1315,22 @@ crackaddr(addr, e)
|
|||||||
if (tTd(33, 1))
|
if (tTd(33, 1))
|
||||||
sm_dprintf("crackaddr(%s)\n", addr);
|
sm_dprintf("crackaddr(%s)\n", addr);
|
||||||
|
|
||||||
/* strip leading spaces */
|
buflim = bufend = &buf[sizeof(buf) - 1];
|
||||||
|
bp = bufhead = buf;
|
||||||
|
|
||||||
|
/* skip over leading spaces but preserve them */
|
||||||
while (*addr != '\0' && isascii(*addr) && isspace(*addr))
|
while (*addr != '\0' && isascii(*addr) && isspace(*addr))
|
||||||
|
{
|
||||||
|
SM_APPEND_CHAR(*addr);
|
||||||
addr++;
|
addr++;
|
||||||
|
}
|
||||||
|
bufhead = bp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Start by assuming we have no angle brackets. This will be
|
** Start by assuming we have no angle brackets. This will be
|
||||||
** adjusted later if we find them.
|
** adjusted later if we find them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
buflim = bufend = &buf[sizeof(buf) - 1];
|
|
||||||
bp = bufhead = buf;
|
|
||||||
p = addrhead = addr;
|
p = addrhead = addr;
|
||||||
copylev = anglelev = cmtlev = realcmtlev = 0;
|
copylev = anglelev = cmtlev = realcmtlev = 0;
|
||||||
bracklev = 0;
|
bracklev = 0;
|
||||||
@ -1533,6 +1638,7 @@ crackaddr(addr, e)
|
|||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** PUTHEADER -- put the header part of a message from the in-core copy
|
** PUTHEADER -- put the header part of a message from the in-core copy
|
||||||
**
|
**
|
||||||
@ -1580,7 +1686,7 @@ putheader(mci, hdr, e, flags)
|
|||||||
|
|
||||||
if (tTd(34, 11))
|
if (tTd(34, 11))
|
||||||
{
|
{
|
||||||
sm_dprintf(" %s: ", h->h_field);
|
sm_dprintf(" %s:", h->h_field);
|
||||||
xputs(sm_debug_file(), p);
|
xputs(sm_debug_file(), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1721,7 +1827,7 @@ putheader(mci, hdr, e, flags)
|
|||||||
if (bitset(H_DEFAULT, h->h_flags) ||
|
if (bitset(H_DEFAULT, h->h_flags) ||
|
||||||
bitset(H_BINDLATE, h->h_flags))
|
bitset(H_BINDLATE, h->h_flags))
|
||||||
{
|
{
|
||||||
expand(p, buf, sizeof buf, e);
|
expand(p, buf, sizeof(buf), e);
|
||||||
p = buf;
|
p = buf;
|
||||||
if (*p == '\0')
|
if (*p == '\0')
|
||||||
{
|
{
|
||||||
@ -1742,7 +1848,7 @@ putheader(mci, hdr, e, flags)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* no other recipient headers: truncate value */
|
/* no other recipient headers: truncate value */
|
||||||
(void) sm_strlcpyn(obuf, sizeof obuf, 2,
|
(void) sm_strlcpyn(obuf, sizeof(obuf), 2,
|
||||||
h->h_field, ":");
|
h->h_field, ":");
|
||||||
if (!putline(obuf, mci))
|
if (!putline(obuf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
@ -1786,7 +1892,7 @@ putheader(mci, hdr, e, flags)
|
|||||||
goto writeerr;
|
goto writeerr;
|
||||||
if (hvalue("Content-Type", e->e_header) == NULL)
|
if (hvalue("Content-Type", e->e_header) == NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(obuf, sizeof obuf,
|
(void) sm_snprintf(obuf, sizeof(obuf),
|
||||||
"Content-Type: text/plain; charset=%s",
|
"Content-Type: text/plain; charset=%s",
|
||||||
defcharset(e));
|
defcharset(e));
|
||||||
if (!putline(obuf, mci))
|
if (!putline(obuf, mci))
|
||||||
@ -1802,6 +1908,7 @@ putheader(mci, hdr, e, flags)
|
|||||||
writeerr:
|
writeerr:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** PUT_VANILLA_HEADER -- output a fairly ordinary header
|
** PUT_VANILLA_HEADER -- output a fairly ordinary header
|
||||||
**
|
**
|
||||||
@ -1825,10 +1932,10 @@ put_vanilla_header(h, v, mci)
|
|||||||
int putflags;
|
int putflags;
|
||||||
char obuf[MAXLINE + 256]; /* additional length for h_field */
|
char obuf[MAXLINE + 256]; /* additional length for h_field */
|
||||||
|
|
||||||
putflags = PXLF_HEADER;
|
putflags = PXLF_HEADER | PXLF_STRIPMQUOTE;
|
||||||
if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
|
if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
|
||||||
putflags |= PXLF_STRIP8BIT;
|
putflags |= PXLF_STRIP8BIT;
|
||||||
(void) sm_snprintf(obuf, sizeof obuf, "%.200s: ", h->h_field);
|
(void) sm_snprintf(obuf, sizeof(obuf), "%.200s:", h->h_field);
|
||||||
obp = obuf + strlen(obuf);
|
obp = obuf + strlen(obuf);
|
||||||
while ((nlp = strchr(v, '\n')) != NULL)
|
while ((nlp = strchr(v, '\n')) != NULL)
|
||||||
{
|
{
|
||||||
@ -1861,6 +1968,7 @@ put_vanilla_header(h, v, mci)
|
|||||||
writeerr:
|
writeerr:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** COMMAIZE -- output a header field, making a comma-translated list.
|
** COMMAIZE -- output a header field, making a comma-translated list.
|
||||||
**
|
**
|
||||||
@ -1875,7 +1983,7 @@ put_vanilla_header(h, v, mci)
|
|||||||
** true iff header field was written successfully
|
** true iff header field was written successfully
|
||||||
**
|
**
|
||||||
** Side Effects:
|
** Side Effects:
|
||||||
** outputs "p" to file "fp".
|
** outputs "p" to "mci".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -1887,10 +1995,9 @@ commaize(h, p, oldstyle, mci, e)
|
|||||||
register ENVELOPE *e;
|
register ENVELOPE *e;
|
||||||
{
|
{
|
||||||
register char *obp;
|
register char *obp;
|
||||||
int opos;
|
int opos, omax, spaces;
|
||||||
int omax;
|
|
||||||
bool firstone = true;
|
bool firstone = true;
|
||||||
int putflags = PXLF_HEADER;
|
int putflags = PXLF_HEADER | PXLF_STRIPMQUOTE;
|
||||||
char **res;
|
char **res;
|
||||||
char obuf[MAXLINE + 3];
|
char obuf[MAXLINE + 3];
|
||||||
|
|
||||||
@ -1900,20 +2007,44 @@ commaize(h, p, oldstyle, mci, e)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (tTd(14, 2))
|
if (tTd(14, 2))
|
||||||
sm_dprintf("commaize(%s: %s)\n", h->h_field, p);
|
sm_dprintf("commaize(%s:%s)\n", h->h_field, p);
|
||||||
|
|
||||||
if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
|
if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
|
||||||
putflags |= PXLF_STRIP8BIT;
|
putflags |= PXLF_STRIP8BIT;
|
||||||
|
|
||||||
obp = obuf;
|
obp = obuf;
|
||||||
(void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.200s: ",
|
(void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.200s:", h->h_field);
|
||||||
h->h_field);
|
/* opos = strlen(obp); instead of the next 3 lines? */
|
||||||
|
opos = strlen(h->h_field) + 1;
|
||||||
/* opos = strlen(obp); */
|
if (opos > 201)
|
||||||
opos = strlen(h->h_field) + 2;
|
opos = 201;
|
||||||
if (opos > 202)
|
|
||||||
opos = 202;
|
|
||||||
obp += opos;
|
obp += opos;
|
||||||
|
|
||||||
|
spaces = 0;
|
||||||
|
while (*p != '\0' && isascii(*p) && isspace(*p))
|
||||||
|
{
|
||||||
|
++spaces;
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
if (spaces > 0)
|
||||||
|
{
|
||||||
|
SM_ASSERT(sizeof(obuf) > opos * 2);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Restrict number of spaces to half the length of buffer
|
||||||
|
** so the header field body can be put in here too.
|
||||||
|
** Note: this is a hack...
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (spaces > sizeof(obuf) / 2)
|
||||||
|
spaces = sizeof(obuf) / 2;
|
||||||
|
(void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%*s", spaces,
|
||||||
|
"");
|
||||||
|
opos += spaces;
|
||||||
|
obp += spaces;
|
||||||
|
SM_ASSERT(obp < &obuf[MAXLINE]);
|
||||||
|
}
|
||||||
|
|
||||||
omax = mci->mci_mailer->m_linelimit - 2;
|
omax = mci->mci_mailer->m_linelimit - 2;
|
||||||
if (omax < 0 || omax > 78)
|
if (omax < 0 || omax > 78)
|
||||||
omax = 78;
|
omax = 78;
|
||||||
@ -1949,7 +2080,7 @@ commaize(h, p, oldstyle, mci, e)
|
|||||||
char pvpbuf[PSBUFSIZE];
|
char pvpbuf[PSBUFSIZE];
|
||||||
|
|
||||||
res = prescan(p, oldstyle ? ' ' : ',', pvpbuf,
|
res = prescan(p, oldstyle ? ' ' : ',', pvpbuf,
|
||||||
sizeof pvpbuf, &oldp, NULL, false);
|
sizeof(pvpbuf), &oldp, ExtTokenTab, false);
|
||||||
p = oldp;
|
p = oldp;
|
||||||
#if _FFR_IGNORE_BOGUS_ADDR
|
#if _FFR_IGNORE_BOGUS_ADDR
|
||||||
/* ignore addresses that can't be parsed */
|
/* ignore addresses that can't be parsed */
|
||||||
@ -2027,7 +2158,7 @@ commaize(h, p, oldstyle, mci, e)
|
|||||||
if (!putxline(obuf, strlen(obuf), mci, putflags))
|
if (!putxline(obuf, strlen(obuf), mci, putflags))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
obp = obuf;
|
obp = obuf;
|
||||||
(void) sm_strlcpy(obp, " ", sizeof obuf);
|
(void) sm_strlcpy(obp, " ", sizeof(obuf));
|
||||||
opos = strlen(obp);
|
opos = strlen(obp);
|
||||||
obp += opos;
|
obp += opos;
|
||||||
opos += strlen(name);
|
opos += strlen(name);
|
||||||
@ -2043,10 +2174,10 @@ commaize(h, p, oldstyle, mci, e)
|
|||||||
firstone = false;
|
firstone = false;
|
||||||
*p = savechar;
|
*p = savechar;
|
||||||
}
|
}
|
||||||
if (obp < &obuf[sizeof obuf])
|
if (obp < &obuf[sizeof(obuf)])
|
||||||
*obp = '\0';
|
*obp = '\0';
|
||||||
else
|
else
|
||||||
obuf[sizeof obuf - 1] = '\0';
|
obuf[sizeof(obuf) - 1] = '\0';
|
||||||
return putxline(obuf, strlen(obuf), mci, putflags);
|
return putxline(obuf, strlen(obuf), mci, putflags);
|
||||||
|
|
||||||
writeerr:
|
writeerr:
|
||||||
@ -2080,7 +2211,7 @@ copyheader(header, rpool)
|
|||||||
|
|
||||||
while (header != NULL)
|
while (header != NULL)
|
||||||
{
|
{
|
||||||
newhdr = (HDR *) sm_rpool_malloc_x(rpool, sizeof *newhdr);
|
newhdr = (HDR *) sm_rpool_malloc_x(rpool, sizeof(*newhdr));
|
||||||
STRUCTCOPY(*header, *newhdr);
|
STRUCTCOPY(*header, *newhdr);
|
||||||
*tail = newhdr;
|
*tail = newhdr;
|
||||||
tail = &newhdr->h_link;
|
tail = &newhdr->h_link;
|
||||||
@ -2090,6 +2221,7 @@ copyheader(header, rpool)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** FIX_MIME_HEADER -- possibly truncate/rebalance parameters in a MIME header
|
** FIX_MIME_HEADER -- possibly truncate/rebalance parameters in a MIME header
|
||||||
**
|
**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" Copyright (c) 1998-2000, 2002 Sendmail, Inc. and its suppliers.
|
.\" Copyright (c) 1998-2000, 2002, 2007 Sendmail, Inc. and its suppliers.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
|
.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
|
||||||
.\" Copyright (c) 1985, 1990, 1993
|
.\" Copyright (c) 1985, 1990, 1993
|
||||||
@ -9,9 +9,9 @@
|
|||||||
.\" the sendmail distribution.
|
.\" the sendmail distribution.
|
||||||
.\"
|
.\"
|
||||||
.\"
|
.\"
|
||||||
.\" $Id: mailq.1,v 8.20 2002/06/27 22:47:34 gshapiro Exp $
|
.\" $Id: mailq.1,v 8.21 2007/03/22 18:21:27 ca Exp $
|
||||||
.\"
|
.\"
|
||||||
.TH MAILQ 1 "$Date: 2002/06/27 22:47:34 $"
|
.TH MAILQ 1 "$Date: 2007/03/22 18:21:27 $"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
mailq
|
mailq
|
||||||
\- print the mail queue
|
\- print the mail queue
|
||||||
@ -104,6 +104,25 @@ and the name of the alias this command expanded from, if any.
|
|||||||
Moreover, status messages for each recipient are printed
|
Moreover, status messages for each recipient are printed
|
||||||
if available.
|
if available.
|
||||||
.PP
|
.PP
|
||||||
|
Several sendmail.cf options influence the behavior of the
|
||||||
|
.B mailq
|
||||||
|
utility:
|
||||||
|
The number of items printed per queue group is restricted by
|
||||||
|
.B MaxQueueRunSize
|
||||||
|
if that value is set.
|
||||||
|
The status character
|
||||||
|
.B *
|
||||||
|
is not printed for some values of
|
||||||
|
.B QueueSortOrder,
|
||||||
|
e.g.,
|
||||||
|
filename,
|
||||||
|
random,
|
||||||
|
modification, and
|
||||||
|
none,
|
||||||
|
unless a
|
||||||
|
.B -q
|
||||||
|
option is used to limit the processed jobs.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.B mailq
|
.B mailq
|
||||||
utility exits 0 on success, and >0 if an error occurs.
|
utility exits 0 on success, and >0 if an error occurs.
|
||||||
@ -114,3 +133,4 @@ The
|
|||||||
.B mailq
|
.B mailq
|
||||||
command appeared in
|
command appeared in
|
||||||
4.0BSD.
|
4.0BSD.
|
||||||
|
.\" $FreeBSD$
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: mci.c,v 8.217 2006/04/18 01:27:36 ca Exp $")
|
SM_RCSID("@(#)$Id: mci.c,v 8.218 2006/08/15 23:24:57 ca Exp $")
|
||||||
|
|
||||||
#if NETINET || NETINET6
|
#if NETINET || NETINET6
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
@ -141,8 +141,8 @@ mci_scan(savemci)
|
|||||||
if (MciCache == NULL)
|
if (MciCache == NULL)
|
||||||
{
|
{
|
||||||
/* first call */
|
/* first call */
|
||||||
MciCache = (MCI **) sm_pmalloc_x(MaxMciCache * sizeof *MciCache);
|
MciCache = (MCI **) sm_pmalloc_x(MaxMciCache * sizeof(*MciCache));
|
||||||
memset((char *) MciCache, '\0', MaxMciCache * sizeof *MciCache);
|
memset((char *) MciCache, '\0', MaxMciCache * sizeof(*MciCache));
|
||||||
return &MciCache[0];
|
return &MciCache[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ mci_get(host, m)
|
|||||||
extern SOCKADDR CurHostAddr;
|
extern SOCKADDR CurHostAddr;
|
||||||
|
|
||||||
/* clear CurHostAddr so we don't get a bogus address with this name */
|
/* clear CurHostAddr so we don't get a bogus address with this name */
|
||||||
memset(&CurHostAddr, '\0', sizeof CurHostAddr);
|
memset(&CurHostAddr, '\0', sizeof(CurHostAddr));
|
||||||
|
|
||||||
/* clear out any expired connections */
|
/* clear out any expired connections */
|
||||||
(void) mci_scan(NULL);
|
(void) mci_scan(NULL);
|
||||||
@ -375,7 +375,7 @@ mci_get(host, m)
|
|||||||
{
|
{
|
||||||
/* get peer host address */
|
/* get peer host address */
|
||||||
/* (this should really be in the mci struct) */
|
/* (this should really be in the mci struct) */
|
||||||
SOCKADDR_LEN_T socklen = sizeof CurHostAddr;
|
SOCKADDR_LEN_T socklen = sizeof(CurHostAddr);
|
||||||
|
|
||||||
(void) getpeername(sm_io_getinfo(mci->mci_in,
|
(void) getpeername(sm_io_getinfo(mci->mci_in,
|
||||||
SM_IO_WHAT_FD, NULL),
|
SM_IO_WHAT_FD, NULL),
|
||||||
@ -465,10 +465,10 @@ mci_new(rpool)
|
|||||||
register MCI *mci;
|
register MCI *mci;
|
||||||
|
|
||||||
if (rpool == NULL)
|
if (rpool == NULL)
|
||||||
mci = (MCI *) sm_malloc_x(sizeof *mci);
|
mci = (MCI *) sm_malloc_x(sizeof(*mci));
|
||||||
else
|
else
|
||||||
mci = (MCI *) sm_rpool_malloc_x(rpool, sizeof *mci);
|
mci = (MCI *) sm_rpool_malloc_x(rpool, sizeof(*mci));
|
||||||
memset((char *) mci, '\0', sizeof *mci);
|
memset((char *) mci, '\0', sizeof(*mci));
|
||||||
mci->mci_rpool = sm_rpool_new_x(NULL);
|
mci->mci_rpool = sm_rpool_new_x(NULL);
|
||||||
mci->mci_macro.mac_rpool = mci->mci_rpool;
|
mci->mci_macro.mac_rpool = mci->mci_rpool;
|
||||||
return mci;
|
return mci;
|
||||||
@ -727,7 +727,7 @@ mci_lock_host_statfile(mci)
|
|||||||
sm_dprintf("mci_lock_host: attempting to lock %s\n",
|
sm_dprintf("mci_lock_host: attempting to lock %s\n",
|
||||||
mci->mci_host);
|
mci->mci_host);
|
||||||
|
|
||||||
if (mci_generate_persistent_path(mci->mci_host, fname, sizeof fname,
|
if (mci_generate_persistent_path(mci->mci_host, fname, sizeof(fname),
|
||||||
true) < 0)
|
true) < 0)
|
||||||
{
|
{
|
||||||
/* of course this should never happen */
|
/* of course this should never happen */
|
||||||
@ -857,7 +857,7 @@ mci_load_persistent(mci)
|
|||||||
sm_dprintf("mci_load_persistent: Attempting to load persistent information for %s\n",
|
sm_dprintf("mci_load_persistent: Attempting to load persistent information for %s\n",
|
||||||
mci->mci_host);
|
mci->mci_host);
|
||||||
|
|
||||||
if (mci_generate_persistent_path(mci->mci_host, fname, sizeof fname,
|
if (mci_generate_persistent_path(mci->mci_host, fname, sizeof(fname),
|
||||||
false) < 0)
|
false) < 0)
|
||||||
{
|
{
|
||||||
/* Not much we can do if the file isn't there... */
|
/* Not much we can do if the file isn't there... */
|
||||||
@ -946,7 +946,7 @@ mci_read_persistent(fp, mci)
|
|||||||
sm_io_rewind(fp, SM_TIME_DEFAULT);
|
sm_io_rewind(fp, SM_TIME_DEFAULT);
|
||||||
ver = -1;
|
ver = -1;
|
||||||
LineNumber = 0;
|
LineNumber = 0;
|
||||||
while (sm_io_fgets(fp, SM_TIME_DEFAULT, buf, sizeof buf) != NULL)
|
while (sm_io_fgets(fp, SM_TIME_DEFAULT, buf, sizeof(buf)) != NULL)
|
||||||
{
|
{
|
||||||
LineNumber++;
|
LineNumber++;
|
||||||
p = strchr(buf, '\n');
|
p = strchr(buf, '\n');
|
||||||
@ -1171,7 +1171,7 @@ mci_traverse_persistent(action, pathname)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
(void) sm_strlcpy(newptr, e->d_name,
|
(void) sm_strlcpy(newptr, e->d_name,
|
||||||
sizeof newpath -
|
sizeof(newpath) -
|
||||||
(newptr - newpath));
|
(newptr - newpath));
|
||||||
|
|
||||||
if (StopRequest)
|
if (StopRequest)
|
||||||
@ -1301,7 +1301,7 @@ mci_print_persistent(pathname, hostname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FileName = pathname;
|
FileName = pathname;
|
||||||
memset(&mcib, '\0', sizeof mcib);
|
memset(&mcib, '\0', sizeof(mcib));
|
||||||
if (mci_read_persistent(fp, &mcib) < 0)
|
if (mci_read_persistent(fp, &mcib) < 0)
|
||||||
{
|
{
|
||||||
syserr("%s: could not read status file", pathname);
|
syserr("%s: could not read status file", pathname);
|
||||||
@ -1333,7 +1333,7 @@ mci_print_persistent(pathname, hostname)
|
|||||||
{
|
{
|
||||||
char buf[80];
|
char buf[80];
|
||||||
|
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Unknown mailer error %d",
|
"Unknown mailer error %d",
|
||||||
mcib.mci_exitstat);
|
mcib.mci_exitstat);
|
||||||
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%.*s\n",
|
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%.*s\n",
|
||||||
@ -1480,12 +1480,12 @@ mci_generate_persistent_path(host, path, pathlen, createflag)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* make certain this is not a bracketed host number */
|
/* make certain this is not a bracketed host number */
|
||||||
if (strlen(host) > sizeof t_host - 1)
|
if (strlen(host) > sizeof(t_host) - 1)
|
||||||
return -1;
|
return -1;
|
||||||
if (host[0] == '[')
|
if (host[0] == '[')
|
||||||
(void) sm_strlcpy(t_host, host + 1, sizeof t_host);
|
(void) sm_strlcpy(t_host, host + 1, sizeof(t_host));
|
||||||
else
|
else
|
||||||
(void) sm_strlcpy(t_host, host, sizeof t_host);
|
(void) sm_strlcpy(t_host, host, sizeof(t_host));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Delete any trailing dots from the hostname.
|
** Delete any trailing dots from the hostname.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: savemail.c,v 8.308 2006/04/18 01:31:33 ca Exp $")
|
SM_RCSID("@(#)$Id: savemail.c,v 8.313 2006/11/29 00:20:41 ca Exp $")
|
||||||
|
|
||||||
static bool errbody __P((MCI *, ENVELOPE *, char *));
|
static bool errbody __P((MCI *, ENVELOPE *, char *));
|
||||||
static bool pruneroute __P((char *));
|
static bool pruneroute __P((char *));
|
||||||
@ -195,7 +195,7 @@ savemail(e, sendbody)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
expand("\201n", buf, sizeof buf, e);
|
expand("\201n", buf, sizeof(buf), e);
|
||||||
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
|
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
|
||||||
"\r\nMessage from %s...\r\n", buf);
|
"\r\nMessage from %s...\r\n", buf);
|
||||||
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
|
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
|
||||||
@ -206,7 +206,7 @@ savemail(e, sendbody)
|
|||||||
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
|
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
|
||||||
"Transcript follows:\r\n");
|
"Transcript follows:\r\n");
|
||||||
while (sm_io_fgets(e->e_xfp, SM_TIME_DEFAULT,
|
while (sm_io_fgets(e->e_xfp, SM_TIME_DEFAULT,
|
||||||
buf, sizeof buf) != NULL &&
|
buf, sizeof(buf)) != NULL &&
|
||||||
!sm_io_error(smioout))
|
!sm_io_error(smioout))
|
||||||
(void) sm_io_fputs(smioout,
|
(void) sm_io_fputs(smioout,
|
||||||
SM_TIME_DEFAULT,
|
SM_TIME_DEFAULT,
|
||||||
@ -253,7 +253,7 @@ savemail(e, sendbody)
|
|||||||
char from[TOBUFSIZE];
|
char from[TOBUFSIZE];
|
||||||
|
|
||||||
if (sm_strlcpy(from, e->e_from.q_paddr,
|
if (sm_strlcpy(from, e->e_from.q_paddr,
|
||||||
sizeof from) >= sizeof from)
|
sizeof(from)) >= sizeof(from))
|
||||||
{
|
{
|
||||||
state = ESM_POSTMASTER;
|
state = ESM_POSTMASTER;
|
||||||
break;
|
break;
|
||||||
@ -307,7 +307,7 @@ savemail(e, sendbody)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
q = NULL;
|
q = NULL;
|
||||||
expand(DoubleBounceAddr, buf, sizeof buf, e);
|
expand(DoubleBounceAddr, buf, sizeof(buf), e);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Just drop it on the floor if DoubleBounceAddr
|
** Just drop it on the floor if DoubleBounceAddr
|
||||||
@ -373,7 +373,7 @@ savemail(e, sendbody)
|
|||||||
p = macvalue('g', e);
|
p = macvalue('g', e);
|
||||||
macdefine(&e->e_macro, A_PERM, 'g', e->e_sender);
|
macdefine(&e->e_macro, A_PERM, 'g', e->e_sender);
|
||||||
|
|
||||||
expand("\201z/dead.letter", dlbuf, sizeof dlbuf, e);
|
expand("\201z/dead.letter", dlbuf, sizeof(dlbuf), e);
|
||||||
sff = SFF_CREAT|SFF_REGONLY|SFF_RUNASREALUID;
|
sff = SFF_CREAT|SFF_REGONLY|SFF_RUNASREALUID;
|
||||||
if (RealUid == 0)
|
if (RealUid == 0)
|
||||||
sff |= SFF_ROOTOK;
|
sff |= SFF_ROOTOK;
|
||||||
@ -424,7 +424,7 @@ savemail(e, sendbody)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&mcibuf, '\0', sizeof mcibuf);
|
memset(&mcibuf, '\0', sizeof(mcibuf));
|
||||||
mcibuf.mci_out = fp;
|
mcibuf.mci_out = fp;
|
||||||
mcibuf.mci_mailer = FileMailer;
|
mcibuf.mci_mailer = FileMailer;
|
||||||
if (bitnset(M_7BITS, FileMailer->m_flags))
|
if (bitnset(M_7BITS, FileMailer->m_flags))
|
||||||
@ -608,7 +608,7 @@ returntosender(msg, returnq, flags, e)
|
|||||||
ee->e_nrcpts++;
|
ee->e_nrcpts++;
|
||||||
|
|
||||||
if (q->q_alias == NULL)
|
if (q->q_alias == NULL)
|
||||||
addheader("To", q->q_paddr, 0, ee);
|
addheader("To", q->q_paddr, 0, ee, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogLevel > 5)
|
if (LogLevel > 5)
|
||||||
@ -627,18 +627,18 @@ returntosender(msg, returnq, flags, e)
|
|||||||
|
|
||||||
if (SendMIMEErrors)
|
if (SendMIMEErrors)
|
||||||
{
|
{
|
||||||
addheader("MIME-Version", "1.0", 0, ee);
|
addheader("MIME-Version", "1.0", 0, ee, true);
|
||||||
(void) sm_snprintf(buf, sizeof buf, "%s.%ld/%.100s",
|
(void) sm_snprintf(buf, sizeof(buf), "%s.%ld/%.100s",
|
||||||
ee->e_id, (long)curtime(), MyHostName);
|
ee->e_id, (long)curtime(), MyHostName);
|
||||||
ee->e_msgboundary = sm_rpool_strdup_x(ee->e_rpool, buf);
|
ee->e_msgboundary = sm_rpool_strdup_x(ee->e_rpool, buf);
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
#if DSN
|
#if DSN
|
||||||
"multipart/report; report-type=delivery-status;\n\tboundary=\"%s\"",
|
"multipart/report; report-type=delivery-status;\n\tboundary=\"%s\"",
|
||||||
#else /* DSN */
|
#else /* DSN */
|
||||||
"multipart/mixed; boundary=\"%s\"",
|
"multipart/mixed; boundary=\"%s\"",
|
||||||
#endif /* DSN */
|
#endif /* DSN */
|
||||||
ee->e_msgboundary);
|
ee->e_msgboundary);
|
||||||
addheader("Content-Type", buf, 0, ee);
|
addheader("Content-Type", buf, 0, ee, true);
|
||||||
|
|
||||||
p = hvalue("Content-Transfer-Encoding", e->e_header);
|
p = hvalue("Content-Transfer-Encoding", e->e_header);
|
||||||
if (p != NULL && sm_strcasecmp(p, "binary") != 0)
|
if (p != NULL && sm_strcasecmp(p, "binary") != 0)
|
||||||
@ -646,42 +646,42 @@ returntosender(msg, returnq, flags, e)
|
|||||||
if (p == NULL && bitset(EF_HAS8BIT, e->e_flags))
|
if (p == NULL && bitset(EF_HAS8BIT, e->e_flags))
|
||||||
p = "8bit";
|
p = "8bit";
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
addheader("Content-Transfer-Encoding", p, 0, ee);
|
addheader("Content-Transfer-Encoding", p, 0, ee, true);
|
||||||
}
|
}
|
||||||
if (strncmp(msg, "Warning:", 8) == 0)
|
if (strncmp(msg, "Warning:", 8) == 0)
|
||||||
{
|
{
|
||||||
addheader("Subject", msg, 0, ee);
|
addheader("Subject", msg, 0, ee, true);
|
||||||
p = "warning-timeout";
|
p = "warning-timeout";
|
||||||
}
|
}
|
||||||
else if (strncmp(msg, "Postmaster warning:", 19) == 0)
|
else if (strncmp(msg, "Postmaster warning:", 19) == 0)
|
||||||
{
|
{
|
||||||
addheader("Subject", msg, 0, ee);
|
addheader("Subject", msg, 0, ee, true);
|
||||||
p = "postmaster-warning";
|
p = "postmaster-warning";
|
||||||
}
|
}
|
||||||
else if (strcmp(msg, "Return receipt") == 0)
|
else if (strcmp(msg, "Return receipt") == 0)
|
||||||
{
|
{
|
||||||
addheader("Subject", msg, 0, ee);
|
addheader("Subject", msg, 0, ee, true);
|
||||||
p = "return-receipt";
|
p = "return-receipt";
|
||||||
}
|
}
|
||||||
else if (bitset(RTSF_PM_BOUNCE, flags))
|
else if (bitset(RTSF_PM_BOUNCE, flags))
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Postmaster notify: see transcript for details");
|
"Postmaster notify: see transcript for details");
|
||||||
addheader("Subject", buf, 0, ee);
|
addheader("Subject", buf, 0, ee, true);
|
||||||
p = "postmaster-notification";
|
p = "postmaster-notification";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Returned mail: see transcript for details");
|
"Returned mail: see transcript for details");
|
||||||
addheader("Subject", buf, 0, ee);
|
addheader("Subject", buf, 0, ee, true);
|
||||||
p = "failure";
|
p = "failure";
|
||||||
}
|
}
|
||||||
(void) sm_snprintf(buf, sizeof buf, "auto-generated (%s)", p);
|
(void) sm_snprintf(buf, sizeof(buf), "auto-generated (%s)", p);
|
||||||
addheader("Auto-Submitted", buf, 0, ee);
|
addheader("Auto-Submitted", buf, 0, ee, true);
|
||||||
|
|
||||||
/* fake up an address header for the from person */
|
/* fake up an address header for the from person */
|
||||||
expand("\201n", buf, sizeof buf, e);
|
expand("\201n", buf, sizeof(buf), e);
|
||||||
if (parseaddr(buf, &ee->e_from,
|
if (parseaddr(buf, &ee->e_from,
|
||||||
RF_COPYALL|RF_SENDERADDR, '\0', NULL, e, false) == NULL)
|
RF_COPYALL|RF_SENDERADDR, '\0', NULL, e, false) == NULL)
|
||||||
{
|
{
|
||||||
@ -778,7 +778,7 @@ errbody(mci, e, separator)
|
|||||||
|
|
||||||
if (e->e_msgboundary != NULL)
|
if (e->e_msgboundary != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary);
|
(void) sm_strlcpyn(buf, sizeof(buf), 2, "--", e->e_msgboundary);
|
||||||
if (!putline("This is a MIME-encapsulated message", mci) ||
|
if (!putline("This is a MIME-encapsulated message", mci) ||
|
||||||
!putline("", mci) ||
|
!putline("", mci) ||
|
||||||
!putline(buf, mci) ||
|
!putline(buf, mci) ||
|
||||||
@ -816,19 +816,19 @@ errbody(mci, e, separator)
|
|||||||
!putline("", mci))
|
!putline("", mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
}
|
}
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"The original message was received at %s",
|
"The original message was received at %s",
|
||||||
arpadate(ctime(&e->e_parent->e_ctime)));
|
arpadate(ctime(&e->e_parent->e_ctime)));
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
expand("from \201_", buf, sizeof buf, e->e_parent);
|
expand("from \201_", buf, sizeof(buf), e->e_parent);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
|
|
||||||
/* include id in postmaster copies */
|
/* include id in postmaster copies */
|
||||||
if (pm_notify && e->e_parent->e_id != NULL)
|
if (pm_notify && e->e_parent->e_id != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2, "with id ",
|
(void) sm_strlcpyn(buf, sizeof(buf), 2, "with id ",
|
||||||
e->e_parent->e_id);
|
e->e_parent->e_id);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
@ -856,11 +856,19 @@ errbody(mci, e, separator)
|
|||||||
if (xfile != NULL)
|
if (xfile != NULL)
|
||||||
{
|
{
|
||||||
while (sm_io_fgets(xfile, SM_TIME_DEFAULT, buf,
|
while (sm_io_fgets(xfile, SM_TIME_DEFAULT, buf,
|
||||||
sizeof buf) != NULL)
|
sizeof(buf)) != NULL)
|
||||||
{
|
{
|
||||||
translate_dollars(buf);
|
int lbs;
|
||||||
expand(buf, buf, sizeof buf, e);
|
bool putok;
|
||||||
if (!putline(buf, mci))
|
char *lbp;
|
||||||
|
|
||||||
|
lbs = sizeof(buf);
|
||||||
|
lbp = translate_dollars(buf, buf, &lbs);
|
||||||
|
expand(lbp, lbp, lbs, e);
|
||||||
|
putok = putline(lbp, mci);
|
||||||
|
if (lbp != buf)
|
||||||
|
sm_free(lbp);
|
||||||
|
if (!putok)
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
}
|
}
|
||||||
(void) sm_io_close(xfile, SM_TIME_DEFAULT);
|
(void) sm_io_close(xfile, SM_TIME_DEFAULT);
|
||||||
@ -870,7 +878,7 @@ errbody(mci, e, separator)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
expand(ErrMsgFile, buf, sizeof buf, e);
|
expand(ErrMsgFile, buf, sizeof(buf), e);
|
||||||
if (!putline(buf, mci) || !putline("", mci))
|
if (!putline(buf, mci) || !putline("", mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
}
|
}
|
||||||
@ -897,12 +905,12 @@ errbody(mci, e, separator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR),
|
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR),
|
||||||
sizeof buf);
|
sizeof(buf));
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
if (q->q_rstatus != NULL)
|
if (q->q_rstatus != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
" (reason: %s)",
|
" (reason: %s)",
|
||||||
shortenstring(exitstat(q->q_rstatus),
|
shortenstring(exitstat(q->q_rstatus),
|
||||||
MAXSHORTSTR));
|
MAXSHORTSTR));
|
||||||
@ -911,7 +919,7 @@ errbody(mci, e, separator)
|
|||||||
}
|
}
|
||||||
if (q->q_alias != NULL)
|
if (q->q_alias != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
" (expanded from: %s)",
|
" (expanded from: %s)",
|
||||||
shortenstring(q->q_alias->q_paddr,
|
shortenstring(q->q_alias->q_paddr,
|
||||||
MAXSHORTSTR));
|
MAXSHORTSTR));
|
||||||
@ -941,12 +949,12 @@ errbody(mci, e, separator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR),
|
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR),
|
||||||
sizeof buf);
|
sizeof(buf));
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
if (q->q_alias != NULL)
|
if (q->q_alias != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
" (expanded from: %s)",
|
" (expanded from: %s)",
|
||||||
shortenstring(q->q_alias->q_paddr,
|
shortenstring(q->q_alias->q_paddr,
|
||||||
MAXSHORTSTR));
|
MAXSHORTSTR));
|
||||||
@ -994,13 +1002,13 @@ errbody(mci, e, separator)
|
|||||||
printheader = false;
|
printheader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) sm_snprintf(buf, sizeof buf, "%s (%s)",
|
(void) sm_snprintf(buf, sizeof(buf), "%s (%s)",
|
||||||
shortenstring(q->q_paddr, MAXSHORTSTR), p);
|
shortenstring(q->q_paddr, MAXSHORTSTR), p);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
if (q->q_alias != NULL)
|
if (q->q_alias != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
" (expanded from: %s)",
|
" (expanded from: %s)",
|
||||||
shortenstring(q->q_alias->q_paddr,
|
shortenstring(q->q_alias->q_paddr,
|
||||||
MAXSHORTSTR));
|
MAXSHORTSTR));
|
||||||
@ -1029,7 +1037,7 @@ errbody(mci, e, separator)
|
|||||||
if (e->e_xfp != NULL)
|
if (e->e_xfp != NULL)
|
||||||
(void) sm_io_flush(e->e_xfp, SM_TIME_DEFAULT);
|
(void) sm_io_flush(e->e_xfp, SM_TIME_DEFAULT);
|
||||||
while (sm_io_fgets(e->e_parent->e_xfp, SM_TIME_DEFAULT, buf,
|
while (sm_io_fgets(e->e_parent->e_xfp, SM_TIME_DEFAULT, buf,
|
||||||
sizeof buf) != NULL)
|
sizeof(buf)) != NULL)
|
||||||
{
|
{
|
||||||
if (printheader && !putline(" ----- Transcript of session follows -----\n",
|
if (printheader && !putline(" ----- Transcript of session follows -----\n",
|
||||||
mci))
|
mci))
|
||||||
@ -1048,7 +1056,7 @@ errbody(mci, e, separator)
|
|||||||
|
|
||||||
if (e->e_msgboundary != NULL)
|
if (e->e_msgboundary != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary);
|
(void) sm_strlcpyn(buf, sizeof(buf), 2, "--", e->e_msgboundary);
|
||||||
if (!putline("", mci) ||
|
if (!putline("", mci) ||
|
||||||
!putline(buf, mci) ||
|
!putline(buf, mci) ||
|
||||||
!putline("Content-Type: message/delivery-status", mci) ||
|
!putline("Content-Type: message/delivery-status", mci) ||
|
||||||
@ -1062,7 +1070,7 @@ errbody(mci, e, separator)
|
|||||||
/* original envelope id from MAIL FROM: line */
|
/* original envelope id from MAIL FROM: line */
|
||||||
if (e->e_parent->e_envid != NULL)
|
if (e->e_parent->e_envid != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Original-Envelope-Id: %.800s",
|
"Original-Envelope-Id: %.800s",
|
||||||
xuntextify(e->e_parent->e_envid));
|
xuntextify(e->e_parent->e_envid));
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1070,7 +1078,7 @@ errbody(mci, e, separator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Reporting-MTA: is us (required) */
|
/* Reporting-MTA: is us (required) */
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Reporting-MTA: dns; %.800s", MyHostName);
|
"Reporting-MTA: dns; %.800s", MyHostName);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
@ -1084,7 +1092,7 @@ errbody(mci, e, separator)
|
|||||||
if (e->e_parent->e_from.q_mailer == NULL ||
|
if (e->e_parent->e_from.q_mailer == NULL ||
|
||||||
(p = e->e_parent->e_from.q_mailer->m_mtatype) == NULL)
|
(p = e->e_parent->e_from.q_mailer->m_mtatype) == NULL)
|
||||||
p = "dns";
|
p = "dns";
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Received-From-MTA: %s; %.800s",
|
"Received-From-MTA: %s; %.800s",
|
||||||
p, RealHostName);
|
p, RealHostName);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1092,7 +1100,7 @@ errbody(mci, e, separator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Arrival-Date: -- when it arrived here */
|
/* Arrival-Date: -- when it arrived here */
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2, "Arrival-Date: ",
|
(void) sm_strlcpyn(buf, sizeof(buf), 2, "Arrival-Date: ",
|
||||||
arpadate(ctime(&e->e_parent->e_ctime)));
|
arpadate(ctime(&e->e_parent->e_ctime)));
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
@ -1103,7 +1111,7 @@ errbody(mci, e, separator)
|
|||||||
time_t dbyd;
|
time_t dbyd;
|
||||||
|
|
||||||
dbyd = e->e_parent->e_ctime + e->e_parent->e_deliver_by;
|
dbyd = e->e_parent->e_ctime + e->e_parent->e_deliver_by;
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2,
|
(void) sm_strlcpyn(buf, sizeof(buf), 2,
|
||||||
"Deliver-By-Date: ",
|
"Deliver-By-Date: ",
|
||||||
arpadate(ctime(&dbyd)));
|
arpadate(ctime(&dbyd)));
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1156,7 +1164,7 @@ errbody(mci, e, separator)
|
|||||||
/* Original-Recipient: -- passed from on high */
|
/* Original-Recipient: -- passed from on high */
|
||||||
if (q->q_orcpt != NULL)
|
if (q->q_orcpt != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Original-Recipient: %.800s",
|
"Original-Recipient: %.800s",
|
||||||
q->q_orcpt);
|
q->q_orcpt);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1177,7 +1185,7 @@ errbody(mci, e, separator)
|
|||||||
strchr(q->q_user, '@') == NULL)
|
strchr(q->q_user, '@') == NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(actual,
|
(void) sm_snprintf(actual,
|
||||||
sizeof actual,
|
sizeof(actual),
|
||||||
"%s; %.700s@%.100s",
|
"%s; %.700s@%.100s",
|
||||||
p, q->q_user,
|
p, q->q_user,
|
||||||
MyHostName);
|
MyHostName);
|
||||||
@ -1185,7 +1193,7 @@ errbody(mci, e, separator)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(actual,
|
(void) sm_snprintf(actual,
|
||||||
sizeof actual,
|
sizeof(actual),
|
||||||
"%s; %.800s",
|
"%s; %.800s",
|
||||||
p, q->q_user);
|
p, q->q_user);
|
||||||
}
|
}
|
||||||
@ -1206,7 +1214,7 @@ errbody(mci, e, separator)
|
|||||||
|
|
||||||
if (q->q_finalrcpt != NULL)
|
if (q->q_finalrcpt != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Final-Recipient: %s",
|
"Final-Recipient: %s",
|
||||||
q->q_finalrcpt);
|
q->q_finalrcpt);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1216,12 +1224,10 @@ errbody(mci, e, separator)
|
|||||||
/* X-Actual-Recipient: -- the real problem address */
|
/* X-Actual-Recipient: -- the real problem address */
|
||||||
if (actual[0] != '\0' &&
|
if (actual[0] != '\0' &&
|
||||||
q->q_finalrcpt != NULL &&
|
q->q_finalrcpt != NULL &&
|
||||||
#if _FFR_PRIV_NOACTUALRECIPIENT
|
|
||||||
!bitset(PRIV_NOACTUALRECIPIENT, PrivacyFlags) &&
|
!bitset(PRIV_NOACTUALRECIPIENT, PrivacyFlags) &&
|
||||||
#endif /* _FFR_PRIV_NOACTUALRECIPIENT */
|
|
||||||
strcmp(actual, q->q_finalrcpt) != 0)
|
strcmp(actual, q->q_finalrcpt) != 0)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"X-Actual-Recipient: %s",
|
"X-Actual-Recipient: %s",
|
||||||
actual);
|
actual);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1229,7 +1235,7 @@ errbody(mci, e, separator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Action: -- what happened? */
|
/* Action: -- what happened? */
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2, "Action: ",
|
(void) sm_strlcpyn(buf, sizeof(buf), 2, "Action: ",
|
||||||
action);
|
action);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
@ -1243,7 +1249,7 @@ errbody(mci, e, separator)
|
|||||||
p = "4.0.0";
|
p = "4.0.0";
|
||||||
else
|
else
|
||||||
p = "2.0.0";
|
p = "2.0.0";
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2, "Status: ", p);
|
(void) sm_strlcpyn(buf, sizeof(buf), 2, "Status: ", p);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
|
|
||||||
@ -1253,7 +1259,7 @@ errbody(mci, e, separator)
|
|||||||
if (q->q_mailer == NULL ||
|
if (q->q_mailer == NULL ||
|
||||||
(p = q->q_mailer->m_mtatype) == NULL)
|
(p = q->q_mailer->m_mtatype) == NULL)
|
||||||
p = "dns";
|
p = "dns";
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Remote-MTA: %s; %.800s",
|
"Remote-MTA: %s; %.800s",
|
||||||
p, q->q_statmta);
|
p, q->q_statmta);
|
||||||
p = &buf[strlen(buf) - 1];
|
p = &buf[strlen(buf) - 1];
|
||||||
@ -1269,7 +1275,7 @@ errbody(mci, e, separator)
|
|||||||
if (q->q_mailer == NULL ||
|
if (q->q_mailer == NULL ||
|
||||||
(p = q->q_mailer->m_diagtype) == NULL)
|
(p = q->q_mailer->m_diagtype) == NULL)
|
||||||
p = "smtp";
|
p = "smtp";
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Diagnostic-Code: %s; %.800s",
|
"Diagnostic-Code: %s; %.800s",
|
||||||
p, q->q_rstatus);
|
p, q->q_rstatus);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1279,7 +1285,7 @@ errbody(mci, e, separator)
|
|||||||
/* Last-Attempt-Date: -- fine granularity */
|
/* Last-Attempt-Date: -- fine granularity */
|
||||||
if (q->q_statdate == (time_t) 0L)
|
if (q->q_statdate == (time_t) 0L)
|
||||||
q->q_statdate = curtime();
|
q->q_statdate = curtime();
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2,
|
(void) sm_strlcpyn(buf, sizeof(buf), 2,
|
||||||
"Last-Attempt-Date: ",
|
"Last-Attempt-Date: ",
|
||||||
arpadate(ctime(&q->q_statdate)));
|
arpadate(ctime(&q->q_statdate)));
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1292,7 +1298,7 @@ errbody(mci, e, separator)
|
|||||||
|
|
||||||
xdate = e->e_parent->e_ctime +
|
xdate = e->e_parent->e_ctime +
|
||||||
TimeOuts.to_q_return[e->e_parent->e_timeoutclass];
|
TimeOuts.to_q_return[e->e_parent->e_timeoutclass];
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2,
|
(void) sm_strlcpyn(buf, sizeof(buf), 2,
|
||||||
"Will-Retry-Until: ",
|
"Will-Retry-Until: ",
|
||||||
arpadate(ctime(&xdate)));
|
arpadate(ctime(&xdate)));
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1326,12 +1332,12 @@ errbody(mci, e, separator)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2, "--",
|
(void) sm_strlcpyn(buf, sizeof(buf), 2, "--",
|
||||||
e->e_msgboundary);
|
e->e_msgboundary);
|
||||||
|
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 2, "Content-Type: ",
|
(void) sm_strlcpyn(buf, sizeof(buf), 2, "Content-Type: ",
|
||||||
sendbody ? "message/rfc822"
|
sendbody ? "message/rfc822"
|
||||||
: "text/rfc822-headers");
|
: "text/rfc822-headers");
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1346,7 +1352,7 @@ errbody(mci, e, separator)
|
|||||||
p = "8bit";
|
p = "8bit";
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_snprintf(buf, sizeof buf,
|
(void) sm_snprintf(buf, sizeof(buf),
|
||||||
"Content-Transfer-Encoding: %s",
|
"Content-Transfer-Encoding: %s",
|
||||||
p);
|
p);
|
||||||
if (!putline(buf, mci))
|
if (!putline(buf, mci))
|
||||||
@ -1383,7 +1389,7 @@ errbody(mci, e, separator)
|
|||||||
|
|
||||||
if (e->e_msgboundary != NULL)
|
if (e->e_msgboundary != NULL)
|
||||||
{
|
{
|
||||||
(void) sm_strlcpyn(buf, sizeof buf, 3, "--", e->e_msgboundary,
|
(void) sm_strlcpyn(buf, sizeof(buf), 3, "--", e->e_msgboundary,
|
||||||
"--");
|
"--");
|
||||||
if (!putline("", mci) || !putline(buf, mci))
|
if (!putline("", mci) || !putline(buf, mci))
|
||||||
goto writeerr;
|
goto writeerr;
|
||||||
@ -1727,9 +1733,9 @@ pruneroute(addr)
|
|||||||
|
|
||||||
/* slice off the angle brackets */
|
/* slice off the angle brackets */
|
||||||
i = strlen(at + 1);
|
i = strlen(at + 1);
|
||||||
if (i >= sizeof hostbuf)
|
if (i >= sizeof(hostbuf))
|
||||||
return false;
|
return false;
|
||||||
(void) sm_strlcpy(hostbuf, at + 1, sizeof hostbuf);
|
(void) sm_strlcpy(hostbuf, at + 1, sizeof(hostbuf));
|
||||||
hostbuf[i - 1] = '\0';
|
hostbuf[i - 1] = '\0';
|
||||||
|
|
||||||
while (start != NULL)
|
while (start != NULL)
|
||||||
@ -1745,8 +1751,8 @@ pruneroute(addr)
|
|||||||
*start = '\0';
|
*start = '\0';
|
||||||
comma = strrchr(addr, ',');
|
comma = strrchr(addr, ',');
|
||||||
if (comma != NULL && comma[1] == '@' &&
|
if (comma != NULL && comma[1] == '@' &&
|
||||||
strlen(comma + 2) < sizeof hostbuf)
|
strlen(comma + 2) < sizeof(hostbuf))
|
||||||
(void) sm_strlcpy(hostbuf, comma + 2, sizeof hostbuf);
|
(void) sm_strlcpy(hostbuf, comma + 2, sizeof(hostbuf));
|
||||||
else
|
else
|
||||||
comma = NULL;
|
comma = NULL;
|
||||||
*start = c;
|
*start = c;
|
||||||
|
Loading…
Reference in New Issue
Block a user